@react-navigation/drawer 6.6.0 → 7.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/index.js +4 -6
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/navigators/createDrawerNavigator.js +3 -43
- package/lib/commonjs/navigators/createDrawerNavigator.js.map +1 -1
- package/lib/commonjs/views/DrawerItem.js +9 -5
- package/lib/commonjs/views/DrawerItem.js.map +1 -1
- package/lib/commonjs/views/DrawerItemList.js +6 -6
- package/lib/commonjs/views/DrawerItemList.js.map +1 -1
- package/lib/commonjs/views/DrawerView.js +21 -58
- package/lib/commonjs/views/DrawerView.js.map +1 -1
- package/lib/module/index.js +1 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/navigators/createDrawerNavigator.js +3 -43
- package/lib/module/navigators/createDrawerNavigator.js.map +1 -1
- package/lib/module/views/DrawerItem.js +10 -6
- package/lib/module/views/DrawerItem.js.map +1 -1
- package/lib/module/views/DrawerItemList.js +7 -7
- package/lib/module/views/DrawerItemList.js.map +1 -1
- package/lib/module/views/DrawerView.js +21 -58
- package/lib/module/views/DrawerView.js.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -3
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/navigators/createDrawerNavigator.d.ts +8 -3
- package/lib/typescript/src/navigators/createDrawerNavigator.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +17 -16
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/views/DrawerItem.d.ts +10 -5
- package/lib/typescript/src/views/DrawerItem.d.ts.map +1 -1
- package/lib/typescript/src/views/DrawerItemList.d.ts +1 -1
- package/lib/typescript/src/views/DrawerItemList.d.ts.map +1 -1
- package/lib/typescript/src/views/DrawerToggleButton.d.ts +1 -1
- package/lib/typescript/src/views/DrawerToggleButton.d.ts.map +1 -1
- package/lib/typescript/src/views/DrawerView.d.ts +1 -1
- package/lib/typescript/src/views/DrawerView.d.ts.map +1 -1
- package/lib/typescript/src/views/ScreenFallback.d.ts +1 -1
- package/lib/typescript/src/views/ScreenFallback.d.ts.map +1 -1
- package/package.json +14 -14
- package/src/index.tsx +5 -3
- package/src/navigators/createDrawerNavigator.tsx +2 -72
- package/src/types.tsx +4 -3
- package/src/views/DrawerItem.tsx +20 -11
- package/src/views/DrawerItemList.tsx +5 -4
- package/src/views/DrawerView.tsx +15 -68
- package/lib/commonjs/utils/DrawerGestureContext.js +0 -12
- package/lib/commonjs/utils/DrawerGestureContext.js.map +0 -1
- package/lib/commonjs/utils/DrawerProgressContext.js +0 -12
- package/lib/commonjs/utils/DrawerProgressContext.js.map +0 -1
- package/lib/commonjs/utils/useDrawerProgress.js +0 -19
- package/lib/commonjs/utils/useDrawerProgress.js.map +0 -1
- package/lib/commonjs/views/GestureHandler.android.js +0 -17
- package/lib/commonjs/views/GestureHandler.android.js.map +0 -1
- package/lib/commonjs/views/GestureHandler.ios.js +0 -17
- package/lib/commonjs/views/GestureHandler.ios.js.map +0 -1
- package/lib/commonjs/views/GestureHandler.js +0 -32
- package/lib/commonjs/views/GestureHandler.js.map +0 -1
- package/lib/commonjs/views/GestureHandlerNative.js +0 -37
- package/lib/commonjs/views/GestureHandlerNative.js.map +0 -1
- package/lib/commonjs/views/legacy/Drawer.js +0 -420
- package/lib/commonjs/views/legacy/Drawer.js.map +0 -1
- package/lib/commonjs/views/legacy/Overlay.js +0 -74
- package/lib/commonjs/views/legacy/Overlay.js.map +0 -1
- package/lib/commonjs/views/modern/Drawer.js +0 -304
- package/lib/commonjs/views/modern/Drawer.js.map +0 -1
- package/lib/commonjs/views/modern/Overlay.js +0 -69
- package/lib/commonjs/views/modern/Overlay.js.map +0 -1
- package/lib/module/utils/DrawerGestureContext.js +0 -3
- package/lib/module/utils/DrawerGestureContext.js.map +0 -1
- package/lib/module/utils/DrawerProgressContext.js +0 -3
- package/lib/module/utils/DrawerProgressContext.js.map +0 -1
- package/lib/module/utils/useDrawerProgress.js +0 -10
- package/lib/module/utils/useDrawerProgress.js.map +0 -1
- package/lib/module/views/GestureHandler.android.js +0 -2
- package/lib/module/views/GestureHandler.android.js.map +0 -1
- package/lib/module/views/GestureHandler.ios.js +0 -2
- package/lib/module/views/GestureHandler.ios.js.map +0 -1
- package/lib/module/views/GestureHandler.js +0 -20
- package/lib/module/views/GestureHandler.js.map +0 -1
- package/lib/module/views/GestureHandlerNative.js +0 -11
- package/lib/module/views/GestureHandlerNative.js.map +0 -1
- package/lib/module/views/legacy/Drawer.js +0 -410
- package/lib/module/views/legacy/Drawer.js.map +0 -1
- package/lib/module/views/legacy/Overlay.js +0 -64
- package/lib/module/views/legacy/Overlay.js.map +0 -1
- package/lib/module/views/modern/Drawer.js +0 -295
- package/lib/module/views/modern/Drawer.js.map +0 -1
- package/lib/module/views/modern/Overlay.js +0 -60
- package/lib/module/views/modern/Overlay.js.map +0 -1
- package/lib/typescript/src/utils/DrawerGestureContext.d.ts +0 -4
- package/lib/typescript/src/utils/DrawerGestureContext.d.ts.map +0 -1
- package/lib/typescript/src/utils/DrawerProgressContext.d.ts +0 -5
- package/lib/typescript/src/utils/DrawerProgressContext.d.ts.map +0 -1
- package/lib/typescript/src/utils/useDrawerProgress.d.ts +0 -3
- package/lib/typescript/src/utils/useDrawerProgress.d.ts.map +0 -1
- package/lib/typescript/src/views/GestureHandler.android.d.ts +0 -2
- package/lib/typescript/src/views/GestureHandler.android.d.ts.map +0 -1
- package/lib/typescript/src/views/GestureHandler.d.ts +0 -15
- package/lib/typescript/src/views/GestureHandler.d.ts.map +0 -1
- package/lib/typescript/src/views/GestureHandler.ios.d.ts +0 -2
- package/lib/typescript/src/views/GestureHandler.ios.d.ts.map +0 -1
- package/lib/typescript/src/views/GestureHandlerNative.d.ts +0 -6
- package/lib/typescript/src/views/GestureHandlerNative.d.ts.map +0 -1
- package/lib/typescript/src/views/legacy/Drawer.d.ts +0 -45
- package/lib/typescript/src/views/legacy/Drawer.d.ts.map +0 -1
- package/lib/typescript/src/views/legacy/Overlay.d.ts +0 -75
- package/lib/typescript/src/views/legacy/Overlay.d.ts.map +0 -1
- package/lib/typescript/src/views/modern/Drawer.d.ts +0 -4
- package/lib/typescript/src/views/modern/Drawer.d.ts.map +0 -1
- package/lib/typescript/src/views/modern/Overlay.d.ts +0 -75
- package/lib/typescript/src/views/modern/Overlay.d.ts.map +0 -1
- package/src/utils/DrawerGestureContext.tsx +0 -3
- package/src/utils/DrawerProgressContext.tsx +0 -6
- package/src/utils/useDrawerProgress.tsx +0 -18
- package/src/views/GestureHandler.android.tsx +0 -1
- package/src/views/GestureHandler.ios.tsx +0 -1
- package/src/views/GestureHandler.tsx +0 -29
- package/src/views/GestureHandlerNative.tsx +0 -24
- package/src/views/legacy/Drawer.tsx +0 -672
- package/src/views/legacy/Overlay.tsx +0 -87
- package/src/views/modern/Drawer.tsx +0 -425
- package/src/views/modern/Overlay.tsx +0 -82
|
@@ -1,410 +0,0 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
4
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
5
|
-
import * as React from 'react';
|
|
6
|
-
import { I18nManager, InteractionManager, Keyboard, Platform, StatusBar, StyleSheet, View } from 'react-native';
|
|
7
|
-
import Animated from 'react-native-reanimated';
|
|
8
|
-
import DrawerProgressContext from '../../utils/DrawerProgressContext';
|
|
9
|
-
import { GestureState, PanGestureHandler } from '../GestureHandler';
|
|
10
|
-
import Overlay from './Overlay';
|
|
11
|
-
const {
|
|
12
|
-
Clock,
|
|
13
|
-
Value,
|
|
14
|
-
onChange,
|
|
15
|
-
clockRunning,
|
|
16
|
-
startClock,
|
|
17
|
-
stopClock,
|
|
18
|
-
spring,
|
|
19
|
-
abs,
|
|
20
|
-
add,
|
|
21
|
-
and,
|
|
22
|
-
block,
|
|
23
|
-
call,
|
|
24
|
-
cond,
|
|
25
|
-
divide,
|
|
26
|
-
eq,
|
|
27
|
-
event,
|
|
28
|
-
greaterThan,
|
|
29
|
-
lessThan,
|
|
30
|
-
max,
|
|
31
|
-
min,
|
|
32
|
-
multiply,
|
|
33
|
-
neq,
|
|
34
|
-
or,
|
|
35
|
-
set,
|
|
36
|
-
sub
|
|
37
|
-
} = Animated;
|
|
38
|
-
const TRUE = 1;
|
|
39
|
-
const FALSE = 0;
|
|
40
|
-
const NOOP = 0;
|
|
41
|
-
const UNSET = -1;
|
|
42
|
-
const DIRECTION_LEFT = 1;
|
|
43
|
-
const DIRECTION_RIGHT = -1;
|
|
44
|
-
const SWIPE_DISTANCE_MINIMUM = 5;
|
|
45
|
-
const DEFAULT_DRAWER_WIDTH = '80%';
|
|
46
|
-
const SPRING_CONFIG = {
|
|
47
|
-
stiffness: 1000,
|
|
48
|
-
damping: 500,
|
|
49
|
-
mass: 3,
|
|
50
|
-
overshootClamping: true,
|
|
51
|
-
restDisplacementThreshold: 0.01,
|
|
52
|
-
restSpeedThreshold: 0.01
|
|
53
|
-
};
|
|
54
|
-
const ANIMATED_ZERO = new Animated.Value(0);
|
|
55
|
-
const ANIMATED_ONE = new Animated.Value(1);
|
|
56
|
-
export default class DrawerView extends React.Component {
|
|
57
|
-
constructor() {
|
|
58
|
-
super(...arguments);
|
|
59
|
-
_defineProperty(this, "handleEndInteraction", () => {
|
|
60
|
-
if (this.interactionHandle !== undefined) {
|
|
61
|
-
InteractionManager.clearInteractionHandle(this.interactionHandle);
|
|
62
|
-
this.interactionHandle = undefined;
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
_defineProperty(this, "handleStartInteraction", () => {
|
|
66
|
-
if (this.interactionHandle === undefined) {
|
|
67
|
-
this.interactionHandle = InteractionManager.createInteractionHandle();
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
_defineProperty(this, "getDrawerWidth", () => {
|
|
71
|
-
const {
|
|
72
|
-
drawerStyle,
|
|
73
|
-
dimensions
|
|
74
|
-
} = this.props;
|
|
75
|
-
const {
|
|
76
|
-
width = DEFAULT_DRAWER_WIDTH
|
|
77
|
-
} = StyleSheet.flatten(drawerStyle) || {};
|
|
78
|
-
if (typeof width === 'string' && width.endsWith('%')) {
|
|
79
|
-
// Try to calculate width if a percentage is given
|
|
80
|
-
const percentage = Number(width.replace(/%$/, ''));
|
|
81
|
-
if (Number.isFinite(percentage)) {
|
|
82
|
-
return dimensions.width * (percentage / 100);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return typeof width === 'number' ? width : 0;
|
|
86
|
-
});
|
|
87
|
-
_defineProperty(this, "clock", new Clock());
|
|
88
|
-
_defineProperty(this, "interactionHandle", void 0);
|
|
89
|
-
_defineProperty(this, "isDrawerTypeFront", new Value(this.props.drawerType === 'front' ? TRUE : FALSE));
|
|
90
|
-
_defineProperty(this, "isOpen", new Value(this.props.open ? TRUE : FALSE));
|
|
91
|
-
_defineProperty(this, "nextIsOpen", new Value(UNSET));
|
|
92
|
-
_defineProperty(this, "isSwiping", new Value(FALSE));
|
|
93
|
-
_defineProperty(this, "initialDrawerWidth", this.getDrawerWidth());
|
|
94
|
-
_defineProperty(this, "gestureState", new Value(GestureState.UNDETERMINED));
|
|
95
|
-
_defineProperty(this, "touchX", new Value(0));
|
|
96
|
-
_defineProperty(this, "velocityX", new Value(0));
|
|
97
|
-
_defineProperty(this, "gestureX", new Value(0));
|
|
98
|
-
_defineProperty(this, "offsetX", new Value(0));
|
|
99
|
-
_defineProperty(this, "position", new Value(this.props.open ? this.initialDrawerWidth * (this.props.drawerPosition === 'right' ? DIRECTION_RIGHT : DIRECTION_LEFT) : 0));
|
|
100
|
-
_defineProperty(this, "containerWidth", new Value(this.props.dimensions.width));
|
|
101
|
-
_defineProperty(this, "drawerWidth", new Value(this.initialDrawerWidth));
|
|
102
|
-
_defineProperty(this, "drawerOpacity", new Value(this.props.drawerType === 'permanent' ? 1 : 0));
|
|
103
|
-
_defineProperty(this, "drawerPosition", new Value(this.props.drawerPosition === 'right' ? DIRECTION_RIGHT : DIRECTION_LEFT));
|
|
104
|
-
_defineProperty(this, "touchDistanceFromDrawer", cond(this.isDrawerTypeFront, cond(eq(this.drawerPosition, DIRECTION_LEFT), max(
|
|
105
|
-
// Distance of touch start from left screen edge - Drawer width
|
|
106
|
-
sub(sub(this.touchX, this.gestureX), this.drawerWidth), 0), min(multiply(
|
|
107
|
-
// Distance of drawer from left screen edge - Touch start point
|
|
108
|
-
sub(sub(this.containerWidth, this.drawerWidth), sub(this.touchX, this.gestureX)), DIRECTION_RIGHT), 0)), 0));
|
|
109
|
-
_defineProperty(this, "swipeDistanceThreshold", new Value(this.props.swipeDistanceThreshold));
|
|
110
|
-
_defineProperty(this, "swipeVelocityThreshold", new Value(this.props.swipeVelocityThreshold));
|
|
111
|
-
_defineProperty(this, "currentOpenValue", this.props.open);
|
|
112
|
-
_defineProperty(this, "pendingOpenValue", void 0);
|
|
113
|
-
_defineProperty(this, "isStatusBarHidden", false);
|
|
114
|
-
_defineProperty(this, "manuallyTriggerSpring", new Value(FALSE));
|
|
115
|
-
_defineProperty(this, "transitionTo", isOpen => {
|
|
116
|
-
const toValue = new Value(0);
|
|
117
|
-
const frameTime = new Value(0);
|
|
118
|
-
const state = {
|
|
119
|
-
position: this.position,
|
|
120
|
-
time: new Value(0),
|
|
121
|
-
finished: new Value(FALSE),
|
|
122
|
-
velocity: new Value(0)
|
|
123
|
-
};
|
|
124
|
-
return block([cond(clockRunning(this.clock), NOOP, [
|
|
125
|
-
// Animation wasn't running before
|
|
126
|
-
// Set the initial values and start the clock
|
|
127
|
-
set(toValue, multiply(isOpen, this.drawerWidth, this.drawerPosition)), set(frameTime, 0), set(state.time, 0), set(state.finished, FALSE), set(state.velocity, this.velocityX), set(this.isOpen, isOpen), startClock(this.clock), call([], this.handleStartInteraction), set(this.manuallyTriggerSpring, FALSE)]), spring(this.clock, state, {
|
|
128
|
-
...SPRING_CONFIG,
|
|
129
|
-
toValue
|
|
130
|
-
}), cond(state.finished, [
|
|
131
|
-
// Reset gesture and velocity from previous gesture
|
|
132
|
-
set(this.touchX, 0), set(this.gestureX, 0), set(this.velocityX, 0), set(this.offsetX, 0),
|
|
133
|
-
// When the animation finishes, stop the clock
|
|
134
|
-
stopClock(this.clock), call([this.isOpen], _ref => {
|
|
135
|
-
let [value] = _ref;
|
|
136
|
-
const open = Boolean(value);
|
|
137
|
-
this.handleEndInteraction();
|
|
138
|
-
if (open !== this.props.open) {
|
|
139
|
-
// Sync drawer's state after animation finished
|
|
140
|
-
// This shouldn't be necessary, but there seems to be an issue on iOS
|
|
141
|
-
this.toggleDrawer(this.props.open);
|
|
142
|
-
}
|
|
143
|
-
})])]);
|
|
144
|
-
});
|
|
145
|
-
_defineProperty(this, "dragX", block([onChange(this.isOpen, call([this.isOpen], _ref2 => {
|
|
146
|
-
let [value] = _ref2;
|
|
147
|
-
const open = Boolean(value);
|
|
148
|
-
this.currentOpenValue = open;
|
|
149
|
-
|
|
150
|
-
// Without this check, the drawer can go to an infinite update <-> animate loop for sync updates
|
|
151
|
-
if (open !== this.props.open) {
|
|
152
|
-
// If the mode changed, update state
|
|
153
|
-
if (open) {
|
|
154
|
-
this.props.onOpen();
|
|
155
|
-
} else {
|
|
156
|
-
this.props.onClose();
|
|
157
|
-
}
|
|
158
|
-
this.pendingOpenValue = open;
|
|
159
|
-
|
|
160
|
-
// Force componentDidUpdate to fire, whether user does a setState or not
|
|
161
|
-
// This allows us to detect when the user drops the update and revert back
|
|
162
|
-
// It's necessary to make sure that the state stays in sync
|
|
163
|
-
this.forceUpdate();
|
|
164
|
-
}
|
|
165
|
-
})), onChange(this.nextIsOpen, cond(neq(this.nextIsOpen, UNSET), [
|
|
166
|
-
// Stop any running animations
|
|
167
|
-
cond(clockRunning(this.clock), stopClock(this.clock)),
|
|
168
|
-
// Update the open value to trigger the transition
|
|
169
|
-
set(this.isOpen, this.nextIsOpen), set(this.gestureX, 0), set(this.nextIsOpen, UNSET)])),
|
|
170
|
-
// This block must be after the this.isOpen listener since we check for current value
|
|
171
|
-
onChange(this.isSwiping,
|
|
172
|
-
// Listen to updates for this value only when it changes
|
|
173
|
-
// Without `onChange`, this will fire even if the value didn't change
|
|
174
|
-
// We don't want to call the listeners if the value didn't change
|
|
175
|
-
call([this.isSwiping], _ref3 => {
|
|
176
|
-
let [value] = _ref3;
|
|
177
|
-
const {
|
|
178
|
-
keyboardDismissMode
|
|
179
|
-
} = this.props;
|
|
180
|
-
if (value === TRUE) {
|
|
181
|
-
if (keyboardDismissMode === 'on-drag') {
|
|
182
|
-
Keyboard.dismiss();
|
|
183
|
-
}
|
|
184
|
-
this.toggleStatusBar(true);
|
|
185
|
-
} else {
|
|
186
|
-
this.toggleStatusBar(this.currentOpenValue);
|
|
187
|
-
}
|
|
188
|
-
})), onChange(this.gestureState, cond(eq(this.gestureState, GestureState.ACTIVE), call([], this.handleStartInteraction))), cond(eq(this.gestureState, GestureState.ACTIVE), [cond(this.isSwiping, NOOP, [
|
|
189
|
-
// We weren't dragging before, set it to true
|
|
190
|
-
set(this.isSwiping, TRUE),
|
|
191
|
-
// Also update the drag offset to the last position
|
|
192
|
-
set(this.offsetX, this.position)]),
|
|
193
|
-
// Update position with previous offset + gesture distance
|
|
194
|
-
set(this.position, add(this.offsetX, this.gestureX, this.touchDistanceFromDrawer)),
|
|
195
|
-
// Stop animations while we're dragging
|
|
196
|
-
stopClock(this.clock)], [set(this.isSwiping, FALSE), set(this.touchX, 0), this.transitionTo(cond(this.manuallyTriggerSpring, this.isOpen, cond(or(and(greaterThan(abs(this.gestureX), SWIPE_DISTANCE_MINIMUM), greaterThan(abs(this.velocityX), this.swipeVelocityThreshold)), greaterThan(abs(this.gestureX), this.swipeDistanceThreshold)), cond(eq(this.drawerPosition, DIRECTION_LEFT),
|
|
197
|
-
// If swiped to right, open the drawer, otherwise close it
|
|
198
|
-
greaterThan(cond(eq(this.velocityX, 0), this.gestureX, this.velocityX), 0),
|
|
199
|
-
// If swiped to left, open the drawer, otherwise close it
|
|
200
|
-
lessThan(cond(eq(this.velocityX, 0), this.gestureX, this.velocityX), 0)), this.isOpen)))]), this.position]));
|
|
201
|
-
_defineProperty(this, "translateX", cond(eq(this.drawerPosition, DIRECTION_RIGHT), min(max(multiply(this.drawerWidth, -1), this.dragX), 0), max(min(this.drawerWidth, this.dragX), 0)));
|
|
202
|
-
_defineProperty(this, "progress", cond(
|
|
203
|
-
// Check if the drawer width is available to avoid division by zero
|
|
204
|
-
eq(this.drawerWidth, 0), 0, abs(divide(this.translateX, this.drawerWidth))));
|
|
205
|
-
_defineProperty(this, "handleGestureEvent", event([{
|
|
206
|
-
nativeEvent: {
|
|
207
|
-
x: this.touchX,
|
|
208
|
-
translationX: this.gestureX,
|
|
209
|
-
velocityX: this.velocityX
|
|
210
|
-
}
|
|
211
|
-
}]));
|
|
212
|
-
_defineProperty(this, "handleGestureStateChange", event([{
|
|
213
|
-
nativeEvent: {
|
|
214
|
-
state: s => set(this.gestureState, s)
|
|
215
|
-
}
|
|
216
|
-
}]));
|
|
217
|
-
_defineProperty(this, "handleContainerLayout", e => this.containerWidth.setValue(e.nativeEvent.layout.width));
|
|
218
|
-
_defineProperty(this, "handleDrawerLayout", e => {
|
|
219
|
-
this.drawerWidth.setValue(e.nativeEvent.layout.width);
|
|
220
|
-
this.toggleDrawer(this.props.open);
|
|
221
|
-
|
|
222
|
-
// Until layout is available, drawer is hidden with opacity: 0 by default
|
|
223
|
-
// Show it in the next frame when layout is available
|
|
224
|
-
// If we don't delay it until the next frame, there's a visible flicker
|
|
225
|
-
requestAnimationFrame(() => requestAnimationFrame(() => this.drawerOpacity.setValue(1)));
|
|
226
|
-
});
|
|
227
|
-
_defineProperty(this, "toggleDrawer", open => {
|
|
228
|
-
if (this.currentOpenValue !== open) {
|
|
229
|
-
this.nextIsOpen.setValue(open ? TRUE : FALSE);
|
|
230
|
-
|
|
231
|
-
// This value will also be set shortly after as changing this.nextIsOpen changes this.isOpen
|
|
232
|
-
// However, there's a race condition on Android, so we need to set a bit earlier
|
|
233
|
-
this.currentOpenValue = open;
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
_defineProperty(this, "toggleStatusBar", hidden => {
|
|
237
|
-
const {
|
|
238
|
-
hideStatusBarOnOpen: hideStatusBar,
|
|
239
|
-
statusBarAnimation
|
|
240
|
-
} = this.props;
|
|
241
|
-
if (hideStatusBar && this.isStatusBarHidden !== hidden) {
|
|
242
|
-
this.isStatusBarHidden = hidden;
|
|
243
|
-
StatusBar.setHidden(hidden, statusBarAnimation);
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
componentDidUpdate(prevProps) {
|
|
248
|
-
const {
|
|
249
|
-
open,
|
|
250
|
-
drawerPosition,
|
|
251
|
-
drawerType,
|
|
252
|
-
swipeDistanceThreshold,
|
|
253
|
-
swipeVelocityThreshold,
|
|
254
|
-
hideStatusBarOnOpen: hideStatusBar
|
|
255
|
-
} = this.props;
|
|
256
|
-
if (
|
|
257
|
-
// If we're not in the middle of a transition, sync the drawer's open state
|
|
258
|
-
typeof this.pendingOpenValue !== 'boolean' || open !== this.pendingOpenValue) {
|
|
259
|
-
this.toggleDrawer(open);
|
|
260
|
-
}
|
|
261
|
-
this.pendingOpenValue = undefined;
|
|
262
|
-
if (open !== prevProps.open && hideStatusBar) {
|
|
263
|
-
this.toggleStatusBar(open);
|
|
264
|
-
}
|
|
265
|
-
if (prevProps.drawerPosition !== drawerPosition) {
|
|
266
|
-
this.drawerPosition.setValue(drawerPosition === 'right' ? DIRECTION_RIGHT : DIRECTION_LEFT);
|
|
267
|
-
}
|
|
268
|
-
if (prevProps.drawerType !== drawerType) {
|
|
269
|
-
this.isDrawerTypeFront.setValue(drawerType === 'front' ? TRUE : FALSE);
|
|
270
|
-
}
|
|
271
|
-
if (prevProps.swipeDistanceThreshold !== swipeDistanceThreshold) {
|
|
272
|
-
this.swipeDistanceThreshold.setValue(swipeDistanceThreshold);
|
|
273
|
-
}
|
|
274
|
-
if (prevProps.swipeVelocityThreshold !== swipeVelocityThreshold) {
|
|
275
|
-
this.swipeVelocityThreshold.setValue(swipeVelocityThreshold);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
componentWillUnmount() {
|
|
279
|
-
this.toggleStatusBar(false);
|
|
280
|
-
this.handleEndInteraction();
|
|
281
|
-
}
|
|
282
|
-
render() {
|
|
283
|
-
const {
|
|
284
|
-
open,
|
|
285
|
-
swipeEnabled,
|
|
286
|
-
drawerPosition,
|
|
287
|
-
drawerType,
|
|
288
|
-
swipeEdgeWidth,
|
|
289
|
-
drawerStyle,
|
|
290
|
-
overlayStyle,
|
|
291
|
-
renderDrawerContent,
|
|
292
|
-
renderSceneContent,
|
|
293
|
-
gestureHandlerProps,
|
|
294
|
-
overlayAccessibilityLabel
|
|
295
|
-
} = this.props;
|
|
296
|
-
const isOpen = drawerType === 'permanent' ? true : open;
|
|
297
|
-
const isRight = drawerPosition === 'right';
|
|
298
|
-
const contentTranslateX = drawerType === 'front' ? ANIMATED_ZERO : this.translateX;
|
|
299
|
-
const drawerTranslateX = drawerType === 'back' ? I18nManager.getConstants().isRTL ? multiply(sub(this.containerWidth, this.drawerWidth), isRight ? 1 : -1) : ANIMATED_ZERO : this.translateX;
|
|
300
|
-
const offset = drawerType === 'back' ? 0 : I18nManager.getConstants().isRTL ? '100%' : multiply(this.drawerWidth, -1);
|
|
301
|
-
|
|
302
|
-
// FIXME: Currently hitSlop is broken when on Android when drawer is on right
|
|
303
|
-
// https://github.com/software-mansion/react-native-gesture-handler/issues/569
|
|
304
|
-
const hitSlop = isRight ?
|
|
305
|
-
// Extend hitSlop to the side of the screen when drawer is closed
|
|
306
|
-
// This lets the user drag the drawer from the side of the screen
|
|
307
|
-
{
|
|
308
|
-
right: 0,
|
|
309
|
-
width: isOpen ? undefined : swipeEdgeWidth
|
|
310
|
-
} : {
|
|
311
|
-
left: 0,
|
|
312
|
-
width: isOpen ? undefined : swipeEdgeWidth
|
|
313
|
-
};
|
|
314
|
-
const progress = drawerType === 'permanent' ? ANIMATED_ONE : this.progress;
|
|
315
|
-
return /*#__PURE__*/React.createElement(DrawerProgressContext.Provider, {
|
|
316
|
-
value: progress
|
|
317
|
-
}, /*#__PURE__*/React.createElement(PanGestureHandler, _extends({
|
|
318
|
-
activeOffsetX: [-SWIPE_DISTANCE_MINIMUM, SWIPE_DISTANCE_MINIMUM],
|
|
319
|
-
failOffsetY: [-SWIPE_DISTANCE_MINIMUM, SWIPE_DISTANCE_MINIMUM],
|
|
320
|
-
onGestureEvent: this.handleGestureEvent,
|
|
321
|
-
onHandlerStateChange: this.handleGestureStateChange,
|
|
322
|
-
hitSlop: hitSlop,
|
|
323
|
-
enabled: drawerType !== 'permanent' && swipeEnabled
|
|
324
|
-
}, gestureHandlerProps), /*#__PURE__*/React.createElement(Animated.View, {
|
|
325
|
-
onLayout: this.handleContainerLayout,
|
|
326
|
-
style: [styles.main, {
|
|
327
|
-
flexDirection: drawerType === 'permanent' && !isRight ? 'row-reverse' : 'row'
|
|
328
|
-
}]
|
|
329
|
-
}, /*#__PURE__*/React.createElement(Animated.View, {
|
|
330
|
-
style: [styles.content, {
|
|
331
|
-
transform: drawerType === 'permanent' ?
|
|
332
|
-
// Reanimated needs the property to be present, but it results in Browser bug
|
|
333
|
-
// https://bugs.chromium.org/p/chromium/issues/detail?id=20574
|
|
334
|
-
[] : [{
|
|
335
|
-
translateX: contentTranslateX
|
|
336
|
-
}]
|
|
337
|
-
}]
|
|
338
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
339
|
-
accessibilityElementsHidden: isOpen && drawerType !== 'permanent',
|
|
340
|
-
importantForAccessibility: isOpen && drawerType !== 'permanent' ? 'no-hide-descendants' : 'auto',
|
|
341
|
-
style: styles.content
|
|
342
|
-
}, renderSceneContent()),
|
|
343
|
-
// Disable overlay if sidebar is permanent
|
|
344
|
-
drawerType === 'permanent' ? null : /*#__PURE__*/React.createElement(Overlay, {
|
|
345
|
-
progress: progress,
|
|
346
|
-
onPress: () => this.toggleDrawer(false),
|
|
347
|
-
accessibilityLabel: overlayAccessibilityLabel,
|
|
348
|
-
style: overlayStyle,
|
|
349
|
-
accessibilityElementsHidden: !isOpen,
|
|
350
|
-
importantForAccessibility: isOpen ? 'auto' : 'no-hide-descendants'
|
|
351
|
-
})), /*#__PURE__*/React.createElement(Animated.Code, {
|
|
352
|
-
// This is needed to make sure that container width updates with `setValue`
|
|
353
|
-
// Without this, it won't update when not used in styles
|
|
354
|
-
exec: this.containerWidth
|
|
355
|
-
}), drawerType === 'permanent' ? null : /*#__PURE__*/React.createElement(Animated.Code, {
|
|
356
|
-
exec: block([onChange(this.manuallyTriggerSpring, [cond(eq(this.manuallyTriggerSpring, TRUE), [set(this.nextIsOpen, FALSE), call([], () => this.currentOpenValue = false)])])])
|
|
357
|
-
}), /*#__PURE__*/React.createElement(Animated.View, {
|
|
358
|
-
removeClippedSubviews: Platform.OS !== 'ios',
|
|
359
|
-
onLayout: this.handleDrawerLayout,
|
|
360
|
-
style: [styles.container, {
|
|
361
|
-
transform: drawerType === 'permanent' ?
|
|
362
|
-
// Reanimated needs the property to be present, but it results in Browser bug
|
|
363
|
-
// https://bugs.chromium.org/p/chromium/issues/detail?id=20574
|
|
364
|
-
[] : [{
|
|
365
|
-
translateX: drawerTranslateX
|
|
366
|
-
}],
|
|
367
|
-
opacity: this.drawerOpacity
|
|
368
|
-
}, drawerType === 'permanent' ?
|
|
369
|
-
// Without this, the `left`/`right` values don't get reset
|
|
370
|
-
isRight ? {
|
|
371
|
-
right: 0
|
|
372
|
-
} : {
|
|
373
|
-
left: 0
|
|
374
|
-
} : [styles.nonPermanent, isRight ? {
|
|
375
|
-
right: offset
|
|
376
|
-
} : {
|
|
377
|
-
left: offset
|
|
378
|
-
}, {
|
|
379
|
-
zIndex: drawerType === 'back' ? -1 : 0
|
|
380
|
-
}], drawerStyle]
|
|
381
|
-
}, renderDrawerContent()))));
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
const styles = StyleSheet.create({
|
|
385
|
-
container: {
|
|
386
|
-
backgroundColor: 'white',
|
|
387
|
-
maxWidth: '100%'
|
|
388
|
-
},
|
|
389
|
-
nonPermanent: {
|
|
390
|
-
position: 'absolute',
|
|
391
|
-
top: 0,
|
|
392
|
-
bottom: 0,
|
|
393
|
-
width: DEFAULT_DRAWER_WIDTH
|
|
394
|
-
},
|
|
395
|
-
content: {
|
|
396
|
-
flex: 1
|
|
397
|
-
},
|
|
398
|
-
main: {
|
|
399
|
-
flex: 1,
|
|
400
|
-
...Platform.select({
|
|
401
|
-
// FIXME: We need to hide `overflowX` on Web so the translated content doesn't show offscreen.
|
|
402
|
-
// But adding `overflowX: 'hidden'` prevents content from collapsing the URL bar.
|
|
403
|
-
web: null,
|
|
404
|
-
default: {
|
|
405
|
-
overflow: 'hidden'
|
|
406
|
-
}
|
|
407
|
-
})
|
|
408
|
-
}
|
|
409
|
-
});
|
|
410
|
-
//# sourceMappingURL=Drawer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","I18nManager","InteractionManager","Keyboard","Platform","StatusBar","StyleSheet","View","Animated","DrawerProgressContext","GestureState","PanGestureHandler","Overlay","Clock","Value","onChange","clockRunning","startClock","stopClock","spring","abs","add","and","block","call","cond","divide","eq","event","greaterThan","lessThan","max","min","multiply","neq","or","set","sub","TRUE","FALSE","NOOP","UNSET","DIRECTION_LEFT","DIRECTION_RIGHT","SWIPE_DISTANCE_MINIMUM","DEFAULT_DRAWER_WIDTH","SPRING_CONFIG","stiffness","damping","mass","overshootClamping","restDisplacementThreshold","restSpeedThreshold","ANIMATED_ZERO","ANIMATED_ONE","DrawerView","Component","interactionHandle","undefined","clearInteractionHandle","createInteractionHandle","drawerStyle","dimensions","props","width","flatten","endsWith","percentage","Number","replace","isFinite","drawerType","open","getDrawerWidth","UNDETERMINED","initialDrawerWidth","drawerPosition","isDrawerTypeFront","touchX","gestureX","drawerWidth","containerWidth","swipeDistanceThreshold","swipeVelocityThreshold","isOpen","toValue","frameTime","state","position","time","finished","velocity","clock","velocityX","handleStartInteraction","manuallyTriggerSpring","offsetX","value","Boolean","handleEndInteraction","toggleDrawer","currentOpenValue","onOpen","onClose","pendingOpenValue","forceUpdate","nextIsOpen","isSwiping","keyboardDismissMode","dismiss","toggleStatusBar","gestureState","ACTIVE","touchDistanceFromDrawer","transitionTo","dragX","translateX","nativeEvent","x","translationX","s","e","setValue","layout","requestAnimationFrame","drawerOpacity","hidden","hideStatusBarOnOpen","hideStatusBar","statusBarAnimation","isStatusBarHidden","setHidden","componentDidUpdate","prevProps","componentWillUnmount","render","swipeEnabled","swipeEdgeWidth","overlayStyle","renderDrawerContent","renderSceneContent","gestureHandlerProps","overlayAccessibilityLabel","isRight","contentTranslateX","drawerTranslateX","getConstants","isRTL","offset","hitSlop","right","left","progress","handleGestureEvent","handleGestureStateChange","handleContainerLayout","styles","main","flexDirection","content","transform","OS","handleDrawerLayout","container","opacity","nonPermanent","zIndex","create","backgroundColor","maxWidth","top","bottom","flex","select","web","default","overflow"],"sourceRoot":"../../src","sources":["Drawer.tsx"],"mappings":";;;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SACEC,WAAW,EACXC,kBAAkB,EAClBC,QAAQ,EAERC,QAAQ,EACRC,SAAS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C,CAAC,GAAG;MAAE,CAAC,CAC3C,EACLV,WAAW;IACX,GAED8E,mBAAmB,EAAE,CACR,CACF,CACE,CACW;EAErC;AACF;AAEA,MAAMiB,MAAM,GAAGtJ,UAAU,CAACiK,MAAM,CAAC;EAC/BJ,SAAS,EAAE;IACTK,eAAe,EAAE,OAAO;IACxBC,QAAQ,EAAE;EACZ,CAAC;EACDJ,YAAY,EAAE;IACZ7E,QAAQ,EAAE,UAAU;IACpBkF,GAAG,EAAE,CAAC;IACNC,MAAM,EAAE,CAAC;IACT3G,KAAK,EAAEnB;EACT,CAAC;EACDkH,OAAO,EAAE;IACPa,IAAI,EAAE;EACR,CAAC;EACDf,IAAI,EAAE;IACJe,IAAI,EAAE,CAAC;IACP,GAAGxK,QAAQ,CAACyK,MAAM,CAAC;MACjB;MACA;MACAC,GAAG,EAAE,IAAI;MACTC,OAAO,EAAE;QAAEC,QAAQ,EAAE;MAAS;IAChC,CAAC;EACH;AACF,CAAC,CAAC"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { Platform, Pressable, StyleSheet } from 'react-native';
|
|
4
|
-
import Animated from 'react-native-reanimated';
|
|
5
|
-
const {
|
|
6
|
-
// @ts-expect-error: this is to support reanimated 1
|
|
7
|
-
interpolate: interpolateDeprecated,
|
|
8
|
-
interpolateNode,
|
|
9
|
-
cond,
|
|
10
|
-
greaterThan
|
|
11
|
-
} = Animated;
|
|
12
|
-
const interpolate = interpolateNode ?? interpolateDeprecated;
|
|
13
|
-
const PROGRESS_EPSILON = 0.05;
|
|
14
|
-
const Overlay = /*#__PURE__*/React.forwardRef(function Overlay(_ref, ref) {
|
|
15
|
-
let {
|
|
16
|
-
progress,
|
|
17
|
-
onPress,
|
|
18
|
-
style,
|
|
19
|
-
accessibilityLabel = 'Close drawer',
|
|
20
|
-
...props
|
|
21
|
-
} = _ref;
|
|
22
|
-
const animatedStyle = {
|
|
23
|
-
opacity: interpolate(progress, {
|
|
24
|
-
// Default input range is [PROGRESS_EPSILON, 1]
|
|
25
|
-
// On Windows, the output value is 1 when input value is out of range for some reason
|
|
26
|
-
// The default value 0 will be interpolated to 1 in this case, which is not what we want.
|
|
27
|
-
// Therefore changing input range on Windows to [0,1] instead.
|
|
28
|
-
inputRange: Platform.OS === 'windows' || Platform.OS === 'macos' ? [0, 1] : [PROGRESS_EPSILON, 1],
|
|
29
|
-
outputRange: [0, 1]
|
|
30
|
-
}),
|
|
31
|
-
// We don't want the user to be able to press through the overlay when drawer is open
|
|
32
|
-
// One approach is to adjust the pointerEvents based on the progress
|
|
33
|
-
// But we can also send the overlay behind the screen, which works, and is much less code
|
|
34
|
-
zIndex: cond(greaterThan(progress, PROGRESS_EPSILON), 0, -1)
|
|
35
|
-
};
|
|
36
|
-
return /*#__PURE__*/React.createElement(Animated.View, _extends({}, props, {
|
|
37
|
-
ref: ref,
|
|
38
|
-
style: [styles.overlay, overlayStyle, animatedStyle, style]
|
|
39
|
-
}), /*#__PURE__*/React.createElement(Pressable, {
|
|
40
|
-
onPress: onPress,
|
|
41
|
-
style: styles.pressable,
|
|
42
|
-
accessibilityRole: "button",
|
|
43
|
-
accessibilityLabel: accessibilityLabel
|
|
44
|
-
}));
|
|
45
|
-
});
|
|
46
|
-
const overlayStyle = Platform.select({
|
|
47
|
-
web: {
|
|
48
|
-
// Disable touch highlight on mobile Safari.
|
|
49
|
-
// WebkitTapHighlightColor must be used outside of StyleSheet.create because react-native-web will omit the property.
|
|
50
|
-
WebkitTapHighlightColor: 'transparent'
|
|
51
|
-
},
|
|
52
|
-
default: {}
|
|
53
|
-
});
|
|
54
|
-
const styles = StyleSheet.create({
|
|
55
|
-
overlay: {
|
|
56
|
-
...StyleSheet.absoluteFillObject,
|
|
57
|
-
backgroundColor: 'rgba(0, 0, 0, 0.5)'
|
|
58
|
-
},
|
|
59
|
-
pressable: {
|
|
60
|
-
flex: 1
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
export default Overlay;
|
|
64
|
-
//# sourceMappingURL=Overlay.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","Platform","Pressable","StyleSheet","Animated","interpolate","interpolateDeprecated","interpolateNode","cond","greaterThan","PROGRESS_EPSILON","Overlay","forwardRef","ref","progress","onPress","style","accessibilityLabel","props","animatedStyle","opacity","inputRange","OS","outputRange","zIndex","styles","overlay","overlayStyle","pressable","select","web","WebkitTapHighlightColor","default","create","absoluteFillObject","backgroundColor","flex"],"sourceRoot":"../../src","sources":["Overlay.tsx"],"mappings":";AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,EAAEC,SAAS,EAAEC,UAAU,QAAQ,cAAc;AAC9D,OAAOC,QAAQ,MAAM,yBAAyB;AAE9C,MAAM;EACJ;EACAC,WAAW,EAAEC,qBAAqB;EAClCC,eAAe;EACfC,IAAI;EACJC;AACF,CAAC,GAAGL,QAAQ;AAEZ,MAAMC,WAAmC,GACvCE,eAAe,IAAID,qBAAqB;AAE1C,MAAMI,gBAAgB,GAAG,IAAI;AAQ7B,MAAMC,OAAO,gBAAGX,KAAK,CAACY,UAAU,CAAC,SAASD,OAAO,OAQ/CE,GAA6B,EAC7B;EAAA,IARA;IACEC,QAAQ;IACRC,OAAO;IACPC,KAAK;IACLC,kBAAkB,GAAG,cAAc;IACnC,GAAGC;EACE,CAAC;EAGR,MAAMC,aAAa,GAAG;IACpBC,OAAO,EAAEf,WAAW,CAACS,QAAQ,EAAE;MAC7B;MACA;MACA;MACA;MACAO,UAAU,EACRpB,QAAQ,CAACqB,EAAE,KAAK,SAAS,IAAIrB,QAAQ,CAACqB,EAAE,KAAK,OAAO,GAChD,CAAC,CAAC,E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