@react-navigation/stack 6.3.16 → 7.0.0-alpha.1
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/TransitionConfigs/CardStyleInterpolators.js +4 -5
- package/lib/commonjs/TransitionConfigs/CardStyleInterpolators.js.map +1 -1
- package/lib/commonjs/index.js +14 -15
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/navigators/createStackNavigator.js +6 -27
- package/lib/commonjs/navigators/createStackNavigator.js.map +1 -1
- package/lib/commonjs/utils/CardAnimationContext.js +3 -3
- package/lib/commonjs/utils/CardAnimationContext.js.map +1 -1
- package/lib/commonjs/utils/GestureHandlerRefContext.js +3 -3
- package/lib/commonjs/utils/GestureHandlerRefContext.js.map +1 -1
- package/lib/commonjs/utils/ModalPresentationContext.js +2 -3
- package/lib/commonjs/utils/ModalPresentationContext.js.map +1 -1
- package/lib/commonjs/utils/conditional.js +1 -1
- package/lib/commonjs/utils/conditional.js.map +1 -1
- package/lib/commonjs/utils/debounce.js +1 -2
- package/lib/commonjs/utils/debounce.js.map +1 -1
- package/lib/commonjs/utils/findLastIndex.js +1 -1
- package/lib/commonjs/utils/findLastIndex.js.map +1 -1
- package/lib/commonjs/utils/getDistanceForDirection.js +3 -4
- package/lib/commonjs/utils/getDistanceForDirection.js.map +1 -1
- package/lib/commonjs/utils/getInvertedMultiplier.js +1 -1
- package/lib/commonjs/utils/getInvertedMultiplier.js.map +1 -1
- package/lib/commonjs/utils/memoize.js +1 -1
- package/lib/commonjs/utils/memoize.js.map +1 -1
- package/lib/commonjs/utils/useCardAnimation.js +3 -4
- package/lib/commonjs/utils/useCardAnimation.js.map +1 -1
- package/lib/commonjs/utils/useGestureHandlerRef.js +3 -4
- package/lib/commonjs/utils/useGestureHandlerRef.js.map +1 -1
- package/lib/commonjs/utils/useKeyboardManager.js +1 -1
- package/lib/commonjs/utils/useKeyboardManager.js.map +1 -1
- package/lib/commonjs/views/GestureHandlerNative.js +2 -3
- package/lib/commonjs/views/GestureHandlerNative.js.map +1 -1
- package/lib/commonjs/views/Header/Header.js +9 -10
- package/lib/commonjs/views/Header/Header.js.map +1 -1
- package/lib/commonjs/views/Header/HeaderContainer.js +3 -4
- package/lib/commonjs/views/Header/HeaderContainer.js.map +1 -1
- package/lib/commonjs/views/Header/HeaderSegment.js +3 -4
- package/lib/commonjs/views/Header/HeaderSegment.js.map +1 -1
- package/lib/commonjs/views/ModalStatusBarManager.js +1 -1
- package/lib/commonjs/views/ModalStatusBarManager.js.map +1 -1
- package/lib/commonjs/views/Stack/Card.js +18 -18
- package/lib/commonjs/views/Stack/Card.js.map +1 -1
- package/lib/commonjs/views/Stack/CardContainer.js +10 -11
- package/lib/commonjs/views/Stack/CardContainer.js.map +1 -1
- package/lib/commonjs/views/Stack/CardSheet.js +3 -3
- package/lib/commonjs/views/Stack/CardSheet.js.map +1 -1
- package/lib/commonjs/views/Stack/CardStack.js +8 -8
- package/lib/commonjs/views/Stack/CardStack.js.map +1 -1
- package/lib/commonjs/views/Stack/StackView.js +15 -9
- package/lib/commonjs/views/Stack/StackView.js.map +1 -1
- package/lib/module/TransitionConfigs/CardStyleInterpolators.js +1 -1
- package/lib/module/TransitionConfigs/CardStyleInterpolators.js.map +1 -1
- package/lib/module/index.js +7 -7
- package/lib/module/index.js.map +1 -1
- package/lib/module/navigators/createStackNavigator.js +3 -23
- package/lib/module/navigators/createStackNavigator.js.map +1 -1
- package/lib/module/utils/CardAnimationContext.js +1 -1
- package/lib/module/utils/CardAnimationContext.js.map +1 -1
- package/lib/module/utils/GestureHandlerRefContext.js +1 -1
- package/lib/module/utils/GestureHandlerRefContext.js.map +1 -1
- package/lib/module/utils/ModalPresentationContext.js +1 -2
- package/lib/module/utils/ModalPresentationContext.js.map +1 -1
- package/lib/module/utils/conditional.js +1 -1
- package/lib/module/utils/conditional.js.map +1 -1
- package/lib/module/utils/debounce.js +1 -2
- package/lib/module/utils/debounce.js.map +1 -1
- package/lib/module/utils/findLastIndex.js +1 -1
- package/lib/module/utils/findLastIndex.js.map +1 -1
- package/lib/module/utils/getDistanceForDirection.js +2 -2
- package/lib/module/utils/getDistanceForDirection.js.map +1 -1
- package/lib/module/utils/getInvertedMultiplier.js +1 -1
- package/lib/module/utils/getInvertedMultiplier.js.map +1 -1
- package/lib/module/utils/memoize.js +1 -1
- package/lib/module/utils/memoize.js.map +1 -1
- package/lib/module/utils/useCardAnimation.js +2 -2
- package/lib/module/utils/useCardAnimation.js.map +1 -1
- package/lib/module/utils/useGestureHandlerRef.js +3 -3
- package/lib/module/utils/useGestureHandlerRef.js.map +1 -1
- package/lib/module/utils/useKeyboardManager.js +1 -1
- package/lib/module/utils/useKeyboardManager.js.map +1 -1
- package/lib/module/views/GestureHandlerNative.js +1 -1
- package/lib/module/views/GestureHandlerNative.js.map +1 -1
- package/lib/module/views/Header/Header.js +4 -4
- package/lib/module/views/Header/Header.js.map +1 -1
- package/lib/module/views/Header/HeaderContainer.js +2 -2
- package/lib/module/views/Header/HeaderContainer.js.map +1 -1
- package/lib/module/views/Header/HeaderSegment.js +2 -2
- package/lib/module/views/Header/HeaderSegment.js.map +1 -1
- package/lib/module/views/ModalStatusBarManager.js +1 -1
- package/lib/module/views/ModalStatusBarManager.js.map +1 -1
- package/lib/module/views/Stack/Card.js +7 -7
- package/lib/module/views/Stack/Card.js.map +1 -1
- package/lib/module/views/Stack/CardContainer.js +5 -5
- package/lib/module/views/Stack/CardContainer.js.map +1 -1
- package/lib/module/views/Stack/CardSheet.js +1 -1
- package/lib/module/views/Stack/CardSheet.js.map +1 -1
- package/lib/module/views/Stack/CardStack.js +4 -4
- package/lib/module/views/Stack/CardStack.js.map +1 -1
- package/lib/module/views/Stack/StackView.js +13 -6
- package/lib/module/views/Stack/StackView.js.map +1 -1
- package/lib/typescript/src/index.d.ts +7 -7
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/navigators/createStackNavigator.d.ts +8 -3
- 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/CardAnimationContext.d.ts +1 -2
- package/lib/typescript/src/utils/CardAnimationContext.d.ts.map +1 -1
- package/lib/typescript/src/utils/GestureHandlerRefContext.d.ts +1 -2
- package/lib/typescript/src/utils/GestureHandlerRefContext.d.ts.map +1 -1
- package/lib/typescript/src/utils/ModalPresentationContext.d.ts +1 -2
- package/lib/typescript/src/utils/ModalPresentationContext.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 +1 -1
- package/lib/typescript/src/utils/debounce.d.ts.map +1 -1
- package/lib/typescript/src/utils/findLastIndex.d.ts +1 -1
- package/lib/typescript/src/utils/findLastIndex.d.ts.map +1 -1
- package/lib/typescript/src/utils/getDistanceForDirection.d.ts +1 -1
- package/lib/typescript/src/utils/getDistanceForDirection.d.ts.map +1 -1
- package/lib/typescript/src/utils/getInvertedMultiplier.d.ts +1 -1
- package/lib/typescript/src/utils/getInvertedMultiplier.d.ts.map +1 -1
- package/lib/typescript/src/utils/memoize.d.ts +1 -1
- package/lib/typescript/src/utils/memoize.d.ts.map +1 -1
- package/lib/typescript/src/utils/useCardAnimation.d.ts +1 -1
- package/lib/typescript/src/utils/useCardAnimation.d.ts.map +1 -1
- package/lib/typescript/src/utils/useGestureHandlerRef.d.ts +1 -1
- package/lib/typescript/src/utils/useGestureHandlerRef.d.ts.map +1 -1
- package/lib/typescript/src/utils/useKeyboardManager.d.ts +1 -1
- package/lib/typescript/src/utils/useKeyboardManager.d.ts.map +1 -1
- package/lib/typescript/src/views/Header/Header.d.ts +1 -2
- package/lib/typescript/src/views/Header/Header.d.ts.map +1 -1
- package/lib/typescript/src/views/Header/HeaderContainer.d.ts +2 -2
- package/lib/typescript/src/views/Header/HeaderContainer.d.ts.map +1 -1
- package/lib/typescript/src/views/Header/HeaderSegment.d.ts +2 -2
- package/lib/typescript/src/views/Header/HeaderSegment.d.ts.map +1 -1
- package/lib/typescript/src/views/ModalStatusBarManager.d.ts +2 -2
- 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 +4 -4
- package/lib/typescript/src/views/Stack/Card.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/CardContainer.d.ts +4 -4
- package/lib/typescript/src/views/Stack/CardContainer.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/CardSheet.d.ts +2 -3
- package/lib/typescript/src/views/Stack/CardSheet.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/CardStack.d.ts +4 -4
- package/lib/typescript/src/views/Stack/CardStack.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/StackView.d.ts +3 -3
- package/lib/typescript/src/views/Stack/StackView.d.ts.map +1 -1
- package/package.json +15 -16
- package/src/TransitionConfigs/CardStyleInterpolators.tsx +1 -1
- package/src/index.tsx +7 -7
- package/src/navigators/createStackNavigator.tsx +2 -41
- package/src/types.tsx +11 -11
- package/src/utils/CardAnimationContext.tsx +3 -3
- package/src/utils/GestureHandlerRefContext.tsx +1 -1
- package/src/utils/ModalPresentationContext.tsx +1 -3
- package/src/utils/conditional.tsx +4 -4
- package/src/utils/debounce.tsx +1 -2
- package/src/utils/findLastIndex.tsx +1 -4
- package/src/utils/getDistanceForDirection.tsx +2 -2
- package/src/utils/getInvertedMultiplier.tsx +1 -1
- package/src/utils/memoize.tsx +1 -1
- package/src/utils/useCardAnimation.tsx +2 -2
- package/src/utils/useGestureHandlerRef.tsx +3 -3
- package/src/utils/useKeyboardManager.tsx +1 -1
- package/src/views/GestureHandlerNative.tsx +1 -1
- package/src/views/Header/Header.tsx +4 -4
- package/src/views/Header/HeaderContainer.tsx +2 -2
- package/src/views/Header/HeaderSegment.tsx +4 -4
- package/src/views/ModalStatusBarManager.tsx +1 -6
- package/src/views/Screens.tsx +1 -1
- package/src/views/Stack/Card.tsx +11 -11
- package/src/views/Stack/CardContainer.tsx +5 -5
- package/src/views/Stack/CardSheet.tsx +33 -34
- package/src/views/Stack/CardStack.tsx +10 -5
- package/src/views/Stack/StackView.tsx +18 -5
package/src/views/Screens.tsx
CHANGED
package/src/views/Stack/Card.tsx
CHANGED
|
@@ -20,23 +20,23 @@ import type {
|
|
|
20
20
|
StackCardStyleInterpolator,
|
|
21
21
|
TransitionSpec,
|
|
22
22
|
} from '../../types';
|
|
23
|
-
import CardAnimationContext from '../../utils/CardAnimationContext';
|
|
24
|
-
import getDistanceForDirection from '../../utils/getDistanceForDirection';
|
|
25
|
-
import getInvertedMultiplier from '../../utils/getInvertedMultiplier';
|
|
26
|
-
import memoize from '../../utils/memoize';
|
|
23
|
+
import { CardAnimationContext } from '../../utils/CardAnimationContext';
|
|
24
|
+
import { getDistanceForDirection } from '../../utils/getDistanceForDirection';
|
|
25
|
+
import { getInvertedMultiplier } from '../../utils/getInvertedMultiplier';
|
|
26
|
+
import { memoize } from '../../utils/memoize';
|
|
27
27
|
import {
|
|
28
28
|
GestureState,
|
|
29
29
|
PanGestureHandler,
|
|
30
30
|
PanGestureHandlerGestureEvent,
|
|
31
31
|
} from '../GestureHandler';
|
|
32
|
-
import ModalStatusBarManager from '../ModalStatusBarManager';
|
|
33
|
-
import CardSheet,
|
|
32
|
+
import { ModalStatusBarManager } from '../ModalStatusBarManager';
|
|
33
|
+
import { CardSheet, CardSheetRef } from './CardSheet';
|
|
34
34
|
|
|
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;
|
|
@@ -89,7 +89,7 @@ const hasOpacityStyle = (style: any) => {
|
|
|
89
89
|
return false;
|
|
90
90
|
};
|
|
91
91
|
|
|
92
|
-
export
|
|
92
|
+
export class Card extends React.Component<Props> {
|
|
93
93
|
static defaultProps = {
|
|
94
94
|
shadowEnabled: false,
|
|
95
95
|
gestureEnabled: true,
|
|
@@ -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,
|
|
@@ -9,10 +9,10 @@ import * as React from 'react';
|
|
|
9
9
|
import { Animated, StyleSheet, View } from 'react-native';
|
|
10
10
|
|
|
11
11
|
import type { Layout, Scene } from '../../types';
|
|
12
|
-
import ModalPresentationContext from '../../utils/ModalPresentationContext';
|
|
13
|
-
import useKeyboardManager from '../../utils/useKeyboardManager';
|
|
12
|
+
import { ModalPresentationContext } from '../../utils/ModalPresentationContext';
|
|
13
|
+
import { useKeyboardManager } from '../../utils/useKeyboardManager';
|
|
14
14
|
import type { Props as HeaderContainerProps } from '../Header/HeaderContainer';
|
|
15
|
-
import Card from './Card';
|
|
15
|
+
import { Card } from './Card';
|
|
16
16
|
|
|
17
17
|
type Props = {
|
|
18
18
|
interpolationIndex: number;
|
|
@@ -56,7 +56,7 @@ type Props = {
|
|
|
56
56
|
|
|
57
57
|
const EPSILON = 0.1;
|
|
58
58
|
|
|
59
|
-
function
|
|
59
|
+
function CardContainerInner({
|
|
60
60
|
interpolationIndex,
|
|
61
61
|
index,
|
|
62
62
|
active,
|
|
@@ -307,7 +307,7 @@ function CardContainer({
|
|
|
307
307
|
);
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
-
export
|
|
310
|
+
export const CardContainer = React.memo(CardContainerInner);
|
|
311
311
|
|
|
312
312
|
const styles = StyleSheet.create({
|
|
313
313
|
container: {
|
|
@@ -15,40 +15,39 @@ export type CardSheetRef = {
|
|
|
15
15
|
// if the container fills the body by comparing the size
|
|
16
16
|
// This lets the document.body handle scrolling of the content
|
|
17
17
|
// It's necessary for mobile browsers to be able to hide address bar on scroll
|
|
18
|
-
export
|
|
19
|
-
{ enabled, layout, style, ...rest },
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
React.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
});
|
|
18
|
+
export const CardSheet = React.forwardRef<CardSheetRef, Props>(
|
|
19
|
+
function CardSheet({ enabled, layout, style, ...rest }, ref) {
|
|
20
|
+
const [fill, setFill] = React.useState(false);
|
|
21
|
+
// To avoid triggering a rerender in Card during animation we had to move
|
|
22
|
+
// the state to CardSheet. The `setPointerEvents` is then hoisted back to the Card.
|
|
23
|
+
const [pointerEvents, setPointerEvents] =
|
|
24
|
+
React.useState<ViewProps['pointerEvents']>('auto');
|
|
25
|
+
|
|
26
|
+
React.useImperativeHandle(ref, () => {
|
|
27
|
+
return { setPointerEvents };
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
React.useEffect(() => {
|
|
31
|
+
if (typeof document === 'undefined' || !document.body) {
|
|
32
|
+
// Only run when DOM is available
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const width = document.body.clientWidth;
|
|
37
|
+
const height = document.body.clientHeight;
|
|
38
|
+
|
|
39
|
+
setFill(width === layout.width && height === layout.height);
|
|
40
|
+
}, [layout.height, layout.width]);
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<View
|
|
44
|
+
{...rest}
|
|
45
|
+
pointerEvents={pointerEvents}
|
|
46
|
+
style={[enabled && fill ? styles.page : styles.card, style]}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
);
|
|
52
51
|
|
|
53
52
|
const styles = StyleSheet.create({
|
|
54
53
|
page: {
|
|
@@ -35,12 +35,12 @@ import type {
|
|
|
35
35
|
StackHeaderMode,
|
|
36
36
|
StackNavigationOptions,
|
|
37
37
|
} from '../../types';
|
|
38
|
-
import findLastIndex from '../../utils/findLastIndex';
|
|
39
|
-
import getDistanceForDirection from '../../utils/getDistanceForDirection';
|
|
38
|
+
import { findLastIndex } from '../../utils/findLastIndex';
|
|
39
|
+
import { getDistanceForDirection } from '../../utils/getDistanceForDirection';
|
|
40
40
|
import type { Props as HeaderContainerProps } from '../Header/HeaderContainer';
|
|
41
41
|
import { MaybeScreen, MaybeScreenContainer } from '../Screens';
|
|
42
42
|
import { getIsModalPresentation } from './Card';
|
|
43
|
-
import CardContainer from './CardContainer';
|
|
43
|
+
import { CardContainer } from './CardContainer';
|
|
44
44
|
|
|
45
45
|
type GestureValues = {
|
|
46
46
|
[key: string]: Animated.Value;
|
|
@@ -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;
|
|
@@ -201,7 +202,7 @@ const getProgressFromGesture = (
|
|
|
201
202
|
});
|
|
202
203
|
};
|
|
203
204
|
|
|
204
|
-
export
|
|
205
|
+
export class CardStack extends React.Component<Props, State> {
|
|
205
206
|
static getDerivedStateFromProps(
|
|
206
207
|
props: Props,
|
|
207
208
|
state: State
|
|
@@ -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,
|
|
@@ -20,12 +21,13 @@ import type {
|
|
|
20
21
|
StackNavigationConfig,
|
|
21
22
|
StackNavigationHelpers,
|
|
22
23
|
} from '../../types';
|
|
23
|
-
import ModalPresentationContext from '../../utils/ModalPresentationContext';
|
|
24
|
+
import { ModalPresentationContext } from '../../utils/ModalPresentationContext';
|
|
24
25
|
import { GestureHandlerRootView } from '../GestureHandler';
|
|
25
|
-
import
|
|
26
|
+
import {
|
|
27
|
+
HeaderContainer,
|
|
26
28
|
Props as HeaderContainerProps,
|
|
27
29
|
} from '../Header/HeaderContainer';
|
|
28
|
-
import CardStack from './CardStack';
|
|
30
|
+
import { CardStack } from './CardStack';
|
|
29
31
|
|
|
30
32
|
type Props = StackNavigationConfig & {
|
|
31
33
|
state: StackNavigationState<ParamListBase>;
|
|
@@ -60,7 +62,7 @@ const GestureHandlerWrapper = GestureHandlerRootView ?? View;
|
|
|
60
62
|
const isArrayEqual = (a: any[], b: any[]) =>
|
|
61
63
|
a.length === b.length && a.every((it, index) => it === b[index]);
|
|
62
64
|
|
|
63
|
-
export
|
|
65
|
+
export class StackView extends React.Component<Props, State> {
|
|
64
66
|
static getDerivedStateFromProps(
|
|
65
67
|
props: Readonly<Props>,
|
|
66
68
|
state: Readonly<State>
|
|
@@ -328,7 +330,18 @@ export default class StackView extends React.Component<Props, State> {
|
|
|
328
330
|
) {
|
|
329
331
|
// If route isn't present in current state, but was closing, assume that a close animation was cancelled
|
|
330
332
|
// So we need to add this route back to the state
|
|
331
|
-
navigation.
|
|
333
|
+
navigation.dispatch((state) => {
|
|
334
|
+
const routes = [
|
|
335
|
+
...state.routes.filter((r) => r.key !== route.key),
|
|
336
|
+
route,
|
|
337
|
+
];
|
|
338
|
+
|
|
339
|
+
return CommonActions.reset({
|
|
340
|
+
...state,
|
|
341
|
+
routes,
|
|
342
|
+
index: routes.length - 1,
|
|
343
|
+
});
|
|
344
|
+
});
|
|
332
345
|
} else {
|
|
333
346
|
this.setState((state) => ({
|
|
334
347
|
routes: state.replacingRouteKeys.length
|