@react-navigation/stack 6.3.14 → 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/navigators/createStackNavigator.js +1 -21
- package/lib/commonjs/navigators/createStackNavigator.js.map +1 -1
- package/lib/commonjs/utils/conditional.js.map +1 -1
- package/lib/commonjs/utils/debounce.js +0 -1
- package/lib/commonjs/utils/debounce.js.map +1 -1
- package/lib/commonjs/views/Header/HeaderSegment.js.map +1 -1
- package/lib/commonjs/views/Stack/Card.js.map +1 -1
- package/lib/commonjs/views/Stack/CardStack.js.map +1 -1
- package/lib/commonjs/views/Stack/StackView.js +8 -1
- package/lib/commonjs/views/Stack/StackView.js.map +1 -1
- package/lib/module/navigators/createStackNavigator.js +1 -21
- package/lib/module/navigators/createStackNavigator.js.map +1 -1
- package/lib/module/utils/conditional.js.map +1 -1
- package/lib/module/utils/debounce.js +0 -1
- package/lib/module/utils/debounce.js.map +1 -1
- package/lib/module/views/Header/HeaderSegment.js.map +1 -1
- package/lib/module/views/Stack/Card.js.map +1 -1
- package/lib/module/views/Stack/CardStack.js.map +1 -1
- package/lib/module/views/Stack/StackView.js +9 -2
- package/lib/module/views/Stack/StackView.js.map +1 -1
- package/lib/typescript/src/navigators/createStackNavigator.d.ts +7 -2
- package/lib/typescript/src/navigators/createStackNavigator.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +36 -36
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/conditional.d.ts +1 -1
- package/lib/typescript/src/utils/conditional.d.ts.map +1 -1
- package/lib/typescript/src/utils/debounce.d.ts.map +1 -1
- package/lib/typescript/src/views/Header/HeaderContainer.d.ts +1 -1
- package/lib/typescript/src/views/Header/HeaderContainer.d.ts.map +1 -1
- package/lib/typescript/src/views/Header/HeaderSegment.d.ts +1 -1
- package/lib/typescript/src/views/Header/HeaderSegment.d.ts.map +1 -1
- package/lib/typescript/src/views/ModalStatusBarManager.d.ts +1 -1
- package/lib/typescript/src/views/ModalStatusBarManager.d.ts.map +1 -1
- package/lib/typescript/src/views/Screens.d.ts +1 -1
- package/lib/typescript/src/views/Screens.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/Card.d.ts +3 -3
- package/lib/typescript/src/views/Stack/Card.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/CardContainer.d.ts +1 -1
- package/lib/typescript/src/views/Stack/CardContainer.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/CardSheet.d.ts +1 -1
- package/lib/typescript/src/views/Stack/CardSheet.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/CardStack.d.ts +3 -3
- package/lib/typescript/src/views/Stack/CardStack.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/StackView.d.ts +2 -2
- package/lib/typescript/src/views/Stack/StackView.d.ts.map +1 -1
- package/package.json +15 -16
- package/src/navigators/createStackNavigator.tsx +0 -39
- package/src/types.tsx +11 -11
- package/src/utils/conditional.tsx +3 -3
- package/src/utils/debounce.tsx +0 -1
- package/src/views/Header/HeaderSegment.tsx +2 -2
- package/src/views/Screens.tsx +1 -1
- package/src/views/Stack/Card.tsx +4 -4
- package/src/views/Stack/CardStack.tsx +6 -1
- package/src/views/Stack/StackView.tsx +13 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ViewProps } from 'react-native';
|
|
3
|
-
export
|
|
3
|
+
export type CardSheetRef = {
|
|
4
4
|
setPointerEvents: React.Dispatch<ViewProps['pointerEvents']>;
|
|
5
5
|
};
|
|
6
6
|
declare const _default: React.ForwardRefExoticComponent<ViewProps & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardSheet.d.ts","sourceRoot":"","sources":["../../../../../src/views/Stack/CardSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAoB,SAAS,EAAE,MAAM,cAAc,CAAC;AAQ3D,
|
|
1
|
+
{"version":3,"file":"CardSheet.d.ts","sourceRoot":"","sources":["../../../../../src/views/Stack/CardSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAoB,SAAS,EAAE,MAAM,cAAc,CAAC;AAQ3D,MAAM,MAAM,YAAY,GAAG;IACzB,gBAAgB,EAAE,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC;CAC9D,CAAC;;;;;;;;;AAMF,wBAiCG"}
|
|
@@ -4,10 +4,10 @@ import { Animated } from 'react-native';
|
|
|
4
4
|
import type { EdgeInsets } from 'react-native-safe-area-context';
|
|
5
5
|
import type { Layout, Scene, StackDescriptorMap } from '../../types';
|
|
6
6
|
import type { Props as HeaderContainerProps } from '../Header/HeaderContainer';
|
|
7
|
-
|
|
7
|
+
type GestureValues = {
|
|
8
8
|
[key: string]: Animated.Value;
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
type Props = {
|
|
11
11
|
insets: EdgeInsets;
|
|
12
12
|
state: StackNavigationState<ParamListBase>;
|
|
13
13
|
descriptors: StackDescriptorMap;
|
|
@@ -46,7 +46,7 @@ declare type Props = {
|
|
|
46
46
|
}) => void;
|
|
47
47
|
detachInactiveScreens?: boolean;
|
|
48
48
|
};
|
|
49
|
-
|
|
49
|
+
type State = {
|
|
50
50
|
routes: Route<string>[];
|
|
51
51
|
descriptors: StackDescriptorMap;
|
|
52
52
|
scenes: Scene[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardStack.d.ts","sourceRoot":"","sources":["../../../../../src/views/Stack/CardStack.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,aAAa,EACb,KAAK,EACL,oBAAoB,EACrB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,QAAQ,EAIT,MAAM,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AAK,EAAE,CAAC;IAChB,QAAQ,EAAE,aAAa,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC,CAAC;AAyHF,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC;IAClE,MAAM,CAAC,wBAAwB,CAC7B,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,GACX,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI;gBAiLZ,KAAK,EAAE,KAAK;IAkBxB,OAAO,CAAC,YAAY,CAsBlB;IAEF,OAAO,CAAC,kBAAkB,CAqBxB;IAEF,OAAO,CAAC,eAAe,CAIrB;IAEF,OAAO,CAAC,gBAAgB,CAetB;IAEF,MAAM;CAmPP"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ParamListBase, Route, StackNavigationState } from '@react-navigation/native';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import type { StackDescriptorMap, StackNavigationConfig, StackNavigationHelpers } from '../../types';
|
|
4
|
-
|
|
4
|
+
type Props = StackNavigationConfig & {
|
|
5
5
|
state: StackNavigationState<ParamListBase>;
|
|
6
6
|
navigation: StackNavigationHelpers;
|
|
7
7
|
descriptors: StackDescriptorMap;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
type State = {
|
|
10
10
|
routes: Route<string>[];
|
|
11
11
|
previousRoutes: Route<string>[];
|
|
12
12
|
previousDescriptors: StackDescriptorMap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StackView.d.ts","sourceRoot":"","sources":["../../../../../src/views/Stack/StackView.tsx"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"StackView.d.ts","sourceRoot":"","sources":["../../../../../src/views/Stack/StackView.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,aAAa,EACb,KAAK,EA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CAQtB;IAEL,OAAO,CAAC,kBAAkB,CAKxB;IAEF,OAAO,CAAC,gBAAgB,CAKtB;IAEF,OAAO,CAAC,mBAAmB,CAKzB;IAEF,MAAM;CAmDP"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-navigation/stack",
|
|
3
3
|
"description": "Stack navigator component for iOS and Android with animated transitions and gestures",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "7.0.0-alpha.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native-component",
|
|
7
7
|
"react-component",
|
|
@@ -40,24 +40,23 @@
|
|
|
40
40
|
"clean": "del lib"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@react-navigation/elements": "^1.3.
|
|
44
|
-
"color": "^4.2.3"
|
|
45
|
-
"warn-once": "^0.1.0"
|
|
43
|
+
"@react-navigation/elements": "^1.3.9-alpha.0",
|
|
44
|
+
"color": "^4.2.3"
|
|
46
45
|
},
|
|
47
46
|
"devDependencies": {
|
|
48
|
-
"@react-navigation/native": "^
|
|
47
|
+
"@react-navigation/native": "^7.0.0-alpha.0",
|
|
49
48
|
"@testing-library/react-native": "^11.5.0",
|
|
50
|
-
"@types/color": "^3.0.
|
|
51
|
-
"@types/react": "~18.0.
|
|
52
|
-
"@types/react-native": "~0.
|
|
53
|
-
"del-cli": "^
|
|
54
|
-
"react": "18.
|
|
55
|
-
"react-native": "0.
|
|
49
|
+
"@types/color": "^3.0.3",
|
|
50
|
+
"@types/react": "~18.0.26",
|
|
51
|
+
"@types/react-native": "~0.70.8",
|
|
52
|
+
"del-cli": "^5.0.0",
|
|
53
|
+
"react": "18.1.0",
|
|
54
|
+
"react-native": "0.70.5",
|
|
56
55
|
"react-native-builder-bob": "^0.20.3",
|
|
57
|
-
"react-native-gesture-handler": "~2.
|
|
58
|
-
"react-native-safe-area-context": "4.
|
|
59
|
-
"react-native-screens": "~3.
|
|
60
|
-
"typescript": "^4.
|
|
56
|
+
"react-native-gesture-handler": "~2.8.0",
|
|
57
|
+
"react-native-safe-area-context": "4.4.1",
|
|
58
|
+
"react-native-screens": "~3.18.0",
|
|
59
|
+
"typescript": "^4.9.4"
|
|
61
60
|
},
|
|
62
61
|
"peerDependencies": {
|
|
63
62
|
"@react-navigation/native": "^6.0.0",
|
|
@@ -81,5 +80,5 @@
|
|
|
81
80
|
]
|
|
82
81
|
]
|
|
83
82
|
},
|
|
84
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "ad722b882e0c40b1d1bc025d70112ddb126f265e"
|
|
85
84
|
}
|
|
@@ -11,10 +11,8 @@ import {
|
|
|
11
11
|
useNavigationBuilder,
|
|
12
12
|
} from '@react-navigation/native';
|
|
13
13
|
import * as React from 'react';
|
|
14
|
-
import warnOnce from 'warn-once';
|
|
15
14
|
|
|
16
15
|
import type {
|
|
17
|
-
StackHeaderMode,
|
|
18
16
|
StackNavigationConfig,
|
|
19
17
|
StackNavigationEventMap,
|
|
20
18
|
StackNavigationOptions,
|
|
@@ -38,42 +36,6 @@ function StackNavigator({
|
|
|
38
36
|
screenOptions,
|
|
39
37
|
...rest
|
|
40
38
|
}: Props) {
|
|
41
|
-
// @ts-expect-error: mode is deprecated
|
|
42
|
-
const mode = rest.mode as 'card' | 'modal' | undefined;
|
|
43
|
-
|
|
44
|
-
warnOnce(
|
|
45
|
-
mode != null,
|
|
46
|
-
`Stack Navigator: 'mode="${mode}"' is deprecated. Use 'presentation: "${mode}"' in 'screenOptions' instead.\n\nSee https://reactnavigation.org/docs/stack-navigator#presentation for more details.`
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
// @ts-expect-error: headerMode='none' is deprecated
|
|
50
|
-
const headerMode = rest.headerMode as StackHeaderMode | 'none' | undefined;
|
|
51
|
-
|
|
52
|
-
warnOnce(
|
|
53
|
-
headerMode === 'none',
|
|
54
|
-
`Stack Navigator: 'headerMode="none"' is deprecated. Use 'headerShown: false' in 'screenOptions' instead.\n\nSee https://reactnavigation.org/docs/stack-navigator/#headershown for more details.`
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
warnOnce(
|
|
58
|
-
headerMode != null && headerMode !== 'none',
|
|
59
|
-
`Stack Navigator: 'headerMode' is moved to 'options'. Moved it to 'screenOptions' to keep current behavior.\n\nSee https://reactnavigation.org/docs/stack-navigator/#headermode for more details.`
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
// @ts-expect-error: headerMode='none' is deprecated
|
|
63
|
-
const keyboardHandlingEnabled = rest.keyboardHandlingEnabled;
|
|
64
|
-
|
|
65
|
-
warnOnce(
|
|
66
|
-
keyboardHandlingEnabled !== undefined,
|
|
67
|
-
`Stack Navigator: 'keyboardHandlingEnabled' is moved to 'options'. Moved it to 'screenOptions' to keep current behavior.\n\nSee https://reactnavigation.org/docs/stack-navigator/#keyboardhandlingenabled for more details.`
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
const defaultScreenOptions: StackNavigationOptions = {
|
|
71
|
-
presentation: mode,
|
|
72
|
-
headerShown: headerMode ? headerMode !== 'none' : true,
|
|
73
|
-
headerMode: headerMode && headerMode !== 'none' ? headerMode : undefined,
|
|
74
|
-
keyboardHandlingEnabled,
|
|
75
|
-
};
|
|
76
|
-
|
|
77
39
|
const { state, descriptors, navigation, NavigationContent } =
|
|
78
40
|
useNavigationBuilder<
|
|
79
41
|
StackNavigationState<ParamListBase>,
|
|
@@ -87,7 +49,6 @@ function StackNavigator({
|
|
|
87
49
|
children,
|
|
88
50
|
screenListeners,
|
|
89
51
|
screenOptions,
|
|
90
|
-
defaultScreenOptions,
|
|
91
52
|
});
|
|
92
53
|
|
|
93
54
|
React.useEffect(
|
package/src/types.tsx
CHANGED
|
@@ -107,17 +107,17 @@ export type SceneProgress = {
|
|
|
107
107
|
/**
|
|
108
108
|
* Progress value of the current screen.
|
|
109
109
|
*/
|
|
110
|
-
current: Animated.AnimatedInterpolation
|
|
110
|
+
current: Animated.AnimatedInterpolation<number>;
|
|
111
111
|
/**
|
|
112
112
|
* Progress value for the screen after this one in the stack.
|
|
113
113
|
* This can be `undefined` in case the screen animating is the last one.
|
|
114
114
|
*/
|
|
115
|
-
next?: Animated.AnimatedInterpolation
|
|
115
|
+
next?: Animated.AnimatedInterpolation<number>;
|
|
116
116
|
/**
|
|
117
117
|
* Progress value for the screen before this one in the stack.
|
|
118
118
|
* This can be `undefined` in case the screen animating is the first one.
|
|
119
119
|
*/
|
|
120
|
-
previous?: Animated.AnimatedInterpolation
|
|
120
|
+
previous?: Animated.AnimatedInterpolation<number>;
|
|
121
121
|
};
|
|
122
122
|
|
|
123
123
|
export type StackHeaderMode = 'float' | 'screen';
|
|
@@ -165,7 +165,7 @@ export type StackHeaderOptions = Omit<
|
|
|
165
165
|
/**
|
|
166
166
|
* Whether the back button title should be visible or not.
|
|
167
167
|
*
|
|
168
|
-
* Defaults to `true` on iOS, `false
|
|
168
|
+
* Defaults to `true` on iOS, `false on Android.
|
|
169
169
|
*/
|
|
170
170
|
headerBackTitleVisible?: boolean;
|
|
171
171
|
/**
|
|
@@ -377,7 +377,7 @@ export type StackCardInterpolationProps = {
|
|
|
377
377
|
/**
|
|
378
378
|
* Animated node representing the progress value of the current screen.
|
|
379
379
|
*/
|
|
380
|
-
progress: Animated.AnimatedInterpolation
|
|
380
|
+
progress: Animated.AnimatedInterpolation<number>;
|
|
381
381
|
};
|
|
382
382
|
/**
|
|
383
383
|
* Values for the screen after this one in the stack.
|
|
@@ -387,7 +387,7 @@ export type StackCardInterpolationProps = {
|
|
|
387
387
|
/**
|
|
388
388
|
* Animated node representing the progress value of the next screen.
|
|
389
389
|
*/
|
|
390
|
-
progress: Animated.AnimatedInterpolation
|
|
390
|
+
progress: Animated.AnimatedInterpolation<number>;
|
|
391
391
|
};
|
|
392
392
|
/**
|
|
393
393
|
* The index of the card with this interpolation in the stack.
|
|
@@ -396,15 +396,15 @@ export type StackCardInterpolationProps = {
|
|
|
396
396
|
/**
|
|
397
397
|
* Animated node representing whether the card is closing (1 - closing, 0 - not closing).
|
|
398
398
|
*/
|
|
399
|
-
closing: Animated.AnimatedInterpolation
|
|
399
|
+
closing: Animated.AnimatedInterpolation<0 | 1>;
|
|
400
400
|
/**
|
|
401
401
|
* Animated node representing whether the card is being swiped (1 - swiping, 0 - not swiping).
|
|
402
402
|
*/
|
|
403
|
-
swiping: Animated.AnimatedInterpolation
|
|
403
|
+
swiping: Animated.AnimatedInterpolation<0 | 1>;
|
|
404
404
|
/**
|
|
405
405
|
* Animated node representing multiplier when direction is inverted (-1 - inverted, 1 - normal).
|
|
406
406
|
*/
|
|
407
|
-
inverted: Animated.AnimatedInterpolation
|
|
407
|
+
inverted: Animated.AnimatedInterpolation<1 | -1>;
|
|
408
408
|
/**
|
|
409
409
|
* Layout measurements for various items we use for animation.
|
|
410
410
|
*/
|
|
@@ -456,7 +456,7 @@ export type StackHeaderInterpolationProps = {
|
|
|
456
456
|
/**
|
|
457
457
|
* Animated node representing the progress value of the current screen.
|
|
458
458
|
*/
|
|
459
|
-
progress: Animated.AnimatedInterpolation
|
|
459
|
+
progress: Animated.AnimatedInterpolation<number>;
|
|
460
460
|
};
|
|
461
461
|
/**
|
|
462
462
|
* Values for the screen after this one in the stack.
|
|
@@ -466,7 +466,7 @@ export type StackHeaderInterpolationProps = {
|
|
|
466
466
|
/**
|
|
467
467
|
* Animated node representing the progress value of the next screen.
|
|
468
468
|
*/
|
|
469
|
-
progress: Animated.AnimatedInterpolation
|
|
469
|
+
progress: Animated.AnimatedInterpolation<number>;
|
|
470
470
|
};
|
|
471
471
|
/**
|
|
472
472
|
* Layout measurements for various items we use for animation.
|
|
@@ -10,9 +10,9 @@ const { add, multiply } = Animated;
|
|
|
10
10
|
* @param fallback Animated Node to use if the condition is `false`
|
|
11
11
|
*/
|
|
12
12
|
export default function conditional(
|
|
13
|
-
condition: Animated.AnimatedInterpolation
|
|
14
|
-
main: Animated.AnimatedInterpolation
|
|
15
|
-
fallback: Animated.AnimatedInterpolation
|
|
13
|
+
condition: Animated.AnimatedInterpolation<0 | 1>,
|
|
14
|
+
main: Animated.AnimatedInterpolation<number>,
|
|
15
|
+
fallback: Animated.AnimatedInterpolation<number>
|
|
16
16
|
) {
|
|
17
17
|
// To implement this behavior, we multiply the main node with the condition.
|
|
18
18
|
// So if condition is 0, result will be 0, and if condition is 1, result will be main node.
|
package/src/utils/debounce.tsx
CHANGED
|
@@ -75,8 +75,8 @@ export default function HeaderSegment(props: Props) {
|
|
|
75
75
|
(
|
|
76
76
|
styleInterpolator: StackHeaderStyleInterpolator,
|
|
77
77
|
layout: Layout,
|
|
78
|
-
current: Animated.AnimatedInterpolation
|
|
79
|
-
next: Animated.AnimatedInterpolation | undefined,
|
|
78
|
+
current: Animated.AnimatedInterpolation<number>,
|
|
79
|
+
next: Animated.AnimatedInterpolation<number> | undefined,
|
|
80
80
|
titleLayout: Layout | undefined,
|
|
81
81
|
leftLabelLayout: Layout | undefined,
|
|
82
82
|
headerHeight: number
|
package/src/views/Screens.tsx
CHANGED
package/src/views/Stack/Card.tsx
CHANGED
|
@@ -35,8 +35,8 @@ import CardSheet, { CardSheetRef } from './CardSheet';
|
|
|
35
35
|
type Props = ViewProps & {
|
|
36
36
|
interpolationIndex: number;
|
|
37
37
|
closing: boolean;
|
|
38
|
-
next?: Animated.AnimatedInterpolation
|
|
39
|
-
current: Animated.AnimatedInterpolation
|
|
38
|
+
next?: Animated.AnimatedInterpolation<number>;
|
|
39
|
+
current: Animated.AnimatedInterpolation<number>;
|
|
40
40
|
gesture: Animated.Value;
|
|
41
41
|
layout: Layout;
|
|
42
42
|
insets: EdgeInsets;
|
|
@@ -351,8 +351,8 @@ export default class Card extends React.Component<Props> {
|
|
|
351
351
|
private getCardAnimation = memoize(
|
|
352
352
|
(
|
|
353
353
|
interpolationIndex: number,
|
|
354
|
-
current: Animated.AnimatedInterpolation
|
|
355
|
-
next: Animated.AnimatedInterpolation | undefined,
|
|
354
|
+
current: Animated.AnimatedInterpolation<number>,
|
|
355
|
+
next: Animated.AnimatedInterpolation<number> | undefined,
|
|
356
356
|
layout: Layout,
|
|
357
357
|
insetTop: number,
|
|
358
358
|
insetRight: number,
|
|
@@ -51,6 +51,7 @@ type Props = {
|
|
|
51
51
|
state: StackNavigationState<ParamListBase>;
|
|
52
52
|
descriptors: StackDescriptorMap;
|
|
53
53
|
routes: Route<string>[];
|
|
54
|
+
// eslint-disable-next-line react/no-unused-prop-types
|
|
54
55
|
openingRouteKeys: string[];
|
|
55
56
|
closingRouteKeys: string[];
|
|
56
57
|
onOpenRoute: (props: { route: Route<string> }) => void;
|
|
@@ -583,7 +584,11 @@ export default class CardStack extends React.Component<Props, State> {
|
|
|
583
584
|
// For those that should be active, but are not the top screen, the value is 1
|
|
584
585
|
// For those on top of the stack and with interaction enabled, the value is 2
|
|
585
586
|
// For the old implementation, it stays the same it was
|
|
586
|
-
let isScreenActive:
|
|
587
|
+
let isScreenActive:
|
|
588
|
+
| Animated.AnimatedInterpolation<0 | 1 | 2>
|
|
589
|
+
| 0
|
|
590
|
+
| 1
|
|
591
|
+
| 2 = 1;
|
|
587
592
|
|
|
588
593
|
if (index < self.length - activeScreensLimit - 1) {
|
|
589
594
|
// screen should be inactive because it is too deep in the stack
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
SafeAreaProviderCompat,
|
|
4
4
|
} from '@react-navigation/elements';
|
|
5
5
|
import {
|
|
6
|
+
CommonActions,
|
|
6
7
|
ParamListBase,
|
|
7
8
|
Route,
|
|
8
9
|
StackActions,
|
|
@@ -328,7 +329,18 @@ export default class StackView extends React.Component<Props, State> {
|
|
|
328
329
|
) {
|
|
329
330
|
// If route isn't present in current state, but was closing, assume that a close animation was cancelled
|
|
330
331
|
// So we need to add this route back to the state
|
|
331
|
-
navigation.
|
|
332
|
+
navigation.dispatch((state) => {
|
|
333
|
+
const routes = [
|
|
334
|
+
...state.routes.filter((r) => r.key !== route.key),
|
|
335
|
+
route,
|
|
336
|
+
];
|
|
337
|
+
|
|
338
|
+
return CommonActions.reset({
|
|
339
|
+
...state,
|
|
340
|
+
routes,
|
|
341
|
+
index: routes.length - 1,
|
|
342
|
+
});
|
|
343
|
+
});
|
|
332
344
|
} else {
|
|
333
345
|
this.setState((state) => ({
|
|
334
346
|
routes: state.replacingRouteKeys.length
|