@react-navigation/native-stack 7.0.0-alpha.8 → 7.0.0-rc.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.map +1 -1
- package/lib/commonjs/navigators/createNativeStackNavigator.js +19 -16
- package/lib/commonjs/navigators/createNativeStackNavigator.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/utils/debounce.js +16 -0
- package/lib/commonjs/utils/debounce.js.map +1 -0
- package/lib/commonjs/utils/getModalRoutesKeys.js +17 -0
- package/lib/commonjs/utils/getModalRoutesKeys.js.map +1 -0
- package/lib/commonjs/utils/useAnimatedHeaderHeight.js +1 -1
- package/lib/commonjs/utils/useAnimatedHeaderHeight.js.map +1 -1
- package/lib/commonjs/utils/useDismissedRouteError.js +1 -1
- package/lib/commonjs/utils/useDismissedRouteError.js.map +1 -1
- package/lib/commonjs/utils/useInvalidPreventRemoveError.js +1 -1
- package/lib/commonjs/utils/useInvalidPreventRemoveError.js.map +1 -1
- package/lib/commonjs/views/DebugContainer.js +1 -1
- package/lib/commonjs/views/DebugContainer.js.map +1 -1
- package/lib/commonjs/views/DebugContainer.native.js +3 -3
- package/lib/commonjs/views/DebugContainer.native.js.map +1 -1
- package/lib/commonjs/views/FontProcessor.js.map +1 -1
- package/lib/commonjs/views/FontProcessor.native.js +1 -1
- package/lib/commonjs/views/FontProcessor.native.js.map +1 -1
- package/lib/commonjs/views/HeaderConfig.js +41 -39
- package/lib/commonjs/views/HeaderConfig.js.map +1 -1
- package/lib/commonjs/views/NativeStackView.js +47 -58
- package/lib/commonjs/views/NativeStackView.js.map +1 -1
- package/lib/commonjs/views/NativeStackView.native.js +145 -58
- package/lib/commonjs/views/NativeStackView.native.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/navigators/createNativeStackNavigator.js +17 -14
- package/lib/module/navigators/createNativeStackNavigator.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/debounce.js +10 -0
- package/lib/module/utils/debounce.js.map +1 -0
- package/lib/module/utils/getModalRoutesKeys.js +10 -0
- package/lib/module/utils/getModalRoutesKeys.js.map +1 -0
- package/lib/module/utils/useAnimatedHeaderHeight.js.map +1 -1
- package/lib/module/utils/useDismissedRouteError.js.map +1 -1
- package/lib/module/utils/useInvalidPreventRemoveError.js.map +1 -1
- package/lib/module/views/DebugContainer.js.map +1 -1
- package/lib/module/views/DebugContainer.native.js +1 -1
- package/lib/module/views/DebugContainer.native.js.map +1 -1
- package/lib/module/views/FontProcessor.js.map +1 -1
- package/lib/module/views/FontProcessor.native.js.map +1 -1
- package/lib/module/views/HeaderConfig.js +40 -38
- package/lib/module/views/HeaderConfig.js.map +1 -1
- package/lib/module/views/NativeStackView.js +47 -58
- package/lib/module/views/NativeStackView.js.map +1 -1
- package/lib/module/views/NativeStackView.native.js +144 -57
- package/lib/module/views/NativeStackView.native.js.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/navigators/createNativeStackNavigator.d.ts +13 -8
- package/lib/typescript/src/navigators/createNativeStackNavigator.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +95 -9
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/debounce.d.ts +2 -0
- package/lib/typescript/src/utils/debounce.d.ts.map +1 -0
- package/lib/typescript/src/utils/getModalRoutesKeys.d.ts +4 -0
- package/lib/typescript/src/utils/getModalRoutesKeys.d.ts.map +1 -0
- package/lib/typescript/src/utils/useAnimatedHeaderHeight.d.ts +2 -2
- package/lib/typescript/src/utils/useAnimatedHeaderHeight.d.ts.map +1 -1
- package/lib/typescript/src/views/HeaderConfig.d.ts +0 -1
- package/lib/typescript/src/views/HeaderConfig.d.ts.map +1 -1
- package/lib/typescript/src/views/NativeStackView.d.ts.map +1 -1
- package/lib/typescript/src/views/NativeStackView.native.d.ts +1 -1
- package/lib/typescript/src/views/NativeStackView.native.d.ts.map +1 -1
- package/package.json +15 -15
- package/src/index.tsx +1 -0
- package/src/navigators/createNativeStackNavigator.tsx +30 -6
- package/src/types.tsx +100 -6
- package/src/utils/debounce.tsx +14 -0
- package/src/utils/getModalRoutesKeys.ts +21 -0
- package/src/utils/useAnimatedHeaderHeight.tsx +1 -1
- package/src/views/HeaderConfig.tsx +12 -5
- package/src/views/NativeStackView.native.tsx +207 -98
- package/src/views/NativeStackView.tsx +119 -123
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import type { DefaultNavigatorOptions, Descriptor, NavigationHelpers, NavigationProp, ParamListBase, Route, RouteProp, StackActionHelpers, StackNavigationState, StackRouterOptions } from '@react-navigation/native';
|
|
1
|
+
import type { DefaultNavigatorOptions, Descriptor, NavigationHelpers, NavigationProp, ParamListBase, Route, RouteProp, StackActionHelpers, StackNavigationState, StackRouterOptions, Theme } from '@react-navigation/native';
|
|
3
2
|
import type { ImageSourcePropType, StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
4
|
-
import type { ScreenProps, ScreenStackHeaderConfigProps, SearchBarProps } from 'react-native-screens';
|
|
3
|
+
import type { ScreenProps, ScreenStackHeaderConfigProps, SearchBarProps, SheetDetentTypes } from 'react-native-screens';
|
|
5
4
|
export type NativeStackNavigationEventMap = {
|
|
6
5
|
/**
|
|
7
6
|
* Event which fires when a transition animation starts.
|
|
@@ -19,12 +18,21 @@ export type NativeStackNavigationEventMap = {
|
|
|
19
18
|
closing: boolean;
|
|
20
19
|
};
|
|
21
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* Event which fires when a swipe back is canceled on iOS.
|
|
23
|
+
*/
|
|
24
|
+
gestureCancel: {
|
|
25
|
+
data: undefined;
|
|
26
|
+
};
|
|
22
27
|
};
|
|
23
28
|
export type NativeStackNavigationProp<ParamList extends ParamListBase, RouteName extends keyof ParamList = string, NavigatorID extends string | undefined = undefined> = NavigationProp<ParamList, RouteName, NavigatorID, StackNavigationState<ParamList>, NativeStackNavigationOptions, NativeStackNavigationEventMap> & StackActionHelpers<ParamList>;
|
|
24
29
|
export type NativeStackScreenProps<ParamList extends ParamListBase, RouteName extends keyof ParamList = string, NavigatorID extends string | undefined = undefined> = {
|
|
25
30
|
navigation: NativeStackNavigationProp<ParamList, RouteName, NavigatorID>;
|
|
26
31
|
route: RouteProp<ParamList, RouteName>;
|
|
27
32
|
};
|
|
33
|
+
export type NativeStackOptionsArgs<ParamList extends ParamListBase, RouteName extends keyof ParamList = keyof ParamList, NavigatorID extends string | undefined = undefined> = NativeStackScreenProps<ParamList, RouteName, NavigatorID> & {
|
|
34
|
+
theme: Theme;
|
|
35
|
+
};
|
|
28
36
|
export type NativeStackNavigationHelpers = NavigationHelpers<ParamListBase, NativeStackNavigationEventMap>;
|
|
29
37
|
export type NativeStackNavigationConfig = {};
|
|
30
38
|
export type NativeStackHeaderProps = {
|
|
@@ -54,7 +62,7 @@ export type NativeStackHeaderProps = {
|
|
|
54
62
|
*/
|
|
55
63
|
navigation: NativeStackNavigationProp<ParamListBase>;
|
|
56
64
|
};
|
|
57
|
-
export type
|
|
65
|
+
export type NativeStackHeaderRightProps = {
|
|
58
66
|
/**
|
|
59
67
|
* Tint color for the header.
|
|
60
68
|
*/
|
|
@@ -64,12 +72,16 @@ export type HeaderButtonProps = {
|
|
|
64
72
|
*/
|
|
65
73
|
canGoBack: boolean;
|
|
66
74
|
};
|
|
67
|
-
export type
|
|
75
|
+
export type NativeStackHeaderLeftProps = NativeStackHeaderRightProps & {
|
|
68
76
|
/**
|
|
69
77
|
* Label text for the button. Usually the title of the previous screen.
|
|
70
78
|
* By default, this is only shown on iOS.
|
|
71
79
|
*/
|
|
72
80
|
label?: string;
|
|
81
|
+
/**
|
|
82
|
+
* The `href` to use for the anchor tag on web
|
|
83
|
+
*/
|
|
84
|
+
href?: string;
|
|
73
85
|
};
|
|
74
86
|
export type NativeStackNavigationOptions = {
|
|
75
87
|
/**
|
|
@@ -222,11 +234,11 @@ export type NativeStackNavigationOptions = {
|
|
|
222
234
|
* Function which returns a React Element to display on the left side of the header.
|
|
223
235
|
* This replaces the back button. See `headerBackVisible` to show the back button along side left element.
|
|
224
236
|
*/
|
|
225
|
-
headerLeft?: (props:
|
|
237
|
+
headerLeft?: (props: NativeStackHeaderLeftProps) => React.ReactNode;
|
|
226
238
|
/**
|
|
227
239
|
* Function which returns a React Element to display on the right side of the header.
|
|
228
240
|
*/
|
|
229
|
-
headerRight?: (props:
|
|
241
|
+
headerRight?: (props: NativeStackHeaderRightProps) => React.ReactNode;
|
|
230
242
|
/**
|
|
231
243
|
* String or a function that returns a React Element to be used by the header.
|
|
232
244
|
* Defaults to screen `title` or route name.
|
|
@@ -270,7 +282,7 @@ export type NativeStackNavigationOptions = {
|
|
|
270
282
|
*
|
|
271
283
|
* Only supported on iOS and Android.
|
|
272
284
|
*/
|
|
273
|
-
headerSearchBarOptions?: SearchBarProps
|
|
285
|
+
headerSearchBarOptions?: Omit<SearchBarProps, 'ref'>;
|
|
274
286
|
/**
|
|
275
287
|
* Boolean indicating whether to show the menu on longPress of iOS >= 14 back button. Defaults to `true`.
|
|
276
288
|
* Requires `react-native-screens` version >=3.3.0.
|
|
@@ -286,12 +298,24 @@ export type NativeStackNavigationOptions = {
|
|
|
286
298
|
* @platform ios
|
|
287
299
|
*/
|
|
288
300
|
autoHideHomeIndicator?: boolean;
|
|
301
|
+
/**
|
|
302
|
+
* Whether the keyboard should hide when swiping to the previous screen. Defaults to `false`.
|
|
303
|
+
*
|
|
304
|
+
* @platform ios
|
|
305
|
+
*/
|
|
306
|
+
keyboardHandlingEnabled?: boolean;
|
|
289
307
|
/**
|
|
290
308
|
* Sets the navigation bar color. Defaults to initial navigation bar color.
|
|
291
309
|
*
|
|
292
310
|
* @platform android
|
|
293
311
|
*/
|
|
294
312
|
navigationBarColor?: string;
|
|
313
|
+
/**
|
|
314
|
+
* Boolean indicating whether the content should be visible behind the navigation bar. Defaults to `false`.
|
|
315
|
+
*
|
|
316
|
+
* @platform android
|
|
317
|
+
*/
|
|
318
|
+
navigationBarTranslucent?: boolean;
|
|
295
319
|
/**
|
|
296
320
|
* Sets the visibility of the navigation bar. Defaults to `false`.
|
|
297
321
|
*
|
|
@@ -378,6 +402,12 @@ export type NativeStackNavigationOptions = {
|
|
|
378
402
|
* @platform ios
|
|
379
403
|
*/
|
|
380
404
|
gestureEnabled?: boolean;
|
|
405
|
+
/**
|
|
406
|
+
* Use it to restrict the distance from the edges of screen in which the gesture should be recognized. To be used alongside `fullScreenGestureEnabled`.
|
|
407
|
+
*
|
|
408
|
+
* @platform ios
|
|
409
|
+
*/
|
|
410
|
+
gestureResponseDistance?: ScreenProps['gestureResponseDistance'];
|
|
381
411
|
/**
|
|
382
412
|
* The type of animation to use when this screen replaces another screen. Defaults to `pop`.
|
|
383
413
|
*
|
|
@@ -426,6 +456,62 @@ export type NativeStackNavigationOptions = {
|
|
|
426
456
|
* Only supported on iOS and Android.
|
|
427
457
|
*/
|
|
428
458
|
presentation?: Exclude<ScreenProps['stackPresentation'], 'push'> | 'card';
|
|
459
|
+
/**
|
|
460
|
+
* Describes heights where a sheet can rest.
|
|
461
|
+
* Works only when `presentation` is set to `formSheet`.
|
|
462
|
+
* Defaults to `large`.
|
|
463
|
+
*
|
|
464
|
+
* Available values:
|
|
465
|
+
*
|
|
466
|
+
* - `large` - only large detent level will be allowed
|
|
467
|
+
* - `medium` - only medium detent level will be allowed
|
|
468
|
+
* - `all` - all detent levels will be allowed
|
|
469
|
+
*
|
|
470
|
+
* @platform ios
|
|
471
|
+
*/
|
|
472
|
+
sheetAllowedDetents?: SheetDetentTypes;
|
|
473
|
+
/**
|
|
474
|
+
* Whether the sheet should expand to larger detent when scrolling.
|
|
475
|
+
* Works only when `presentation` is set to `formSheet`.
|
|
476
|
+
* Defaults to `true`.
|
|
477
|
+
*
|
|
478
|
+
* @platform ios
|
|
479
|
+
*/
|
|
480
|
+
sheetExpandsWhenScrolledToEdge?: boolean;
|
|
481
|
+
/**
|
|
482
|
+
* The corner radius that the sheet will try to render with.
|
|
483
|
+
* Works only when `presentation` is set to `formSheet`.
|
|
484
|
+
*
|
|
485
|
+
* If set to non-negative value it will try to render sheet with provided radius, else it will apply system default.
|
|
486
|
+
*
|
|
487
|
+
* If left unset system default is used.
|
|
488
|
+
*
|
|
489
|
+
* @platform ios
|
|
490
|
+
*/
|
|
491
|
+
sheetCornerRadius?: number;
|
|
492
|
+
/**
|
|
493
|
+
* Boolean indicating whether the sheet shows a grabber at the top.
|
|
494
|
+
* Works only when `presentation` is set to `formSheet`.
|
|
495
|
+
* Defaults to `false`.
|
|
496
|
+
*
|
|
497
|
+
* @platform ios
|
|
498
|
+
*/
|
|
499
|
+
sheetGrabberVisible?: boolean;
|
|
500
|
+
/**
|
|
501
|
+
* The largest sheet detent for which a view underneath won't be dimmed.
|
|
502
|
+
* Works only when `presentation` is se tto `formSheet`.
|
|
503
|
+
*
|
|
504
|
+
* If this prop is set to:
|
|
505
|
+
*
|
|
506
|
+
* - `large` - the view underneath won't be dimmed at any detent level
|
|
507
|
+
* - `medium` - the view underneath will be dimmed only when detent level is `large`
|
|
508
|
+
* - `all` - the view underneath will be dimmed for any detent level
|
|
509
|
+
*
|
|
510
|
+
* Defaults to `all`.
|
|
511
|
+
*
|
|
512
|
+
* @platform ios
|
|
513
|
+
*/
|
|
514
|
+
sheetLargestUndimmedDetent?: SheetDetentTypes;
|
|
429
515
|
/**
|
|
430
516
|
* The display orientation to use for the screen.
|
|
431
517
|
*
|
|
@@ -451,7 +537,7 @@ export type NativeStackNavigationOptions = {
|
|
|
451
537
|
*/
|
|
452
538
|
freezeOnBlur?: boolean;
|
|
453
539
|
};
|
|
454
|
-
export type NativeStackNavigatorProps = DefaultNavigatorOptions<ParamListBase, StackNavigationState<ParamListBase>, NativeStackNavigationOptions, NativeStackNavigationEventMap
|
|
540
|
+
export type NativeStackNavigatorProps = DefaultNavigatorOptions<ParamListBase, string | undefined, StackNavigationState<ParamListBase>, NativeStackNavigationOptions, NativeStackNavigationEventMap, NativeStackNavigationProp<ParamListBase>> & StackRouterOptions & NativeStackNavigationConfig;
|
|
455
541
|
export type NativeStackDescriptor = Descriptor<NativeStackNavigationOptions, NativeStackNavigationProp<ParamListBase>, RouteProp<ParamListBase>>;
|
|
456
542
|
export type NativeStackDescriptorMap = {
|
|
457
543
|
[key: string]: NativeStackDescriptor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,KAAK,EACL,SAAS,EACT,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,KAAK,EACN,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EACV,mBAAmB,EACnB,SAAS,EACT,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACV,WAAW,EACX,4BAA4B,EAC5B,cAAc,EACd,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,MAAM,6BAA6B,GAAG;IAC1C;;OAEG;IACH,eAAe,EAAE;QAAE,IAAI,EAAE;YAAE,OAAO,EAAE,OAAO,CAAA;SAAE,CAAA;KAAE,CAAC;IAChD;;OAEG;IACH,aAAa,EAAE;QAAE,IAAI,EAAE;YAAE,OAAO,EAAE,OAAO,CAAA;SAAE,CAAA;KAAE,CAAC;IAC9C;;OAEG;IACH,aAAa,EAAE;QAAE,IAAI,EAAE,SAAS,CAAA;KAAE,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,yBAAyB,CACnC,SAAS,SAAS,aAAa,EAC/B,SAAS,SAAS,MAAM,SAAS,GAAG,MAAM,EAC1C,WAAW,SAAS,MAAM,GAAG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AE,CAAC,EACP,QAAQ,EAAE,MAAM,GACf,CAAC,CAUH"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Route } from '@react-navigation/native';
|
|
2
|
+
import type { NativeStackDescriptorMap } from '../types';
|
|
3
|
+
export declare const getModalRouteKeys: (routes: Route<string>[], descriptors: NativeStackDescriptorMap) => string[];
|
|
4
|
+
//# sourceMappingURL=getModalRoutesKeys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getModalRoutesKeys.d.ts","sourceRoot":"","sources":["../../../../src/utils/getModalRoutesKeys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAEzD,eAAO,MAAM,iBAAiB,WACpB,KAAK,CAAC,MAAM,CAAC,EAAE,eACV,wBAAwB,aAc/B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { Animated } from 'react-native';
|
|
3
|
-
export declare const AnimatedHeaderHeightContext: React.Context<Animated.
|
|
4
|
-
export declare function useAnimatedHeaderHeight(): Animated.
|
|
3
|
+
export declare const AnimatedHeaderHeightContext: React.Context<Animated.AnimatedInterpolation<number> | undefined>;
|
|
4
|
+
export declare function useAnimatedHeaderHeight(): Animated.AnimatedInterpolation<number>;
|
|
5
5
|
//# sourceMappingURL=useAnimatedHeaderHeight.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAnimatedHeaderHeight.d.ts","sourceRoot":"","sources":["../../../../src/utils/useAnimatedHeaderHeight.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,eAAO,MAAM,2BAA2B,
|
|
1
|
+
{"version":3,"file":"useAnimatedHeaderHeight.d.ts","sourceRoot":"","sources":["../../../../src/utils/useAnimatedHeaderHeight.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,eAAO,MAAM,2BAA2B,mEAE5B,CAAC;AAEb,wBAAgB,uBAAuB,2CAUtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderConfig.d.ts","sourceRoot":"","sources":["../../../../src/views/HeaderConfig.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HeaderConfig.d.ts","sourceRoot":"","sources":["../../../../src/views/HeaderConfig.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,KAAK,EAAuB,MAAM,0BAA0B,CAAC;AAc3E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAG7D,KAAK,KAAK,GAAG,4BAA4B,GAAG;IAC1C,qBAAqB,EAAE,OAAO,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,wBAAgB,YAAY,CAAC,EAC3B,qBAAqB,EACrB,2BAA2B,EAC3B,eAAe,EACf,oBAAoB,EACpB,sBAA6B,EAC7B,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,6BAA6B,EAC7B,qBAAqB,EACrB,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,KAAK,EACL,KAAK,EACL,SAAS,GACV,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CAwOrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeStackView.d.ts","sourceRoot":"","sources":["../../../../src/views/NativeStackView.tsx"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,oBAAoB,
|
|
1
|
+
{"version":3,"file":"NativeStackView.d.ts","sourceRoot":"","sources":["../../../../src/views/NativeStackView.tsx"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,oBAAoB,EAG1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EACV,wBAAwB,EACxB,4BAA4B,EAC7B,MAAM,UAAU,CAAC;AAElB,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,oBAAoB,CAAC,aAAa,CAAC,CAAC;IAG3C,UAAU,EAAE,4BAA4B,CAAC;IACzC,WAAW,EAAE,wBAAwB,CAAC;CACvC,CAAC;AAOF,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,KAAK,qBA8J5D"}
|
|
@@ -6,6 +6,6 @@ type Props = {
|
|
|
6
6
|
navigation: NativeStackNavigationHelpers;
|
|
7
7
|
descriptors: NativeStackDescriptorMap;
|
|
8
8
|
};
|
|
9
|
-
export declare function NativeStackView(
|
|
9
|
+
export declare function NativeStackView({ state, navigation, descriptors }: Props): React.JSX.Element;
|
|
10
10
|
export {};
|
|
11
11
|
//# sourceMappingURL=NativeStackView.native.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeStackView.native.d.ts","sourceRoot":"","sources":["../../../../src/views/NativeStackView.native.tsx"],"names":[],"mappings":"AAQA,OAAO,EAGL,KAAK,aAAa,EAGlB,KAAK,oBAAoB,EAG1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"NativeStackView.native.d.ts","sourceRoot":"","sources":["../../../../src/views/NativeStackView.native.tsx"],"names":[],"mappings":"AAQA,OAAO,EAGL,KAAK,aAAa,EAGlB,KAAK,oBAAoB,EAG1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAqB/B,OAAO,KAAK,EAEV,wBAAwB,EACxB,4BAA4B,EAE7B,MAAM,UAAU,CAAC;AAwdlB,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,oBAAoB,CAAC,aAAa,CAAC,CAAC;IAC3C,UAAU,EAAE,4BAA4B,CAAC;IACzC,WAAW,EAAE,wBAAwB,CAAC;CACvC,CAAC;AAEF,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,EAAE,KAAK,qBAgGxE"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-navigation/native-stack",
|
|
3
3
|
"description": "Native stack navigator using react-native-screens",
|
|
4
|
-
"version": "7.0.0-
|
|
4
|
+
"version": "7.0.0-rc.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native-component",
|
|
7
7
|
"react-component",
|
|
@@ -41,26 +41,26 @@
|
|
|
41
41
|
"clean": "del lib"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@react-navigation/elements": "^2.0.0-
|
|
44
|
+
"@react-navigation/elements": "^2.0.0-rc.0",
|
|
45
45
|
"warn-once": "^0.1.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@react-navigation/native": "^7.0.0-
|
|
49
|
-
"@testing-library/react-native": "^12.3
|
|
50
|
-
"@types/react": "~18.2.
|
|
48
|
+
"@react-navigation/native": "^7.0.0-rc.0",
|
|
49
|
+
"@testing-library/react-native": "^12.4.3",
|
|
50
|
+
"@types/react": "~18.2.79",
|
|
51
51
|
"del-cli": "^5.1.0",
|
|
52
52
|
"react": "18.2.0",
|
|
53
|
-
"react-native": "0.
|
|
54
|
-
"react-native-builder-bob": "^0.23.
|
|
55
|
-
"react-native-screens": "
|
|
56
|
-
"typescript": "^5.
|
|
53
|
+
"react-native": "0.74.2",
|
|
54
|
+
"react-native-builder-bob": "^0.23.2",
|
|
55
|
+
"react-native-screens": "3.31.1",
|
|
56
|
+
"typescript": "^5.5.2"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@react-navigation/native": "^7.0.0-
|
|
60
|
-
"react": "
|
|
61
|
-
"react-native": "0.72.
|
|
62
|
-
"react-native-safe-area-context": "4.
|
|
63
|
-
"react-native-screens": "
|
|
59
|
+
"@react-navigation/native": "^7.0.0-rc.0",
|
|
60
|
+
"react": ">= 18.2.0",
|
|
61
|
+
"react-native": ">= 0.72.0",
|
|
62
|
+
"react-native-safe-area-context": ">= 4.0.0",
|
|
63
|
+
"react-native-screens": ">= 3.0.0"
|
|
64
64
|
},
|
|
65
65
|
"react-native-builder-bob": {
|
|
66
66
|
"source": "src",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
]
|
|
77
77
|
]
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "2a1d67089eea2a3d87e38a870ccee35a79c55d7d"
|
|
80
80
|
}
|
package/src/index.tsx
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createNavigatorFactory,
|
|
3
3
|
type EventArg,
|
|
4
|
+
type NavigatorTypeBagBase,
|
|
4
5
|
type ParamListBase,
|
|
5
6
|
type StackActionHelpers,
|
|
6
7
|
StackActions,
|
|
7
8
|
type StackNavigationState,
|
|
8
9
|
StackRouter,
|
|
9
10
|
type StackRouterOptions,
|
|
11
|
+
type StaticConfig,
|
|
12
|
+
type TypedNavigator,
|
|
10
13
|
useNavigationBuilder,
|
|
11
14
|
} from '@react-navigation/native';
|
|
12
15
|
import * as React from 'react';
|
|
@@ -14,6 +17,7 @@ import * as React from 'react';
|
|
|
14
17
|
import type {
|
|
15
18
|
NativeStackNavigationEventMap,
|
|
16
19
|
NativeStackNavigationOptions,
|
|
20
|
+
NativeStackNavigationProp,
|
|
17
21
|
NativeStackNavigatorProps,
|
|
18
22
|
} from '../types';
|
|
19
23
|
import { NativeStackView } from '../views/NativeStackView';
|
|
@@ -26,6 +30,7 @@ function NativeStackNavigator({
|
|
|
26
30
|
screenListeners,
|
|
27
31
|
screenOptions,
|
|
28
32
|
screenLayout,
|
|
33
|
+
UNSTABLE_getStateForRouteNamesChange,
|
|
29
34
|
...rest
|
|
30
35
|
}: NativeStackNavigatorProps) {
|
|
31
36
|
const { state, descriptors, navigation, NavigationContent } =
|
|
@@ -43,6 +48,7 @@ function NativeStackNavigator({
|
|
|
43
48
|
screenListeners,
|
|
44
49
|
screenOptions,
|
|
45
50
|
screenLayout,
|
|
51
|
+
UNSTABLE_getStateForRouteNamesChange,
|
|
46
52
|
});
|
|
47
53
|
|
|
48
54
|
React.useEffect(
|
|
@@ -83,9 +89,27 @@ function NativeStackNavigator({
|
|
|
83
89
|
);
|
|
84
90
|
}
|
|
85
91
|
|
|
86
|
-
export
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
+
export function createNativeStackNavigator<
|
|
93
|
+
ParamList extends ParamListBase,
|
|
94
|
+
NavigatorID extends string | undefined = undefined,
|
|
95
|
+
TypeBag extends NavigatorTypeBagBase = {
|
|
96
|
+
ParamList: ParamList;
|
|
97
|
+
NavigatorID: NavigatorID;
|
|
98
|
+
State: StackNavigationState<ParamList>;
|
|
99
|
+
ScreenOptions: NativeStackNavigationOptions;
|
|
100
|
+
EventMap: NativeStackNavigationEventMap;
|
|
101
|
+
NavigationList: {
|
|
102
|
+
[RouteName in keyof ParamList]: NativeStackNavigationProp<
|
|
103
|
+
ParamList,
|
|
104
|
+
RouteName,
|
|
105
|
+
NavigatorID
|
|
106
|
+
>;
|
|
107
|
+
};
|
|
108
|
+
Navigator: typeof NativeStackNavigator;
|
|
109
|
+
},
|
|
110
|
+
Config extends StaticConfig<TypeBag> | undefined =
|
|
111
|
+
| StaticConfig<TypeBag>
|
|
112
|
+
| undefined,
|
|
113
|
+
>(config?: Config): TypedNavigator<TypeBag, Config> {
|
|
114
|
+
return createNavigatorFactory(NativeStackNavigator)(config);
|
|
115
|
+
}
|
package/src/types.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
StackActionHelpers,
|
|
10
10
|
StackNavigationState,
|
|
11
11
|
StackRouterOptions,
|
|
12
|
+
Theme,
|
|
12
13
|
} from '@react-navigation/native';
|
|
13
14
|
import type {
|
|
14
15
|
ImageSourcePropType,
|
|
@@ -20,6 +21,7 @@ import type {
|
|
|
20
21
|
ScreenProps,
|
|
21
22
|
ScreenStackHeaderConfigProps,
|
|
22
23
|
SearchBarProps,
|
|
24
|
+
SheetDetentTypes,
|
|
23
25
|
} from 'react-native-screens';
|
|
24
26
|
|
|
25
27
|
export type NativeStackNavigationEventMap = {
|
|
@@ -31,6 +33,10 @@ export type NativeStackNavigationEventMap = {
|
|
|
31
33
|
* Event which fires when a transition animation ends.
|
|
32
34
|
*/
|
|
33
35
|
transitionEnd: { data: { closing: boolean } };
|
|
36
|
+
/**
|
|
37
|
+
* Event which fires when a swipe back is canceled on iOS.
|
|
38
|
+
*/
|
|
39
|
+
gestureCancel: { data: undefined };
|
|
34
40
|
};
|
|
35
41
|
|
|
36
42
|
export type NativeStackNavigationProp<
|
|
@@ -56,6 +62,14 @@ export type NativeStackScreenProps<
|
|
|
56
62
|
route: RouteProp<ParamList, RouteName>;
|
|
57
63
|
};
|
|
58
64
|
|
|
65
|
+
export type NativeStackOptionsArgs<
|
|
66
|
+
ParamList extends ParamListBase,
|
|
67
|
+
RouteName extends keyof ParamList = keyof ParamList,
|
|
68
|
+
NavigatorID extends string | undefined = undefined,
|
|
69
|
+
> = NativeStackScreenProps<ParamList, RouteName, NavigatorID> & {
|
|
70
|
+
theme: Theme;
|
|
71
|
+
};
|
|
72
|
+
|
|
59
73
|
export type NativeStackNavigationHelpers = NavigationHelpers<
|
|
60
74
|
ParamListBase,
|
|
61
75
|
NativeStackNavigationEventMap
|
|
@@ -92,7 +106,7 @@ export type NativeStackHeaderProps = {
|
|
|
92
106
|
navigation: NativeStackNavigationProp<ParamListBase>;
|
|
93
107
|
};
|
|
94
108
|
|
|
95
|
-
export type
|
|
109
|
+
export type NativeStackHeaderRightProps = {
|
|
96
110
|
/**
|
|
97
111
|
* Tint color for the header.
|
|
98
112
|
*/
|
|
@@ -103,12 +117,16 @@ export type HeaderButtonProps = {
|
|
|
103
117
|
canGoBack: boolean;
|
|
104
118
|
};
|
|
105
119
|
|
|
106
|
-
export type
|
|
120
|
+
export type NativeStackHeaderLeftProps = NativeStackHeaderRightProps & {
|
|
107
121
|
/**
|
|
108
122
|
* Label text for the button. Usually the title of the previous screen.
|
|
109
123
|
* By default, this is only shown on iOS.
|
|
110
124
|
*/
|
|
111
125
|
label?: string;
|
|
126
|
+
/**
|
|
127
|
+
* The `href` to use for the anchor tag on web
|
|
128
|
+
*/
|
|
129
|
+
href?: string;
|
|
112
130
|
};
|
|
113
131
|
|
|
114
132
|
export type NativeStackNavigationOptions = {
|
|
@@ -262,11 +280,11 @@ export type NativeStackNavigationOptions = {
|
|
|
262
280
|
* Function which returns a React Element to display on the left side of the header.
|
|
263
281
|
* This replaces the back button. See `headerBackVisible` to show the back button along side left element.
|
|
264
282
|
*/
|
|
265
|
-
headerLeft?: (props:
|
|
283
|
+
headerLeft?: (props: NativeStackHeaderLeftProps) => React.ReactNode;
|
|
266
284
|
/**
|
|
267
285
|
* Function which returns a React Element to display on the right side of the header.
|
|
268
286
|
*/
|
|
269
|
-
headerRight?: (props:
|
|
287
|
+
headerRight?: (props: NativeStackHeaderRightProps) => React.ReactNode;
|
|
270
288
|
/**
|
|
271
289
|
* String or a function that returns a React Element to be used by the header.
|
|
272
290
|
* Defaults to screen `title` or route name.
|
|
@@ -314,7 +332,7 @@ export type NativeStackNavigationOptions = {
|
|
|
314
332
|
*
|
|
315
333
|
* Only supported on iOS and Android.
|
|
316
334
|
*/
|
|
317
|
-
headerSearchBarOptions?: SearchBarProps
|
|
335
|
+
headerSearchBarOptions?: Omit<SearchBarProps, 'ref'>;
|
|
318
336
|
/**
|
|
319
337
|
* Boolean indicating whether to show the menu on longPress of iOS >= 14 back button. Defaults to `true`.
|
|
320
338
|
* Requires `react-native-screens` version >=3.3.0.
|
|
@@ -330,12 +348,24 @@ export type NativeStackNavigationOptions = {
|
|
|
330
348
|
* @platform ios
|
|
331
349
|
*/
|
|
332
350
|
autoHideHomeIndicator?: boolean;
|
|
351
|
+
/**
|
|
352
|
+
* Whether the keyboard should hide when swiping to the previous screen. Defaults to `false`.
|
|
353
|
+
*
|
|
354
|
+
* @platform ios
|
|
355
|
+
*/
|
|
356
|
+
keyboardHandlingEnabled?: boolean;
|
|
333
357
|
/**
|
|
334
358
|
* Sets the navigation bar color. Defaults to initial navigation bar color.
|
|
335
359
|
*
|
|
336
360
|
* @platform android
|
|
337
361
|
*/
|
|
338
362
|
navigationBarColor?: string;
|
|
363
|
+
/**
|
|
364
|
+
* Boolean indicating whether the content should be visible behind the navigation bar. Defaults to `false`.
|
|
365
|
+
*
|
|
366
|
+
* @platform android
|
|
367
|
+
*/
|
|
368
|
+
navigationBarTranslucent?: boolean;
|
|
339
369
|
/**
|
|
340
370
|
* Sets the visibility of the navigation bar. Defaults to `false`.
|
|
341
371
|
*
|
|
@@ -422,6 +452,12 @@ export type NativeStackNavigationOptions = {
|
|
|
422
452
|
* @platform ios
|
|
423
453
|
*/
|
|
424
454
|
gestureEnabled?: boolean;
|
|
455
|
+
/**
|
|
456
|
+
* Use it to restrict the distance from the edges of screen in which the gesture should be recognized. To be used alongside `fullScreenGestureEnabled`.
|
|
457
|
+
*
|
|
458
|
+
* @platform ios
|
|
459
|
+
*/
|
|
460
|
+
gestureResponseDistance?: ScreenProps['gestureResponseDistance'];
|
|
425
461
|
/**
|
|
426
462
|
* The type of animation to use when this screen replaces another screen. Defaults to `pop`.
|
|
427
463
|
*
|
|
@@ -470,6 +506,62 @@ export type NativeStackNavigationOptions = {
|
|
|
470
506
|
* Only supported on iOS and Android.
|
|
471
507
|
*/
|
|
472
508
|
presentation?: Exclude<ScreenProps['stackPresentation'], 'push'> | 'card';
|
|
509
|
+
/**
|
|
510
|
+
* Describes heights where a sheet can rest.
|
|
511
|
+
* Works only when `presentation` is set to `formSheet`.
|
|
512
|
+
* Defaults to `large`.
|
|
513
|
+
*
|
|
514
|
+
* Available values:
|
|
515
|
+
*
|
|
516
|
+
* - `large` - only large detent level will be allowed
|
|
517
|
+
* - `medium` - only medium detent level will be allowed
|
|
518
|
+
* - `all` - all detent levels will be allowed
|
|
519
|
+
*
|
|
520
|
+
* @platform ios
|
|
521
|
+
*/
|
|
522
|
+
sheetAllowedDetents?: SheetDetentTypes;
|
|
523
|
+
/**
|
|
524
|
+
* Whether the sheet should expand to larger detent when scrolling.
|
|
525
|
+
* Works only when `presentation` is set to `formSheet`.
|
|
526
|
+
* Defaults to `true`.
|
|
527
|
+
*
|
|
528
|
+
* @platform ios
|
|
529
|
+
*/
|
|
530
|
+
sheetExpandsWhenScrolledToEdge?: boolean;
|
|
531
|
+
/**
|
|
532
|
+
* The corner radius that the sheet will try to render with.
|
|
533
|
+
* Works only when `presentation` is set to `formSheet`.
|
|
534
|
+
*
|
|
535
|
+
* If set to non-negative value it will try to render sheet with provided radius, else it will apply system default.
|
|
536
|
+
*
|
|
537
|
+
* If left unset system default is used.
|
|
538
|
+
*
|
|
539
|
+
* @platform ios
|
|
540
|
+
*/
|
|
541
|
+
sheetCornerRadius?: number;
|
|
542
|
+
/**
|
|
543
|
+
* Boolean indicating whether the sheet shows a grabber at the top.
|
|
544
|
+
* Works only when `presentation` is set to `formSheet`.
|
|
545
|
+
* Defaults to `false`.
|
|
546
|
+
*
|
|
547
|
+
* @platform ios
|
|
548
|
+
*/
|
|
549
|
+
sheetGrabberVisible?: boolean;
|
|
550
|
+
/**
|
|
551
|
+
* The largest sheet detent for which a view underneath won't be dimmed.
|
|
552
|
+
* Works only when `presentation` is se tto `formSheet`.
|
|
553
|
+
*
|
|
554
|
+
* If this prop is set to:
|
|
555
|
+
*
|
|
556
|
+
* - `large` - the view underneath won't be dimmed at any detent level
|
|
557
|
+
* - `medium` - the view underneath will be dimmed only when detent level is `large`
|
|
558
|
+
* - `all` - the view underneath will be dimmed for any detent level
|
|
559
|
+
*
|
|
560
|
+
* Defaults to `all`.
|
|
561
|
+
*
|
|
562
|
+
* @platform ios
|
|
563
|
+
*/
|
|
564
|
+
sheetLargestUndimmedDetent?: SheetDetentTypes;
|
|
473
565
|
/**
|
|
474
566
|
* The display orientation to use for the screen.
|
|
475
567
|
*
|
|
@@ -498,9 +590,11 @@ export type NativeStackNavigationOptions = {
|
|
|
498
590
|
|
|
499
591
|
export type NativeStackNavigatorProps = DefaultNavigatorOptions<
|
|
500
592
|
ParamListBase,
|
|
593
|
+
string | undefined,
|
|
501
594
|
StackNavigationState<ParamListBase>,
|
|
502
595
|
NativeStackNavigationOptions,
|
|
503
|
-
NativeStackNavigationEventMap
|
|
596
|
+
NativeStackNavigationEventMap,
|
|
597
|
+
NativeStackNavigationProp<ParamListBase>
|
|
504
598
|
> &
|
|
505
599
|
StackRouterOptions &
|
|
506
600
|
NativeStackNavigationConfig;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function debounce<T extends (...args: any[]) => void>(
|
|
2
|
+
func: T,
|
|
3
|
+
duration: number
|
|
4
|
+
): T {
|
|
5
|
+
let timeout: NodeJS.Timeout;
|
|
6
|
+
|
|
7
|
+
return function (this: unknown, ...args) {
|
|
8
|
+
clearTimeout(timeout);
|
|
9
|
+
|
|
10
|
+
timeout = setTimeout(() => {
|
|
11
|
+
func.apply(this, args);
|
|
12
|
+
}, duration);
|
|
13
|
+
} as T;
|
|
14
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Route } from '@react-navigation/native';
|
|
2
|
+
|
|
3
|
+
import type { NativeStackDescriptorMap } from '../types';
|
|
4
|
+
|
|
5
|
+
export const getModalRouteKeys = (
|
|
6
|
+
routes: Route<string>[],
|
|
7
|
+
descriptors: NativeStackDescriptorMap
|
|
8
|
+
) =>
|
|
9
|
+
routes.reduce<string[]>((acc, route) => {
|
|
10
|
+
const { presentation } = descriptors[route.key]?.options ?? {};
|
|
11
|
+
|
|
12
|
+
if (
|
|
13
|
+
(acc.length && !presentation) ||
|
|
14
|
+
presentation === 'modal' ||
|
|
15
|
+
presentation === 'transparentModal'
|
|
16
|
+
) {
|
|
17
|
+
acc.push(route.key);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return acc;
|
|
21
|
+
}, []);
|