1 | import * as React from 'react';
|
2 | import { Animated, EmitterSubscription, PanResponderGestureState, PanResponderInstance, StyleProp, ViewProps, ViewStyle } from 'react-native';
|
3 | import { Animation, CustomAnimation } from 'react-native-animatable';
|
4 | import { Direction, GestureResponderEvent, OnOrientationChange, Orientation, OrNull, PresentationStyle } from './types';
|
5 | export type OnSwipeCompleteParams = {
|
6 | swipingDirection: Direction;
|
7 | };
|
8 | type State = {
|
9 | showContent: boolean;
|
10 | isVisible: boolean;
|
11 | deviceWidth: number;
|
12 | deviceHeight: number;
|
13 | isSwipeable: boolean;
|
14 | pan: OrNull<Animated.ValueXY>;
|
15 | };
|
16 | declare const defaultProps: {
|
17 | animationIn: Animation | CustomAnimation;
|
18 | animationInTiming: number;
|
19 | animationOut: Animation | CustomAnimation;
|
20 | animationOutTiming: number;
|
21 | avoidKeyboard: boolean;
|
22 | coverScreen: boolean;
|
23 | hasBackdrop: boolean;
|
24 | backdropColor: string;
|
25 | backdropOpacity: number;
|
26 | backdropTransitionInTiming: number;
|
27 | backdropTransitionOutTiming: number;
|
28 | customBackdrop: React.ReactNode;
|
29 | useNativeDriver: boolean;
|
30 | deviceHeight: OrNull<number>;
|
31 | deviceWidth: OrNull<number>;
|
32 | hideModalContentWhileAnimating: boolean;
|
33 | propagateSwipe: boolean | ((event: GestureResponderEvent, gestureState: PanResponderGestureState) => boolean);
|
34 | isVisible: boolean;
|
35 | panResponderThreshold: number;
|
36 | swipeThreshold: number;
|
37 | onModalShow: () => void;
|
38 | onModalWillShow: () => void;
|
39 | onModalHide: () => void;
|
40 | onModalWillHide: () => void;
|
41 | onBackdropPress: () => void;
|
42 | onBackButtonPress: () => void;
|
43 | scrollTo: OrNull<(e: any) => void>;
|
44 | scrollOffset: number;
|
45 | scrollOffsetMax: number;
|
46 | scrollHorizontal: boolean;
|
47 | statusBarTranslucent: boolean;
|
48 | supportedOrientations: Orientation[];
|
49 | };
|
50 | export type ModalProps = ViewProps & {
|
51 | children: React.ReactNode;
|
52 | onSwipeStart?: (gestureState: PanResponderGestureState) => void;
|
53 | onSwipeMove?: (percentageShown: number, gestureState: PanResponderGestureState) => void;
|
54 | onSwipeComplete?: (params: OnSwipeCompleteParams, gestureState: PanResponderGestureState) => void;
|
55 | onSwipeCancel?: (gestureState: PanResponderGestureState) => void;
|
56 | style?: StyleProp<ViewStyle>;
|
57 | swipeDirection?: Direction | Array<Direction>;
|
58 | onDismiss?: () => void;
|
59 | onShow?: () => void;
|
60 | hardwareAccelerated?: boolean;
|
61 | onOrientationChange?: OnOrientationChange;
|
62 | presentationStyle?: PresentationStyle;
|
63 | useNativeDriverForBackdrop?: boolean;
|
64 | } & typeof defaultProps;
|
65 | export declare class ReactNativeModal extends React.Component<ModalProps, State> {
|
66 | static defaultProps: {
|
67 | animationIn: Animation | CustomAnimation;
|
68 | animationInTiming: number;
|
69 | animationOut: Animation | CustomAnimation;
|
70 | animationOutTiming: number;
|
71 | avoidKeyboard: boolean;
|
72 | coverScreen: boolean;
|
73 | hasBackdrop: boolean;
|
74 | backdropColor: string;
|
75 | backdropOpacity: number;
|
76 | backdropTransitionInTiming: number;
|
77 | backdropTransitionOutTiming: number;
|
78 | customBackdrop: React.ReactNode;
|
79 | useNativeDriver: boolean;
|
80 | deviceHeight: OrNull<number>;
|
81 | deviceWidth: OrNull<number>;
|
82 | hideModalContentWhileAnimating: boolean;
|
83 | propagateSwipe: boolean | ((event: GestureResponderEvent, gestureState: PanResponderGestureState) => boolean);
|
84 | isVisible: boolean;
|
85 | panResponderThreshold: number;
|
86 | swipeThreshold: number;
|
87 | onModalShow: () => void;
|
88 | onModalWillShow: () => void;
|
89 | onModalHide: () => void;
|
90 | onModalWillHide: () => void;
|
91 | onBackdropPress: () => void;
|
92 | onBackButtonPress: () => void;
|
93 | scrollTo: OrNull<(e: any) => void>;
|
94 | scrollOffset: number;
|
95 | scrollOffsetMax: number;
|
96 | scrollHorizontal: boolean;
|
97 | statusBarTranslucent: boolean;
|
98 | supportedOrientations: Orientation[];
|
99 | };
|
100 | private backHandler;
|
101 | state: State;
|
102 | isTransitioning: boolean;
|
103 | inSwipeClosingState: boolean;
|
104 | currentSwipingDirection: OrNull<Direction>;
|
105 | animationIn: string;
|
106 | animationOut: string;
|
107 | backdropRef: any;
|
108 | contentRef: any;
|
109 | panResponder: OrNull<PanResponderInstance>;
|
110 | didUpdateDimensionsEmitter: OrNull<EmitterSubscription>;
|
111 | interactionHandle: OrNull<number>;
|
112 | constructor(props: ModalProps);
|
113 | static getDerivedStateFromProps(nextProps: Readonly<ModalProps>, state: State): {
|
114 | isVisible: boolean;
|
115 | showContent: boolean;
|
116 | } | null;
|
117 | componentDidMount(): void;
|
118 | componentWillUnmount(): void;
|
119 | componentDidUpdate(prevProps: ModalProps): void;
|
120 | getDeviceHeight: () => number;
|
121 | getDeviceWidth: () => number;
|
122 | onBackButtonPress: () => boolean;
|
123 | shouldPropagateSwipe: (evt: GestureResponderEvent, gestureState: PanResponderGestureState) => boolean;
|
124 | buildPanResponder: () => void;
|
125 | getAccDistancePerDirection: (gestureState: PanResponderGestureState) => number;
|
126 | getSwipingDirection: (gestureState: PanResponderGestureState) => "up" | "down" | "left" | "right";
|
127 | calcDistancePercentage: (gestureState: PanResponderGestureState) => number;
|
128 | createAnimationEventForSwipe: () => (...args: any[]) => void;
|
129 | isDirectionIncluded: (direction: Direction) => boolean;
|
130 | isSwipeDirectionAllowed: ({ dy, dx }: PanResponderGestureState) => boolean;
|
131 | handleDimensionsUpdate: () => void;
|
132 | open: () => void;
|
133 | close: () => void;
|
134 | makeBackdrop: () => React.JSX.Element | null;
|
135 | render(): React.JSX.Element;
|
136 | }
|
137 | export default ReactNativeModal;
|