@react-navigation/drawer 6.4.3 → 6.5.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/views/DrawerContentScrollView.js +1 -1
- package/lib/commonjs/views/DrawerContentScrollView.js.map +1 -1
- package/lib/commonjs/views/DrawerView.js +17 -5
- package/lib/commonjs/views/DrawerView.js.map +1 -1
- package/lib/commonjs/views/GestureHandlerNative.js +0 -6
- package/lib/commonjs/views/GestureHandlerNative.js.map +1 -1
- package/lib/commonjs/views/ScreenFallback.js.map +1 -1
- package/lib/commonjs/views/legacy/Drawer.js +2 -2
- package/lib/commonjs/views/legacy/Drawer.js.map +1 -1
- package/lib/commonjs/views/modern/Drawer.js +4 -1
- package/lib/commonjs/views/modern/Drawer.js.map +1 -1
- package/lib/module/views/DrawerContentScrollView.js +1 -1
- package/lib/module/views/DrawerContentScrollView.js.map +1 -1
- package/lib/module/views/DrawerView.js +17 -5
- package/lib/module/views/DrawerView.js.map +1 -1
- package/lib/module/views/GestureHandlerNative.js +1 -1
- package/lib/module/views/GestureHandlerNative.js.map +1 -1
- package/lib/module/views/ScreenFallback.js.map +1 -1
- package/lib/module/views/legacy/Drawer.js +2 -2
- package/lib/module/views/legacy/Drawer.js.map +1 -1
- package/lib/module/views/modern/Drawer.js +2 -1
- package/lib/module/views/modern/Drawer.js.map +1 -1
- package/lib/typescript/src/types.d.ts +8 -0
- package/lib/typescript/src/views/GestureHandlerNative.d.ts +2 -1
- package/lib/typescript/src/views/ScreenFallback.d.ts +1 -0
- package/lib/typescript/src/views/legacy/Overlay.d.ts +1 -2
- package/lib/typescript/src/views/modern/Overlay.d.ts +1 -2
- package/package.json +14 -13
- package/src/types.tsx +9 -0
- package/src/views/DrawerContentScrollView.tsx +1 -1
- package/src/views/DrawerView.tsx +19 -4
- package/src/views/GestureHandlerNative.tsx +1 -1
- package/src/views/ScreenFallback.tsx +1 -0
- package/src/views/legacy/Drawer.tsx +2 -2
- package/src/views/modern/Drawer.tsx +3 -2
|
@@ -2,11 +2,10 @@ import * as React from 'react';
|
|
|
2
2
|
import Animated from 'react-native-reanimated';
|
|
3
3
|
declare const Overlay: React.ForwardRefExoticComponent<{
|
|
4
4
|
children?: React.ReactNode | Animated.Node<React.ReactNode>;
|
|
5
|
+
removeClippedSubviews?: boolean | Animated.Node<boolean | undefined> | undefined;
|
|
5
6
|
hitSlop?: import("react-native").Insets | Animated.Node<import("react-native").Insets | undefined> | undefined;
|
|
6
7
|
onLayout?: ((event: import("react-native").LayoutChangeEvent) => void) | Animated.Node<((event: import("react-native").LayoutChangeEvent) => void) | undefined> | undefined;
|
|
7
8
|
pointerEvents?: "none" | "auto" | "box-none" | "box-only" | Animated.Node<"none" | "auto" | "box-none" | "box-only" | undefined> | undefined;
|
|
8
|
-
removeClippedSubviews?: boolean | Animated.Node<boolean | undefined> | undefined;
|
|
9
|
-
style?: import("react-native").StyleProp<import("react-native").ViewStyle> | Animated.Node<import("react-native").StyleProp<import("react-native").ViewStyle>>;
|
|
10
9
|
testID?: string | Animated.Node<string | undefined> | undefined;
|
|
11
10
|
nativeID?: string | Animated.Node<string | undefined> | undefined;
|
|
12
11
|
collapsable?: boolean | Animated.Node<boolean | undefined> | undefined;
|
|
@@ -2,11 +2,10 @@ import * as React from 'react';
|
|
|
2
2
|
import Animated from 'react-native-reanimated';
|
|
3
3
|
declare const Overlay: React.ForwardRefExoticComponent<{
|
|
4
4
|
children?: React.ReactNode | Animated.Node<React.ReactNode>;
|
|
5
|
+
removeClippedSubviews?: boolean | Animated.Node<boolean | undefined> | undefined;
|
|
5
6
|
hitSlop?: import("react-native").Insets | Animated.Node<import("react-native").Insets | undefined> | undefined;
|
|
6
7
|
onLayout?: ((event: import("react-native").LayoutChangeEvent) => void) | Animated.Node<((event: import("react-native").LayoutChangeEvent) => void) | undefined> | undefined;
|
|
7
8
|
pointerEvents?: "none" | "auto" | "box-none" | "box-only" | Animated.Node<"none" | "auto" | "box-none" | "box-only" | undefined> | undefined;
|
|
8
|
-
removeClippedSubviews?: boolean | Animated.Node<boolean | undefined> | undefined;
|
|
9
|
-
style?: import("react-native").StyleProp<import("react-native").ViewStyle> | Animated.Node<import("react-native").StyleProp<import("react-native").ViewStyle>>;
|
|
10
9
|
testID?: string | Animated.Node<string | undefined> | undefined;
|
|
11
10
|
nativeID?: string | Animated.Node<string | undefined> | undefined;
|
|
12
11
|
collapsable?: boolean | Animated.Node<boolean | undefined> | undefined;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-navigation/drawer",
|
|
3
3
|
"description": "Drawer navigator component with animated transitions and gesturess",
|
|
4
|
-
"version": "6.
|
|
4
|
+
"version": "6.5.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native-component",
|
|
7
7
|
"react-component",
|
|
@@ -37,27 +37,27 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
|
-
"
|
|
40
|
+
"prepack": "bob build",
|
|
41
41
|
"clean": "del lib"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@react-navigation/elements": "^1.3.
|
|
44
|
+
"@react-navigation/elements": "^1.3.6",
|
|
45
45
|
"color": "^4.2.3",
|
|
46
46
|
"warn-once": "^0.1.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@react-navigation/native": "^6.0.
|
|
49
|
+
"@react-navigation/native": "^6.0.13",
|
|
50
50
|
"@testing-library/react-native": "^7.2.0",
|
|
51
|
-
"@types/react": "
|
|
52
|
-
"@types/react-native": "~0.
|
|
51
|
+
"@types/react": "~18.0.0",
|
|
52
|
+
"@types/react-native": "~0.69.1",
|
|
53
53
|
"del-cli": "^3.0.1",
|
|
54
|
-
"react": "
|
|
55
|
-
"react-native": "
|
|
54
|
+
"react": "18.0.0",
|
|
55
|
+
"react-native": "0.69.5",
|
|
56
56
|
"react-native-builder-bob": "^0.18.1",
|
|
57
|
-
"react-native-gesture-handler": "~2.
|
|
58
|
-
"react-native-reanimated": "~2.
|
|
59
|
-
"react-native-safe-area-context": "4.
|
|
60
|
-
"react-native-screens": "~3.
|
|
57
|
+
"react-native-gesture-handler": "~2.5.0",
|
|
58
|
+
"react-native-reanimated": "~2.9.1",
|
|
59
|
+
"react-native-safe-area-context": "4.3.1",
|
|
60
|
+
"react-native-screens": "~3.15.0",
|
|
61
61
|
"typescript": "^4.7.4"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
@@ -82,5 +82,6 @@
|
|
|
82
82
|
}
|
|
83
83
|
]
|
|
84
84
|
]
|
|
85
|
-
}
|
|
85
|
+
},
|
|
86
|
+
"gitHead": "fc4c3a63ab156e17db7ba0cbd32ada319f78714e"
|
|
86
87
|
}
|
package/src/types.tsx
CHANGED
|
@@ -211,6 +211,15 @@ export type DrawerNavigationOptions = HeaderOptions & {
|
|
|
211
211
|
* Defaults to `false`.
|
|
212
212
|
*/
|
|
213
213
|
unmountOnBlur?: boolean;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Whether inactive screens should be suspended from re-rendering. Defaults to `false`.
|
|
217
|
+
* Defaults to `true` when `enableFreeze()` is run at the top of the application.
|
|
218
|
+
* Requires `react-native-screens` version >=3.16.0.
|
|
219
|
+
*
|
|
220
|
+
* Only supported on iOS and Android.
|
|
221
|
+
*/
|
|
222
|
+
freezeOnBlur?: boolean;
|
|
214
223
|
};
|
|
215
224
|
|
|
216
225
|
export type DrawerContentComponentProps = {
|
|
@@ -20,7 +20,7 @@ function DrawerContentScrollView(
|
|
|
20
20
|
const drawerPosition = React.useContext(DrawerPositionContext);
|
|
21
21
|
const insets = useSafeAreaInsets();
|
|
22
22
|
|
|
23
|
-
const isRight = I18nManager.isRTL
|
|
23
|
+
const isRight = I18nManager.getConstants().isRTL
|
|
24
24
|
? drawerPosition === 'left'
|
|
25
25
|
: drawerPosition === 'right';
|
|
26
26
|
|
package/src/views/DrawerView.tsx
CHANGED
|
@@ -84,6 +84,16 @@ function DrawerViewBase({
|
|
|
84
84
|
// @ts-expect-error: the type definitions are incomplete
|
|
85
85
|
useLegacyImplementation = !Reanimated.isConfigured?.(),
|
|
86
86
|
}: Props) {
|
|
87
|
+
// Reanimated v3 dropped legacy v1 syntax
|
|
88
|
+
const legacyImplemenationNotAvailable =
|
|
89
|
+
require('react-native-reanimated').abs === undefined;
|
|
90
|
+
|
|
91
|
+
if (useLegacyImplementation && legacyImplemenationNotAvailable) {
|
|
92
|
+
throw new Error(
|
|
93
|
+
'The `useLegacyImplementation` prop is not available with Reanimated 3 as it no longer includes support for Reanimated 1 legacy API. Remove the `useLegacyImplementation` prop from `Drawer.Navigator` to be able to use it.'
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
87
97
|
const Drawer: React.ComponentType<DrawerProps> = useLegacyImplementation
|
|
88
98
|
? require('./legacy/Drawer').default
|
|
89
99
|
: require('./modern/Drawer').default;
|
|
@@ -91,7 +101,7 @@ function DrawerViewBase({
|
|
|
91
101
|
const focusedRouteKey = state.routes[state.index].key;
|
|
92
102
|
const {
|
|
93
103
|
drawerHideStatusBarOnOpen = false,
|
|
94
|
-
drawerPosition = I18nManager.isRTL ? 'right' : 'left',
|
|
104
|
+
drawerPosition = I18nManager.getConstants().isRTL ? 'right' : 'left',
|
|
95
105
|
drawerStatusBarAnimation = 'slide',
|
|
96
106
|
drawerStyle,
|
|
97
107
|
drawerType = Platform.select({ ios: 'slide', default: 'front' }),
|
|
@@ -220,6 +230,7 @@ function DrawerViewBase({
|
|
|
220
230
|
}
|
|
221
231
|
|
|
222
232
|
const {
|
|
233
|
+
freezeOnBlur,
|
|
223
234
|
header = ({ layout, options }: DrawerHeaderProps) => (
|
|
224
235
|
<Header
|
|
225
236
|
{...options}
|
|
@@ -231,6 +242,9 @@ function DrawerViewBase({
|
|
|
231
242
|
}
|
|
232
243
|
/>
|
|
233
244
|
),
|
|
245
|
+
headerShown,
|
|
246
|
+
headerStatusBarHeight,
|
|
247
|
+
headerTransparent,
|
|
234
248
|
sceneContainerStyle,
|
|
235
249
|
} = descriptor.options;
|
|
236
250
|
|
|
@@ -240,14 +254,15 @@ function DrawerViewBase({
|
|
|
240
254
|
style={[StyleSheet.absoluteFill, { zIndex: isFocused ? 0 : -1 }]}
|
|
241
255
|
visible={isFocused}
|
|
242
256
|
enabled={detachInactiveScreens}
|
|
257
|
+
freezeOnBlur={freezeOnBlur}
|
|
243
258
|
>
|
|
244
259
|
<Screen
|
|
245
260
|
focused={isFocused}
|
|
246
261
|
route={descriptor.route}
|
|
247
262
|
navigation={descriptor.navigation}
|
|
248
|
-
headerShown={
|
|
249
|
-
|
|
250
|
-
|
|
263
|
+
headerShown={headerShown}
|
|
264
|
+
headerStatusBarHeight={headerStatusBarHeight}
|
|
265
|
+
headerTransparent={headerTransparent}
|
|
251
266
|
header={header({
|
|
252
267
|
layout: dimensions,
|
|
253
268
|
route: descriptor.route,
|
|
@@ -16,9 +16,9 @@ export function PanGestureHandler(props: PanGestureHandlerProperties) {
|
|
|
16
16
|
);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
export type { PanGestureHandlerGestureEvent } from 'react-native-gesture-handler';
|
|
19
20
|
export {
|
|
20
21
|
GestureHandlerRootView,
|
|
21
22
|
State as GestureState,
|
|
22
|
-
PanGestureHandlerGestureEvent,
|
|
23
23
|
TapGestureHandler,
|
|
24
24
|
} from 'react-native-gesture-handler';
|
|
@@ -502,7 +502,7 @@ export default class DrawerView extends React.Component<DrawerProps> {
|
|
|
502
502
|
|
|
503
503
|
const drawerTranslateX =
|
|
504
504
|
drawerType === 'back'
|
|
505
|
-
? I18nManager.isRTL
|
|
505
|
+
? I18nManager.getConstants().isRTL
|
|
506
506
|
? multiply(
|
|
507
507
|
sub(this.containerWidth, this.drawerWidth),
|
|
508
508
|
isRight ? 1 : -1
|
|
@@ -513,7 +513,7 @@ export default class DrawerView extends React.Component<DrawerProps> {
|
|
|
513
513
|
const offset =
|
|
514
514
|
drawerType === 'back'
|
|
515
515
|
? 0
|
|
516
|
-
: I18nManager.isRTL
|
|
516
|
+
: I18nManager.getConstants().isRTL
|
|
517
517
|
? '100%'
|
|
518
518
|
: multiply(this.drawerWidth, -1);
|
|
519
519
|
|
|
@@ -258,6 +258,7 @@ export default function Drawer({
|
|
|
258
258
|
return translateX;
|
|
259
259
|
});
|
|
260
260
|
|
|
261
|
+
const isRTL = I18nManager.getConstants().isRTL;
|
|
261
262
|
const drawerAnimatedStyle = useAnimatedStyle(() => {
|
|
262
263
|
const distanceFromEdge = dimensions.width - drawerWidth;
|
|
263
264
|
|
|
@@ -273,10 +274,10 @@ export default function Drawer({
|
|
|
273
274
|
// The drawer stays in place when `drawerType` is `back`
|
|
274
275
|
(drawerType === 'back' ? 0 : translateX.value) +
|
|
275
276
|
(drawerPosition === 'left'
|
|
276
|
-
?
|
|
277
|
+
? isRTL
|
|
277
278
|
? -distanceFromEdge
|
|
278
279
|
: 0
|
|
279
|
-
:
|
|
280
|
+
: isRTL
|
|
280
281
|
? 0
|
|
281
282
|
: distanceFromEdge),
|
|
282
283
|
},
|