UNPKG

3.05 kBTypeScriptView Raw
1import * as React from 'react';
2import { Component } from 'react';
3import { Animated, StyleProp, ViewStyle } from 'react-native';
4import { PanGestureHandlerProps } from '../handlers/gestureHandlers';
5declare type SwipeableExcludes = Exclude<keyof PanGestureHandlerProps, 'onGestureEvent' | 'onHandlerStateChange'>;
6interface SwipeableProps extends Pick<PanGestureHandlerProps, SwipeableExcludes> {
7 enableTrackpadTwoFingerGesture?: boolean;
8 friction?: number;
9 leftThreshold?: number;
10 rightThreshold?: number;
11 overshootLeft?: boolean;
12 overshootRight?: boolean;
13 overshootFriction?: number;
14 onSwipeableLeftOpen?: () => void;
15 onSwipeableRightOpen?: () => void;
16 onSwipeableOpen?: () => void;
17 onSwipeableClose?: () => void;
18 onSwipeableLeftWillOpen?: () => void;
19 onSwipeableRightWillOpen?: () => void;
20 onSwipeableWillOpen?: () => void;
21 onSwipeableWillClose?: () => void;
22 /**
23 *
24 * This map describes the values to use as inputRange for extra interpolation:
25 * AnimatedValue: [startValue, endValue]
26 *
27 * progressAnimatedValue: [0, 1]
28 * dragAnimatedValue: [0, +]
29 *
30 * To support `rtl` flexbox layouts use `flexDirection` styling.
31 * */
32 renderLeftActions?: (progressAnimatedValue: Animated.AnimatedInterpolation, dragAnimatedValue: Animated.AnimatedInterpolation) => React.ReactNode;
33 /**
34 *
35 * This map describes the values to use as inputRange for extra interpolation:
36 * AnimatedValue: [startValue, endValue]
37 *
38 * progressAnimatedValue: [0, 1]
39 * dragAnimatedValue: [0, -]
40 *
41 * To support `rtl` flexbox layouts use `flexDirection` styling.
42 * */
43 renderRightActions?: (progressAnimatedValue: Animated.AnimatedInterpolation, dragAnimatedValue: Animated.AnimatedInterpolation) => React.ReactNode;
44 useNativeAnimations?: boolean;
45 animationOptions?: Record<string, unknown>;
46 containerStyle?: StyleProp<ViewStyle>;
47 childrenContainerStyle?: StyleProp<ViewStyle>;
48}
49declare type SwipeableState = {
50 dragX: Animated.Value;
51 rowTranslation: Animated.Value;
52 rowState: number;
53 leftWidth?: number;
54 rightOffset?: number;
55 rowWidth?: number;
56};
57export default class Swipeable extends Component<SwipeableProps, SwipeableState> {
58 static defaultProps: {
59 friction: number;
60 overshootFriction: number;
61 useNativeAnimations: boolean;
62 };
63 constructor(props: SwipeableProps);
64 UNSAFE_componentWillUpdate(props: SwipeableProps, state: SwipeableState): void;
65 private onGestureEvent?;
66 private transX?;
67 private showLeftAction?;
68 private leftActionTranslate?;
69 private showRightAction?;
70 private rightActionTranslate?;
71 private updateAnimatedEvent;
72 private onTapHandlerStateChange;
73 private onHandlerStateChange;
74 private handleRelease;
75 private animateRow;
76 private onRowLayout;
77 private currentOffset;
78 close: () => void;
79 openLeft: () => void;
80 openRight: () => void;
81 render(): JSX.Element;
82}
83export {};