@react-navigation/drawer 8.0.0-alpha.55 → 8.0.0-alpha.56
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/typescript/src/types.d.ts +25 -54
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/views/DrawerContentScrollView.d.ts +1 -1
- package/lib/typescript/src/views/DrawerContentScrollView.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/types.tsx +30 -54
- package/src/views/DrawerContentScrollView.tsx +1 -1
|
@@ -1,43 +1,34 @@
|
|
|
1
1
|
import type { HeaderOptions, Icon } from '@react-navigation/elements';
|
|
2
2
|
import type { Screen } from '@react-navigation/elements/internal';
|
|
3
|
-
import type { DefaultNavigatorOptions, Descriptor, DrawerActionHelpers, DrawerNavigationState, DrawerRouterOptions, NavigationHelpers, NavigationProp, ParamListBase,
|
|
3
|
+
import type { DefaultNavigatorOptions, Descriptor, DrawerActionHelpers, DrawerNavigationState, DrawerRouterOptions, NavigationHelpers, NavigationProp, ParamListBase, RouteProp, Theme } from '@react-navigation/native';
|
|
4
4
|
import type { ColorValue, StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
5
5
|
import type { PanGestureConfig } from 'react-native-gesture-handler';
|
|
6
|
-
export type Scene = {
|
|
7
|
-
route: Route<string>;
|
|
8
|
-
focused: boolean;
|
|
9
|
-
color?: ColorValue;
|
|
10
|
-
};
|
|
11
|
-
export type Layout = {
|
|
12
|
-
width: number;
|
|
13
|
-
height: number;
|
|
14
|
-
};
|
|
15
6
|
export type DrawerNavigationConfig = {
|
|
16
7
|
/**
|
|
17
8
|
* Function that returns React element to render as the content of the drawer, for example, navigation items.
|
|
18
9
|
* Defaults to `DrawerContent`.
|
|
19
10
|
*/
|
|
20
|
-
drawerContent?: (props: DrawerContentComponentProps) => React.ReactNode;
|
|
11
|
+
drawerContent?: ((props: DrawerContentComponentProps) => React.ReactNode) | undefined;
|
|
21
12
|
};
|
|
22
13
|
export type DrawerNavigationOptions = HeaderOptions & {
|
|
23
14
|
/**
|
|
24
15
|
* Title text for the screen.
|
|
25
16
|
*/
|
|
26
|
-
title?: string;
|
|
17
|
+
title?: string | undefined;
|
|
27
18
|
/**
|
|
28
19
|
* Whether this screens should render the first time it's accessed. Defaults to `true`.
|
|
29
20
|
* Set it to `false` if you want to render the screen on initial render.
|
|
30
21
|
*/
|
|
31
|
-
lazy?: boolean;
|
|
22
|
+
lazy?: boolean | undefined;
|
|
32
23
|
/**
|
|
33
24
|
* Function that returns a React Element to display as a header.
|
|
34
25
|
*/
|
|
35
|
-
header?: (props: DrawerHeaderProps) => React.ReactNode;
|
|
26
|
+
header?: ((props: DrawerHeaderProps) => React.ReactNode) | undefined;
|
|
36
27
|
/**
|
|
37
28
|
* Whether to show the header. Setting this to `false` hides the header.
|
|
38
29
|
* Defaults to `true`.
|
|
39
30
|
*/
|
|
40
|
-
headerShown?: boolean;
|
|
31
|
+
headerShown?: boolean | undefined;
|
|
41
32
|
/**
|
|
42
33
|
* Title string of a screen displayed in the drawer
|
|
43
34
|
* or a function that given { focused: boolean, color: ColorValue } returns a React.Node
|
|
@@ -46,7 +37,7 @@ export type DrawerNavigationOptions = HeaderOptions & {
|
|
|
46
37
|
drawerLabel?: string | ((props: {
|
|
47
38
|
color: ColorValue;
|
|
48
39
|
focused: boolean;
|
|
49
|
-
}) => React.ReactNode);
|
|
40
|
+
}) => React.ReactNode) | undefined;
|
|
50
41
|
/**
|
|
51
42
|
* Icon to display for the drawer item.
|
|
52
43
|
*/
|
|
@@ -54,27 +45,27 @@ export type DrawerNavigationOptions = HeaderOptions & {
|
|
|
54
45
|
color: ColorValue;
|
|
55
46
|
size: number;
|
|
56
47
|
focused: boolean;
|
|
57
|
-
}) => Icon | React.ReactNode);
|
|
48
|
+
}) => Icon | React.ReactNode) | undefined;
|
|
58
49
|
/**
|
|
59
50
|
* Color for the icon and label in the active item in the drawer.
|
|
60
51
|
*/
|
|
61
|
-
drawerActiveTintColor?: ColorValue;
|
|
52
|
+
drawerActiveTintColor?: ColorValue | undefined;
|
|
62
53
|
/**
|
|
63
54
|
* Background color for the active item in the drawer.
|
|
64
55
|
*/
|
|
65
|
-
drawerActiveBackgroundColor?: ColorValue;
|
|
56
|
+
drawerActiveBackgroundColor?: ColorValue | undefined;
|
|
66
57
|
/**
|
|
67
58
|
* Color for the icon and label in the inactive items in the drawer.
|
|
68
59
|
*/
|
|
69
|
-
drawerInactiveTintColor?: ColorValue;
|
|
60
|
+
drawerInactiveTintColor?: ColorValue | undefined;
|
|
70
61
|
/**
|
|
71
62
|
* Background color for the inactive items in the drawer.
|
|
72
63
|
*/
|
|
73
|
-
drawerInactiveBackgroundColor?: ColorValue;
|
|
64
|
+
drawerInactiveBackgroundColor?: ColorValue | undefined;
|
|
74
65
|
/**
|
|
75
66
|
* Whether label font should scale to respect Text Size accessibility settings.
|
|
76
67
|
*/
|
|
77
|
-
drawerAllowFontScaling?: boolean;
|
|
68
|
+
drawerAllowFontScaling?: boolean | undefined;
|
|
78
69
|
/**
|
|
79
70
|
* Style object for the single item, which can contain an icon and/or a label.
|
|
80
71
|
*/
|
|
@@ -82,7 +73,7 @@ export type DrawerNavigationOptions = HeaderOptions & {
|
|
|
82
73
|
/**
|
|
83
74
|
* ID to locate this drawer item in tests.
|
|
84
75
|
*/
|
|
85
|
-
drawerItemTestID?: string;
|
|
76
|
+
drawerItemTestID?: string | undefined;
|
|
86
77
|
/**
|
|
87
78
|
* Style object to apply to the `Text` inside content section which renders a label.
|
|
88
79
|
*/
|
|
@@ -103,7 +94,7 @@ export type DrawerNavigationOptions = HeaderOptions & {
|
|
|
103
94
|
/**
|
|
104
95
|
* Position of the drawer on the screen. Defaults to `left`.
|
|
105
96
|
*/
|
|
106
|
-
drawerPosition?: 'left' | 'right';
|
|
97
|
+
drawerPosition?: 'left' | 'right' | undefined;
|
|
107
98
|
/**
|
|
108
99
|
* Type of the drawer. It determines how the drawer looks and animates.
|
|
109
100
|
* - `front`: Traditional drawer which covers the screen with a overlay behind it.
|
|
@@ -117,11 +108,11 @@ export type DrawerNavigationOptions = HeaderOptions & {
|
|
|
117
108
|
/**
|
|
118
109
|
* Whether the statusbar should be hidden when the drawer is pulled or opens,
|
|
119
110
|
*/
|
|
120
|
-
drawerHideStatusBarOnOpen?: boolean;
|
|
111
|
+
drawerHideStatusBarOnOpen?: boolean | undefined;
|
|
121
112
|
/**
|
|
122
113
|
* Animation of the statusbar when hiding it. use in combination with `drawerHideStatusBarOnOpen`.
|
|
123
114
|
*/
|
|
124
|
-
drawerStatusBarAnimation?: 'slide' | 'none' | 'fade';
|
|
115
|
+
drawerStatusBarAnimation?: 'slide' | 'none' | 'fade' | undefined;
|
|
125
116
|
/**
|
|
126
117
|
* Color of the overlay to be displayed on top of the content view when drawer gets open.
|
|
127
118
|
* The opacity is animated from `0` to `1` when the drawer opens.
|
|
@@ -131,7 +122,7 @@ export type DrawerNavigationOptions = HeaderOptions & {
|
|
|
131
122
|
* Accessibility label for the overlay. This is read by the screen reader when the user taps the overlay.
|
|
132
123
|
* Defaults to "Close drawer".
|
|
133
124
|
*/
|
|
134
|
-
overlayAccessibilityLabel?: string;
|
|
125
|
+
overlayAccessibilityLabel?: string | undefined;
|
|
135
126
|
/**
|
|
136
127
|
* Style object for the component wrapping the screen content.
|
|
137
128
|
*/
|
|
@@ -139,32 +130,32 @@ export type DrawerNavigationOptions = HeaderOptions & {
|
|
|
139
130
|
/**
|
|
140
131
|
* Function to modify the pan gesture config.
|
|
141
132
|
*/
|
|
142
|
-
configureGestureHandler?: (gesture: PanGestureConfig) => PanGestureConfig;
|
|
133
|
+
configureGestureHandler?: ((gesture: PanGestureConfig) => PanGestureConfig) | undefined;
|
|
143
134
|
/**
|
|
144
135
|
* Whether you can use swipe gestures to open or close the drawer.
|
|
145
136
|
* Defaults to `true`.
|
|
146
137
|
* Not supported on Web.
|
|
147
138
|
*/
|
|
148
|
-
swipeEnabled?: boolean;
|
|
139
|
+
swipeEnabled?: boolean | undefined;
|
|
149
140
|
/**
|
|
150
141
|
* How far from the edge of the screen the swipe gesture should activate.
|
|
151
142
|
* Not supported on Web.
|
|
152
143
|
*/
|
|
153
|
-
swipeEdgeWidth?: number;
|
|
144
|
+
swipeEdgeWidth?: number | undefined;
|
|
154
145
|
/**
|
|
155
146
|
* Minimum swipe distance threshold that should activate opening the drawer.
|
|
156
147
|
*/
|
|
157
|
-
swipeMinDistance?: number;
|
|
148
|
+
swipeMinDistance?: number | undefined;
|
|
158
149
|
/**
|
|
159
150
|
* Whether the keyboard should be dismissed when the swipe gesture begins.
|
|
160
151
|
* Defaults to `'on-drag'`. Set to `'none'` to disable keyboard handling.
|
|
161
152
|
*/
|
|
162
|
-
keyboardDismissMode?: 'on-drag' | 'none';
|
|
153
|
+
keyboardDismissMode?: 'on-drag' | 'none' | undefined;
|
|
163
154
|
/**
|
|
164
155
|
* Whether any nested stack should be popped to top when navigating away from the tab.
|
|
165
156
|
* Defaults to `false`.
|
|
166
157
|
*/
|
|
167
|
-
popToTopOnBlur?: boolean;
|
|
158
|
+
popToTopOnBlur?: boolean | undefined;
|
|
168
159
|
/**
|
|
169
160
|
* What should happen when screens become inactive.
|
|
170
161
|
* - `pause`: Effects are cleaned up.
|
|
@@ -176,7 +167,7 @@ export type DrawerNavigationOptions = HeaderOptions & {
|
|
|
176
167
|
* It won't be paused until after the first time it becomes focused.
|
|
177
168
|
* This makes sure that effects are run to initialize the screen.
|
|
178
169
|
*/
|
|
179
|
-
inactiveBehavior?: 'pause' | 'none';
|
|
170
|
+
inactiveBehavior?: 'pause' | 'none' | undefined;
|
|
180
171
|
};
|
|
181
172
|
export type DrawerContentComponentProps = {
|
|
182
173
|
state: DrawerNavigationState<ParamListBase>;
|
|
@@ -251,25 +242,5 @@ export type DrawerOptionsArgs<ParamList extends ParamListBase, RouteName extends
|
|
|
251
242
|
};
|
|
252
243
|
export type DrawerDescriptor = Descriptor<DrawerNavigationOptions, DrawerNavigationProp<ParamListBase>, RouteProp<ParamListBase>>;
|
|
253
244
|
export type DrawerDescriptorMap = Record<string, DrawerDescriptor>;
|
|
254
|
-
export type DrawerProps = {
|
|
255
|
-
drawerPosition: 'left' | 'right';
|
|
256
|
-
drawerStyle?: StyleProp<ViewStyle>;
|
|
257
|
-
drawerType: 'front' | 'back' | 'slide' | 'permanent';
|
|
258
|
-
configureGestureHandler?: (gesture: PanGestureConfig) => PanGestureConfig;
|
|
259
|
-
hideStatusBarOnOpen: boolean;
|
|
260
|
-
keyboardDismissMode: 'none' | 'on-drag';
|
|
261
|
-
onClose: () => void;
|
|
262
|
-
onOpen: () => void;
|
|
263
|
-
open: boolean;
|
|
264
|
-
overlayStyle?: StyleProp<ViewStyle>;
|
|
265
|
-
renderDrawerContent: () => React.ReactNode;
|
|
266
|
-
renderSceneContent: () => React.ReactNode;
|
|
267
|
-
statusBarAnimation: 'slide' | 'none' | 'fade';
|
|
268
|
-
swipeDistanceThreshold: number;
|
|
269
|
-
swipeEdgeWidth: number;
|
|
270
|
-
swipeEnabled: boolean;
|
|
271
|
-
swipeVelocityThreshold: number;
|
|
272
|
-
overlayAccessibilityLabel?: string;
|
|
273
|
-
};
|
|
274
245
|
export type DrawerNavigatorProps = DefaultNavigatorOptions<ParamListBase, DrawerNavigationState<ParamListBase>, DrawerNavigationOptions, DrawerNavigationEventMap, DrawerNavigationProp<ParamListBase>> & DrawerRouterOptions & DrawerNavigationConfig;
|
|
275
246
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,KAAK,EACV,uBAAuB,EACvB,UAAU,EACV,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,iBA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AAS,SAAS,MAAM,SAAS,GAAG,MAAM,SAAS,IACjD,iBAAiB,CAAC,SAAS,EAAE,SAAS,CAAC,GAAG;IAC5C,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,UAAU,CACvC,uBAAuB,EACvB,oBAAoB,CAAC,aAAa,CAAC,EACnC,SAAS,CAAC,aAAa,CAAC,CACzB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AAEnE,MAAM,MAAM,oBAAoB,GAAG,uBAAuB,CACxD,aAAa,EACb,qBAAqB,CAAC,aAAa,CAAC,EACpC,uBAAuB,EACvB,wBAAwB,EACxB,oBAAoB,CAAC,aAAa,CAAC,CACpC,GACC,mBAAmB,GACnB,sBAAsB,CAAC"}
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { ScrollView, type ScrollViewProps } from 'react-native';
|
|
3
3
|
type Props = ScrollViewProps & {
|
|
4
4
|
children: React.ReactNode;
|
|
5
|
-
ref?: React.Ref<React.ComponentRef<typeof ScrollView
|
|
5
|
+
ref?: React.Ref<React.ComponentRef<typeof ScrollView>> | undefined;
|
|
6
6
|
};
|
|
7
7
|
export declare function DrawerContentScrollView({ contentInsetAdjustmentBehavior, contentContainerStyle, style, children, ref, ...rest }: Props): React.JSX.Element;
|
|
8
8
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DrawerContentScrollView.d.ts","sourceRoot":"","sources":["../../../../src/views/DrawerContentScrollView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAEL,UAAU,EACV,KAAK,eAAe,EAErB,MAAM,cAAc,CAAC;AAKtB,KAAK,KAAK,GAAG,eAAe,GAAG;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"DrawerContentScrollView.d.ts","sourceRoot":"","sources":["../../../../src/views/DrawerContentScrollView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAEL,UAAU,EACV,KAAK,eAAe,EAErB,MAAM,cAAc,CAAC;AAKtB,KAAK,KAAK,GAAG,eAAe,GAAG;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,UAAU,CAAC,CAAC,GAAG,SAAS,CAAC;CACpE,CAAC;AAIF,wBAAgB,uBAAuB,CAAC,EACtC,8BAA4C,EAC5C,qBAAqB,EACrB,KAAK,EACL,QAAQ,EACR,GAAG,EACH,GAAG,IAAI,EACR,EAAE,KAAK,qBAsCP"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-navigation/drawer",
|
|
3
3
|
"description": "Integration for the drawer component from react-native-drawer-layout",
|
|
4
|
-
"version": "8.0.0-alpha.
|
|
4
|
+
"version": "8.0.0-alpha.56",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native-component",
|
|
7
7
|
"react-component",
|
|
@@ -46,13 +46,13 @@
|
|
|
46
46
|
"clean": "del lib"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@react-navigation/elements": "^3.0.0-alpha.
|
|
49
|
+
"@react-navigation/elements": "^3.0.0-alpha.53",
|
|
50
50
|
"react-native-drawer-layout": "^5.0.0-alpha.19",
|
|
51
51
|
"use-latest-callback": "^0.3.5"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@jest/globals": "^30.4.1",
|
|
55
|
-
"@react-navigation/native": "^8.0.0-alpha.
|
|
55
|
+
"@react-navigation/native": "^8.0.0-alpha.49",
|
|
56
56
|
"@testing-library/react-native": "^14.0.0",
|
|
57
57
|
"@types/react": "~19.2.17",
|
|
58
58
|
"del-cli": "^7.0.0",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"typescript": "^6.0.3"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"@react-navigation/native": "^8.0.0-alpha.
|
|
71
|
+
"@react-navigation/native": "^8.0.0-alpha.49",
|
|
72
72
|
"react": ">= 19.2.0",
|
|
73
73
|
"react-native": "*",
|
|
74
74
|
"react-native-gesture-handler": ">= 3.0.0",
|
|
@@ -95,5 +95,5 @@
|
|
|
95
95
|
]
|
|
96
96
|
]
|
|
97
97
|
},
|
|
98
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "110f8e897f476977b7227e5f0326996106a742f0"
|
|
99
99
|
}
|
package/src/types.tsx
CHANGED
|
@@ -9,51 +9,44 @@ import type {
|
|
|
9
9
|
NavigationHelpers,
|
|
10
10
|
NavigationProp,
|
|
11
11
|
ParamListBase,
|
|
12
|
-
Route,
|
|
13
12
|
RouteProp,
|
|
14
13
|
Theme,
|
|
15
14
|
} from '@react-navigation/native';
|
|
16
15
|
import type { ColorValue, StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
17
16
|
import type { PanGestureConfig } from 'react-native-gesture-handler';
|
|
18
17
|
|
|
19
|
-
export type Scene = {
|
|
20
|
-
route: Route<string>;
|
|
21
|
-
focused: boolean;
|
|
22
|
-
color?: ColorValue;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export type Layout = { width: number; height: number };
|
|
26
|
-
|
|
27
18
|
export type DrawerNavigationConfig = {
|
|
28
19
|
/**
|
|
29
20
|
* Function that returns React element to render as the content of the drawer, for example, navigation items.
|
|
30
21
|
* Defaults to `DrawerContent`.
|
|
31
22
|
*/
|
|
32
|
-
drawerContent?:
|
|
23
|
+
drawerContent?:
|
|
24
|
+
| ((props: DrawerContentComponentProps) => React.ReactNode)
|
|
25
|
+
| undefined;
|
|
33
26
|
};
|
|
34
27
|
|
|
35
28
|
export type DrawerNavigationOptions = HeaderOptions & {
|
|
36
29
|
/**
|
|
37
30
|
* Title text for the screen.
|
|
38
31
|
*/
|
|
39
|
-
title?: string;
|
|
32
|
+
title?: string | undefined;
|
|
40
33
|
|
|
41
34
|
/**
|
|
42
35
|
* Whether this screens should render the first time it's accessed. Defaults to `true`.
|
|
43
36
|
* Set it to `false` if you want to render the screen on initial render.
|
|
44
37
|
*/
|
|
45
|
-
lazy?: boolean;
|
|
38
|
+
lazy?: boolean | undefined;
|
|
46
39
|
|
|
47
40
|
/**
|
|
48
41
|
* Function that returns a React Element to display as a header.
|
|
49
42
|
*/
|
|
50
|
-
header?: (props: DrawerHeaderProps) => React.ReactNode;
|
|
43
|
+
header?: ((props: DrawerHeaderProps) => React.ReactNode) | undefined;
|
|
51
44
|
|
|
52
45
|
/**
|
|
53
46
|
* Whether to show the header. Setting this to `false` hides the header.
|
|
54
47
|
* Defaults to `true`.
|
|
55
48
|
*/
|
|
56
|
-
headerShown?: boolean;
|
|
49
|
+
headerShown?: boolean | undefined;
|
|
57
50
|
|
|
58
51
|
/**
|
|
59
52
|
* Title string of a screen displayed in the drawer
|
|
@@ -62,7 +55,8 @@ export type DrawerNavigationOptions = HeaderOptions & {
|
|
|
62
55
|
*/
|
|
63
56
|
drawerLabel?:
|
|
64
57
|
| string
|
|
65
|
-
| ((props: { color: ColorValue; focused: boolean }) => React.ReactNode)
|
|
58
|
+
| ((props: { color: ColorValue; focused: boolean }) => React.ReactNode)
|
|
59
|
+
| undefined;
|
|
66
60
|
|
|
67
61
|
/**
|
|
68
62
|
* Icon to display for the drawer item.
|
|
@@ -73,32 +67,33 @@ export type DrawerNavigationOptions = HeaderOptions & {
|
|
|
73
67
|
color: ColorValue;
|
|
74
68
|
size: number;
|
|
75
69
|
focused: boolean;
|
|
76
|
-
}) => Icon | React.ReactNode)
|
|
70
|
+
}) => Icon | React.ReactNode)
|
|
71
|
+
| undefined;
|
|
77
72
|
|
|
78
73
|
/**
|
|
79
74
|
* Color for the icon and label in the active item in the drawer.
|
|
80
75
|
*/
|
|
81
|
-
drawerActiveTintColor?: ColorValue;
|
|
76
|
+
drawerActiveTintColor?: ColorValue | undefined;
|
|
82
77
|
|
|
83
78
|
/**
|
|
84
79
|
* Background color for the active item in the drawer.
|
|
85
80
|
*/
|
|
86
|
-
drawerActiveBackgroundColor?: ColorValue;
|
|
81
|
+
drawerActiveBackgroundColor?: ColorValue | undefined;
|
|
87
82
|
|
|
88
83
|
/**
|
|
89
84
|
* Color for the icon and label in the inactive items in the drawer.
|
|
90
85
|
*/
|
|
91
|
-
drawerInactiveTintColor?: ColorValue;
|
|
86
|
+
drawerInactiveTintColor?: ColorValue | undefined;
|
|
92
87
|
|
|
93
88
|
/**
|
|
94
89
|
* Background color for the inactive items in the drawer.
|
|
95
90
|
*/
|
|
96
|
-
drawerInactiveBackgroundColor?: ColorValue;
|
|
91
|
+
drawerInactiveBackgroundColor?: ColorValue | undefined;
|
|
97
92
|
|
|
98
93
|
/**
|
|
99
94
|
* Whether label font should scale to respect Text Size accessibility settings.
|
|
100
95
|
*/
|
|
101
|
-
drawerAllowFontScaling?: boolean;
|
|
96
|
+
drawerAllowFontScaling?: boolean | undefined;
|
|
102
97
|
|
|
103
98
|
/**
|
|
104
99
|
* Style object for the single item, which can contain an icon and/or a label.
|
|
@@ -108,7 +103,7 @@ export type DrawerNavigationOptions = HeaderOptions & {
|
|
|
108
103
|
/**
|
|
109
104
|
* ID to locate this drawer item in tests.
|
|
110
105
|
*/
|
|
111
|
-
drawerItemTestID?: string;
|
|
106
|
+
drawerItemTestID?: string | undefined;
|
|
112
107
|
|
|
113
108
|
/**
|
|
114
109
|
* Style object to apply to the `Text` inside content section which renders a label.
|
|
@@ -134,7 +129,7 @@ export type DrawerNavigationOptions = HeaderOptions & {
|
|
|
134
129
|
/**
|
|
135
130
|
* Position of the drawer on the screen. Defaults to `left`.
|
|
136
131
|
*/
|
|
137
|
-
drawerPosition?: 'left' | 'right';
|
|
132
|
+
drawerPosition?: 'left' | 'right' | undefined;
|
|
138
133
|
|
|
139
134
|
/**
|
|
140
135
|
* Type of the drawer. It determines how the drawer looks and animates.
|
|
@@ -150,12 +145,12 @@ export type DrawerNavigationOptions = HeaderOptions & {
|
|
|
150
145
|
/**
|
|
151
146
|
* Whether the statusbar should be hidden when the drawer is pulled or opens,
|
|
152
147
|
*/
|
|
153
|
-
drawerHideStatusBarOnOpen?: boolean;
|
|
148
|
+
drawerHideStatusBarOnOpen?: boolean | undefined;
|
|
154
149
|
|
|
155
150
|
/**
|
|
156
151
|
* Animation of the statusbar when hiding it. use in combination with `drawerHideStatusBarOnOpen`.
|
|
157
152
|
*/
|
|
158
|
-
drawerStatusBarAnimation?: 'slide' | 'none' | 'fade';
|
|
153
|
+
drawerStatusBarAnimation?: 'slide' | 'none' | 'fade' | undefined;
|
|
159
154
|
|
|
160
155
|
/**
|
|
161
156
|
* Color of the overlay to be displayed on top of the content view when drawer gets open.
|
|
@@ -167,7 +162,7 @@ export type DrawerNavigationOptions = HeaderOptions & {
|
|
|
167
162
|
* Accessibility label for the overlay. This is read by the screen reader when the user taps the overlay.
|
|
168
163
|
* Defaults to "Close drawer".
|
|
169
164
|
*/
|
|
170
|
-
overlayAccessibilityLabel?: string;
|
|
165
|
+
overlayAccessibilityLabel?: string | undefined;
|
|
171
166
|
|
|
172
167
|
/**
|
|
173
168
|
* Style object for the component wrapping the screen content.
|
|
@@ -177,37 +172,39 @@ export type DrawerNavigationOptions = HeaderOptions & {
|
|
|
177
172
|
/**
|
|
178
173
|
* Function to modify the pan gesture config.
|
|
179
174
|
*/
|
|
180
|
-
configureGestureHandler?:
|
|
175
|
+
configureGestureHandler?:
|
|
176
|
+
| ((gesture: PanGestureConfig) => PanGestureConfig)
|
|
177
|
+
| undefined;
|
|
181
178
|
|
|
182
179
|
/**
|
|
183
180
|
* Whether you can use swipe gestures to open or close the drawer.
|
|
184
181
|
* Defaults to `true`.
|
|
185
182
|
* Not supported on Web.
|
|
186
183
|
*/
|
|
187
|
-
swipeEnabled?: boolean;
|
|
184
|
+
swipeEnabled?: boolean | undefined;
|
|
188
185
|
|
|
189
186
|
/**
|
|
190
187
|
* How far from the edge of the screen the swipe gesture should activate.
|
|
191
188
|
* Not supported on Web.
|
|
192
189
|
*/
|
|
193
|
-
swipeEdgeWidth?: number;
|
|
190
|
+
swipeEdgeWidth?: number | undefined;
|
|
194
191
|
|
|
195
192
|
/**
|
|
196
193
|
* Minimum swipe distance threshold that should activate opening the drawer.
|
|
197
194
|
*/
|
|
198
|
-
swipeMinDistance?: number;
|
|
195
|
+
swipeMinDistance?: number | undefined;
|
|
199
196
|
|
|
200
197
|
/**
|
|
201
198
|
* Whether the keyboard should be dismissed when the swipe gesture begins.
|
|
202
199
|
* Defaults to `'on-drag'`. Set to `'none'` to disable keyboard handling.
|
|
203
200
|
*/
|
|
204
|
-
keyboardDismissMode?: 'on-drag' | 'none';
|
|
201
|
+
keyboardDismissMode?: 'on-drag' | 'none' | undefined;
|
|
205
202
|
|
|
206
203
|
/**
|
|
207
204
|
* Whether any nested stack should be popped to top when navigating away from the tab.
|
|
208
205
|
* Defaults to `false`.
|
|
209
206
|
*/
|
|
210
|
-
popToTopOnBlur?: boolean;
|
|
207
|
+
popToTopOnBlur?: boolean | undefined;
|
|
211
208
|
|
|
212
209
|
/**
|
|
213
210
|
* What should happen when screens become inactive.
|
|
@@ -220,7 +217,7 @@ export type DrawerNavigationOptions = HeaderOptions & {
|
|
|
220
217
|
* It won't be paused until after the first time it becomes focused.
|
|
221
218
|
* This makes sure that effects are run to initialize the screen.
|
|
222
219
|
*/
|
|
223
|
-
inactiveBehavior?: 'pause' | 'none';
|
|
220
|
+
inactiveBehavior?: 'pause' | 'none' | undefined;
|
|
224
221
|
};
|
|
225
222
|
|
|
226
223
|
export type DrawerContentComponentProps = {
|
|
@@ -313,27 +310,6 @@ export type DrawerDescriptor = Descriptor<
|
|
|
313
310
|
|
|
314
311
|
export type DrawerDescriptorMap = Record<string, DrawerDescriptor>;
|
|
315
312
|
|
|
316
|
-
export type DrawerProps = {
|
|
317
|
-
drawerPosition: 'left' | 'right';
|
|
318
|
-
drawerStyle?: StyleProp<ViewStyle>;
|
|
319
|
-
drawerType: 'front' | 'back' | 'slide' | 'permanent';
|
|
320
|
-
configureGestureHandler?: (gesture: PanGestureConfig) => PanGestureConfig;
|
|
321
|
-
hideStatusBarOnOpen: boolean;
|
|
322
|
-
keyboardDismissMode: 'none' | 'on-drag';
|
|
323
|
-
onClose: () => void;
|
|
324
|
-
onOpen: () => void;
|
|
325
|
-
open: boolean;
|
|
326
|
-
overlayStyle?: StyleProp<ViewStyle>;
|
|
327
|
-
renderDrawerContent: () => React.ReactNode;
|
|
328
|
-
renderSceneContent: () => React.ReactNode;
|
|
329
|
-
statusBarAnimation: 'slide' | 'none' | 'fade';
|
|
330
|
-
swipeDistanceThreshold: number;
|
|
331
|
-
swipeEdgeWidth: number;
|
|
332
|
-
swipeEnabled: boolean;
|
|
333
|
-
swipeVelocityThreshold: number;
|
|
334
|
-
overlayAccessibilityLabel?: string;
|
|
335
|
-
};
|
|
336
|
-
|
|
337
313
|
export type DrawerNavigatorProps = DefaultNavigatorOptions<
|
|
338
314
|
ParamListBase,
|
|
339
315
|
DrawerNavigationState<ParamListBase>,
|
|
@@ -12,7 +12,7 @@ import { DrawerPositionContext } from '../utils/DrawerPositionContext';
|
|
|
12
12
|
|
|
13
13
|
type Props = ScrollViewProps & {
|
|
14
14
|
children: React.ReactNode;
|
|
15
|
-
ref?: React.Ref<React.ComponentRef<typeof ScrollView
|
|
15
|
+
ref?: React.Ref<React.ComponentRef<typeof ScrollView>> | undefined;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
const SPACING = 12;
|