1 | import * as React from 'react';
|
2 | import { Component } from 'react';
|
3 | import { Animated, StatusBarAnimation, StyleProp, ViewStyle } from 'react-native';
|
4 | import { UserSelect, ActiveCursor, MouseButton } from '../handlers/gestureHandlerCommon';
|
5 | import { PanGestureHandler } from '../handlers/PanGestureHandler';
|
6 |
|
7 |
|
8 |
|
9 | export type DrawerPosition = 'left' | 'right';
|
10 |
|
11 |
|
12 |
|
13 | export type DrawerState = 'Idle' | 'Dragging' | 'Settling';
|
14 |
|
15 |
|
16 |
|
17 | export type DrawerType = 'front' | 'back' | 'slide';
|
18 |
|
19 |
|
20 |
|
21 | export type DrawerLockMode = 'unlocked' | 'locked-closed' | 'locked-open';
|
22 |
|
23 |
|
24 |
|
25 | export type DrawerKeyboardDismissMode = 'none' | 'on-drag';
|
26 | type AnimatedInterpolation = ReturnType<Animated.Value['interpolate']>;
|
27 |
|
28 |
|
29 |
|
30 | export interface DrawerLayoutProps {
|
31 | |
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 | renderNavigationView: (progressAnimatedValue: Animated.Value) => React.ReactNode;
|
41 | drawerPosition?: DrawerPosition;
|
42 | drawerWidth?: number;
|
43 | drawerBackgroundColor?: string;
|
44 | drawerLockMode?: DrawerLockMode;
|
45 | keyboardDismissMode?: DrawerKeyboardDismissMode;
|
46 | |
47 |
|
48 |
|
49 | onDrawerClose?: () => void;
|
50 | |
51 |
|
52 |
|
53 | onDrawerOpen?: () => void;
|
54 | |
55 |
|
56 |
|
57 | onDrawerStateChanged?: (newState: DrawerState, drawerWillShow: boolean) => void;
|
58 | useNativeAnimations?: boolean;
|
59 | drawerType?: DrawerType;
|
60 | |
61 |
|
62 |
|
63 |
|
64 | edgeWidth?: number;
|
65 | minSwipeDistance?: number;
|
66 | |
67 |
|
68 |
|
69 |
|
70 |
|
71 | hideStatusBar?: boolean;
|
72 | |
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 | statusBarAnimation?: StatusBarAnimation;
|
81 | |
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 | overlayColor?: string;
|
90 | contentContainerStyle?: StyleProp<ViewStyle>;
|
91 | drawerContainerStyle?: StyleProp<ViewStyle>;
|
92 | |
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 | enableTrackpadTwoFingerGesture?: boolean;
|
99 | onDrawerSlide?: (position: number) => void;
|
100 | onGestureRef?: (ref: PanGestureHandler) => void;
|
101 | children?: React.ReactNode | ((openValue?: AnimatedInterpolation) => React.ReactNode);
|
102 | /**
|
103 | * @default 'none'
|
104 | * Defines which userSelect property should be used.
|
105 | * Values: 'none'|'text'|'auto'
|
106 | */
|
107 | userSelect?: UserSelect;
|
108 | /**
|
109 | * @default 'auto'
|
110 | * Defines which cursor property should be used when gesture activates.
|
111 | * Values: see CSS cursor values
|
112 | */
|
113 | activeCursor?: ActiveCursor;
|
114 | /**
|
115 | * @default 'MouseButton.LEFT'
|
116 | * Allows to choose which mouse button should underlying pan handler react to.
|
117 | */
|
118 | mouseButton?: MouseButton;
|
119 | /**
|
120 | * @default 'false if MouseButton.RIGHT is specified'
|
121 | * Allows to enable/disable context menu.
|
122 | */
|
123 | enableContextMenu?: boolean;
|
124 | }
|
125 | /**
|
126 | * @deprecated DrawerLayout is deprecated. Use Reanimated version of DrawerLayout instead.
|
127 | */
|
128 | export type DrawerLayoutState = {
|
129 | dragX: Animated.Value;
|
130 | touchX: Animated.Value;
|
131 | drawerTranslation: Animated.Value;
|
132 | containerWidth: number;
|
133 | drawerState: DrawerState;
|
134 | drawerOpened: boolean;
|
135 | };
|
136 | /**
|
137 | * @deprecated DrawerLayout is deprecated. Use Reanimated version of DrawerLayout instead.
|
138 | */
|
139 | export type DrawerMovementOption = {
|
140 | velocity?: number;
|
141 | speed?: number;
|
142 | };
|
143 | /**
|
144 | * @deprecated use Reanimated version of DrawerLayout instead
|
145 | */
|
146 | export default class DrawerLayout extends Component<DrawerLayoutProps, DrawerLayoutState> {
|
147 | static defaultProps: {
|
148 | drawerWidth: number;
|
149 | drawerPosition: string;
|
150 | useNativeAnimations: boolean;
|
151 | drawerType: string;
|
152 | edgeWidth: number;
|
153 | minSwipeDistance: number;
|
154 | overlayColor: string;
|
155 | drawerLockMode: string;
|
156 | enableTrackpadTwoFingerGesture: boolean;
|
157 | };
|
158 | constructor(props: DrawerLayoutProps);
|
159 | shouldComponentUpdate(props: DrawerLayoutProps, state: DrawerLayoutState): boolean;
|
160 | private openValue?;
|
161 | private onGestureEvent?;
|
162 | private accessibilityIsModalView;
|
163 | private pointerEventsView;
|
164 | private panGestureHandler;
|
165 | private drawerShown;
|
166 | static positions: {
|
167 | Left: string;
|
168 | Right: string;
|
169 | };
|
170 | private updateAnimatedEvent;
|
171 | private handleContainerLayout;
|
172 | private emitStateChanged;
|
173 | private openingHandlerStateChange;
|
174 | private onTapHandlerStateChange;
|
175 | private handleRelease;
|
176 | private updateShowing;
|
177 | private animateDrawer;
|
178 | openDrawer: (options?: DrawerMovementOption) => void;
|
179 | closeDrawer: (options?: DrawerMovementOption) => void;
|
180 | private renderOverlay;
|
181 | private renderDrawer;
|
182 | private setPanGestureRef;
|
183 | render(): React.JSX.Element;
|
184 | }
|
185 | export {};
|