@react-navigation/native-stack 8.0.0-alpha.51 → 8.0.0-alpha.53
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/module/navigators/createNativeStackNavigator.js +7 -9
- package/lib/module/navigators/createNativeStackNavigator.js.map +1 -1
- package/lib/typescript/src/navigators/createNativeStackNavigator.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +4 -4
- package/package.json +5 -5
- package/src/navigators/createNativeStackNavigator.tsx +23 -26
- package/src/types.tsx +4 -4
|
@@ -19,7 +19,7 @@ function NativeStackNavigator({
|
|
|
19
19
|
state,
|
|
20
20
|
descriptors,
|
|
21
21
|
navigation,
|
|
22
|
-
|
|
22
|
+
render
|
|
23
23
|
} = useNavigationBuilder(StackRouter, {
|
|
24
24
|
initialRouteName,
|
|
25
25
|
routeNamesChangeBehavior,
|
|
@@ -63,14 +63,12 @@ function NativeStackNavigator({
|
|
|
63
63
|
unsubscribe?.();
|
|
64
64
|
};
|
|
65
65
|
}, [meta, navigation]);
|
|
66
|
-
return /*#__PURE__*/_jsx(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
})
|
|
73
|
-
});
|
|
66
|
+
return render(/*#__PURE__*/_jsx(NativeStackView, {
|
|
67
|
+
...rest,
|
|
68
|
+
state: state,
|
|
69
|
+
navigation: navigation,
|
|
70
|
+
descriptors: descriptors
|
|
71
|
+
}));
|
|
74
72
|
}
|
|
75
73
|
export const createNativeStackNavigator = createNavigatorFactory(NativeStackNavigator);
|
|
76
74
|
export const createNativeStackScreen = createScreenFactory();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createNavigatorFactory","createScreenFactory","NavigationMetaContext","StackActions","StackRouter","useNavigationBuilder","React","NativeStackView","jsx","_jsx","NativeStackNavigator","initialRouteName","routeNamesChangeBehavior","children","layout","screenListeners","screenOptions","screenLayout","router","rest","state","descriptors","navigation","
|
|
1
|
+
{"version":3,"names":["createNavigatorFactory","createScreenFactory","NavigationMetaContext","StackActions","StackRouter","useNavigationBuilder","React","NativeStackView","jsx","_jsx","NativeStackNavigator","initialRouteName","routeNamesChangeBehavior","children","layout","screenListeners","screenOptions","screenLayout","router","rest","state","descriptors","navigation","render","meta","use","useEffect","type","handle","unsubscribe","addListener","e","isFocused","cancelAnimationFrame","requestAnimationFrame","currentState","getState","index","routes","history","length","defaultPrevented","dispatch","popToTop","target","key","createNativeStackNavigator","createNativeStackScreen"],"sourceRoot":"../../../src","sources":["navigators/createNativeStackNavigator.tsx"],"mappings":";;AAAA,SACEA,sBAAsB,EACtBC,mBAAmB,EAEnBC,qBAAqB,EAIrBC,YAAY,EAEZC,WAAW,EAEXC,oBAAoB,QACf,0BAA0B;AACjC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAO9B,SAASC,eAAe,QAAQ,0BAA0B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE3D,SAASC,oBAAoBA,CAAC;EAC5BC,gBAAgB;EAChBC,wBAAwB;EACxBC,QAAQ;EACRC,MAAM;EACNC,eAAe;EACfC,aAAa;EACbC,YAAY;EACZC,MAAM;EACN,GAAGC;AACsB,CAAC,EAAE;EAC5B,MAAM;IAAEC,KAAK;IAAEC,WAAW;IAAEC,UAAU;IAAEC;EAAO,CAAC,GAAGlB,oBAAoB,CAMrED,WAAW,EAAE;IACbO,gBAAgB;IAChBC,wBAAwB;IACxBC,QAAQ;IACRC,MAAM;IACNC,eAAe;IACfC,aAAa;IACbC,YAAY;IACZC;EACF,CAAC,CAAC;EAEF,MAAMM,IAAI,GAAGlB,KAAK,CAACmB,GAAG,CAACvB,qBAAqB,CAAC;EAE7CI,KAAK,CAACoB,SAAS,CAAC,MAAM;IACpB,IAAIF,IAAI,IAAI,MAAM,IAAIA,IAAI,IAAIA,IAAI,CAACG,IAAI,KAAK,aAAa,EAAE;MACzD;MACA;MACA;IACF;IAEA,IAAIC,MAA4D;;IAEhE;IACA,MAAMC,WAAW,GAAGP,UAAU,CAACQ,WAAW,GAAG,UAAU,EAAGC,CAAC,IAAK;MAC9D,MAAMC,SAAS,GAAGV,UAAU,CAACU,SAAS,CAAC,CAAC;MAExCC,oBAAoB,CAACL,MAAM,CAAC;;MAE5B;MACA;MACAA,MAAM,GAAGM,qBAAqB,CAAC,MAAM;QACnC,MAAMC,YAAY,GAAGb,UAAU,CAACc,QAAQ,CAAC,CAAC;QAE1C,IACEJ,SAAS,KACRG,YAAY,CAACE,KAAK,GAAG,CAAC,IAAIF,YAAY,CAACG,MAAM,CAAC,CAAC,CAAC,EAAEC,OAAO,EAAEC,MAAM,CAAC,IACnE,CAAET,CAAC,CAAgCU,gBAAgB,EACnD;UACA;UACA;UACAnB,UAAU,CAACoB,QAAQ,CAAC;YAClB,GAAGvC,YAAY,CAACwC,QAAQ,CAAC,CAAC;YAC1BC,MAAM,EAAET,YAAY,CAACU;UACvB,CAAC,CAAC;QACJ;MACF,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,MAAM;MACXZ,oBAAoB,CAACL,MAAM,CAAC;MAC5BC,WAAW,GAAG,CAAC;IACjB,CAAC;EACH,CAAC,EAAE,CAACL,IAAI,EAAEF,UAAU,CAAC,CAAC;EAEtB,OAAOC,MAAM,cACXd,IAAA,CAACF,eAAe;IAAA,GACVY,IAAI;IACRC,KAAK,EAAEA,KAAM;IACbE,UAAU,EAAEA,UAAW;IACvBD,WAAW,EAAEA;EAAY,CAC1B,CACH,CAAC;AACH;AAUA,OAAO,MAAMyB,0BAA0B,GACrC9C,sBAAsB,CAAqBU,oBAAoB,CAAC;AAElE,OAAO,MAAMqC,uBAAuB,GAClC9C,mBAAmB,CAAqB,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createNativeStackNavigator.d.ts","sourceRoot":"","sources":["../../../../src/navigators/createNativeStackNavigator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EAEvB,KAAK,oBAAoB,EAI1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EACV,6BAA6B,EAC7B,4BAA4B,EAC5B,yBAAyB,EAC1B,MAAM,aAAU,CAAC;AAGlB,iBAAS,oBAAoB,CAAC,EAC5B,gBAAgB,EAChB,wBAAwB,EACxB,QAAQ,EACR,MAAM,EACN,eAAe,EACf,aAAa,EACb,YAAY,EACZ,MAAM,EACN,GAAG,IAAI,EACR,EAAE,yBAAyB,
|
|
1
|
+
{"version":3,"file":"createNativeStackNavigator.d.ts","sourceRoot":"","sources":["../../../../src/navigators/createNativeStackNavigator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EAEvB,KAAK,oBAAoB,EAI1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EACV,6BAA6B,EAC7B,4BAA4B,EAC5B,yBAAyB,EAC1B,MAAM,aAAU,CAAC;AAGlB,iBAAS,oBAAoB,CAAC,EAC5B,gBAAgB,EAChB,wBAAwB,EACxB,QAAQ,EACR,MAAM,EACN,eAAe,EACf,aAAa,EACb,YAAY,EACZ,MAAM,EACN,GAAG,IAAI,EACR,EAAE,yBAAyB,qBAqE3B;AAED,MAAM,WAAW,kBAAmB,SAAQ,oBAAoB;IAC9D,KAAK,EAAE,oBAAoB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAC/C,aAAa,EAAE,4BAA4B,CAAC;IAC5C,QAAQ,EAAE,6BAA6B,CAAC;IACxC,aAAa,EAAE,kBAAkB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IACrD,SAAS,EAAE,OAAO,oBAAoB,CAAC;CACxC;AAED,eAAO,MAAM,0BAA0B,4EAC2B,CAAC;AAEnE,eAAO,MAAM,uBAAuB,+IACO,CAAC"}
|
|
@@ -258,8 +258,8 @@ export type NativeStackNavigationOptions = {
|
|
|
258
258
|
headerBackground?: (() => React.ReactNode) | undefined;
|
|
259
259
|
/**
|
|
260
260
|
* Function which returns a React Element to display on the left side of the header.
|
|
261
|
-
* This replaces the back button. See `headerBackVisible` to show the back button
|
|
262
|
-
* Will be
|
|
261
|
+
* This replaces the back button. See `headerBackVisible` to show the back button alongside the left element.
|
|
262
|
+
* Will be overridden by `headerLeftItems` on iOS.
|
|
263
263
|
*/
|
|
264
264
|
headerLeft?: ((props: NativeStackHeaderBackProps) => React.ReactNode) | undefined;
|
|
265
265
|
/**
|
|
@@ -273,7 +273,7 @@ export type NativeStackNavigationOptions = {
|
|
|
273
273
|
headerLeftBackgroundVisible?: boolean | undefined;
|
|
274
274
|
/**
|
|
275
275
|
* Function which returns a React Element to display on the right side of the header.
|
|
276
|
-
* Will be
|
|
276
|
+
* Will be overridden by `headerRightItems` on iOS.
|
|
277
277
|
*/
|
|
278
278
|
headerRight?: ((props: NativeStackHeaderItemProps) => React.ReactNode) | undefined;
|
|
279
279
|
/**
|
|
@@ -513,7 +513,7 @@ export type NativeStackNavigationOptions = {
|
|
|
513
513
|
*/
|
|
514
514
|
gestureResponseDistance?: ScreenProps['gestureResponseDistance'] | undefined;
|
|
515
515
|
/**
|
|
516
|
-
* The type of animation to use when this screen replaces another screen. Defaults to `
|
|
516
|
+
* The type of animation to use when this screen replaces another screen. Defaults to `push`.
|
|
517
517
|
*
|
|
518
518
|
* Supported values:
|
|
519
519
|
* - "push": the new screen will perform push animation.
|
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": "8.0.0-alpha.
|
|
4
|
+
"version": "8.0.0-alpha.53",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native-component",
|
|
7
7
|
"react-component",
|
|
@@ -46,12 +46,12 @@
|
|
|
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.49",
|
|
50
50
|
"warn-once": "^0.1.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@jest/globals": "^30.4.1",
|
|
54
|
-
"@react-navigation/native": "^8.0.0-alpha.
|
|
54
|
+
"@react-navigation/native": "^8.0.0-alpha.45",
|
|
55
55
|
"@testing-library/react": "^16.3.2",
|
|
56
56
|
"@testing-library/react-native": "^14.0.0",
|
|
57
57
|
"@testing-library/user-event": "^14.6.1",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"typescript": "^6.0.3"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@react-navigation/native": "^8.0.0-alpha.
|
|
70
|
+
"@react-navigation/native": "^8.0.0-alpha.45",
|
|
71
71
|
"react": ">= 19.2.0",
|
|
72
72
|
"react-native": "*",
|
|
73
73
|
"react-native-safe-area-context": ">= 5.5.0",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
]
|
|
92
92
|
]
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "400f7128965fc92c335a3f6c27e3fa26113915e4"
|
|
95
95
|
}
|
|
@@ -32,23 +32,22 @@ function NativeStackNavigator({
|
|
|
32
32
|
router,
|
|
33
33
|
...rest
|
|
34
34
|
}: NativeStackNavigatorProps) {
|
|
35
|
-
const { state, descriptors, navigation,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
});
|
|
35
|
+
const { state, descriptors, navigation, render } = useNavigationBuilder<
|
|
36
|
+
StackNavigationState<ParamListBase>,
|
|
37
|
+
StackRouterOptions,
|
|
38
|
+
StackActionHelpers<ParamListBase>,
|
|
39
|
+
NativeStackNavigationOptions,
|
|
40
|
+
NativeStackNavigationEventMap
|
|
41
|
+
>(StackRouter, {
|
|
42
|
+
initialRouteName,
|
|
43
|
+
routeNamesChangeBehavior,
|
|
44
|
+
children,
|
|
45
|
+
layout,
|
|
46
|
+
screenListeners,
|
|
47
|
+
screenOptions,
|
|
48
|
+
screenLayout,
|
|
49
|
+
router,
|
|
50
|
+
});
|
|
52
51
|
|
|
53
52
|
const meta = React.use(NavigationMetaContext);
|
|
54
53
|
|
|
@@ -93,15 +92,13 @@ function NativeStackNavigator({
|
|
|
93
92
|
};
|
|
94
93
|
}, [meta, navigation]);
|
|
95
94
|
|
|
96
|
-
return (
|
|
97
|
-
<
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
/>
|
|
104
|
-
</NavigationContent>
|
|
95
|
+
return render(
|
|
96
|
+
<NativeStackView
|
|
97
|
+
{...rest}
|
|
98
|
+
state={state}
|
|
99
|
+
navigation={navigation}
|
|
100
|
+
descriptors={descriptors}
|
|
101
|
+
/>
|
|
105
102
|
);
|
|
106
103
|
}
|
|
107
104
|
|
package/src/types.tsx
CHANGED
|
@@ -300,8 +300,8 @@ export type NativeStackNavigationOptions = {
|
|
|
300
300
|
headerBackground?: (() => React.ReactNode) | undefined;
|
|
301
301
|
/**
|
|
302
302
|
* Function which returns a React Element to display on the left side of the header.
|
|
303
|
-
* This replaces the back button. See `headerBackVisible` to show the back button
|
|
304
|
-
* Will be
|
|
303
|
+
* This replaces the back button. See `headerBackVisible` to show the back button alongside the left element.
|
|
304
|
+
* Will be overridden by `headerLeftItems` on iOS.
|
|
305
305
|
*/
|
|
306
306
|
headerLeft?:
|
|
307
307
|
| ((props: NativeStackHeaderBackProps) => React.ReactNode)
|
|
@@ -317,7 +317,7 @@ export type NativeStackNavigationOptions = {
|
|
|
317
317
|
headerLeftBackgroundVisible?: boolean | undefined;
|
|
318
318
|
/**
|
|
319
319
|
* Function which returns a React Element to display on the right side of the header.
|
|
320
|
-
* Will be
|
|
320
|
+
* Will be overridden by `headerRightItems` on iOS.
|
|
321
321
|
*/
|
|
322
322
|
headerRight?:
|
|
323
323
|
| ((props: NativeStackHeaderItemProps) => React.ReactNode)
|
|
@@ -574,7 +574,7 @@ export type NativeStackNavigationOptions = {
|
|
|
574
574
|
*/
|
|
575
575
|
gestureResponseDistance?: ScreenProps['gestureResponseDistance'] | undefined;
|
|
576
576
|
/**
|
|
577
|
-
* The type of animation to use when this screen replaces another screen. Defaults to `
|
|
577
|
+
* The type of animation to use when this screen replaces another screen. Defaults to `push`.
|
|
578
578
|
*
|
|
579
579
|
* Supported values:
|
|
580
580
|
* - "push": the new screen will perform push animation.
|