chore: sync latest stack

This commit is contained in:
Satyajit Sahoo
2020-01-09 03:48:11 +01:00
parent 98f0f91682
commit f0a82fd185
3 changed files with 57 additions and 60 deletions

View File

@@ -1,6 +1,6 @@
diff -Naur node_modules/@react-navigation/stack/src/index.tsx src/vendor/index.tsx
--- node_modules/@react-navigation/stack/src/index.tsx 2020-01-07 15:54:09.000000000 +0100
+++ src/vendor/index.tsx 2020-01-07 16:06:06.000000000 +0100
--- node_modules/@react-navigation/stack/src/index.tsx 2020-01-09 03:40:24.000000000 +0100
+++ src/vendor/index.tsx 2020-01-09 03:40:42.000000000 +0100
@@ -3,11 +3,6 @@
import * as TransitionSpecs from './TransitionConfigs/TransitionSpecs';
import * as TransitionPresets from './TransitionConfigs/TransitionPresets';
@@ -28,7 +28,7 @@ diff -Naur node_modules/@react-navigation/stack/src/index.tsx src/vendor/index.t
StackHeaderTitleProps,
StackCardInterpolatedStyle,
diff -Naur node_modules/@react-navigation/stack/src/navigators/createStackNavigator.tsx src/vendor/navigators/createStackNavigator.tsx
--- node_modules/@react-navigation/stack/src/navigators/createStackNavigator.tsx 2020-01-07 15:54:09.000000000 +0100
--- node_modules/@react-navigation/stack/src/navigators/createStackNavigator.tsx 2020-01-09 03:40:24.000000000 +0100
+++ src/vendor/navigators/createStackNavigator.tsx 1970-01-01 01:00:00.000000000 +0100
@@ -1,77 +0,0 @@
-import * as React from 'react';
@@ -109,8 +109,8 @@ diff -Naur node_modules/@react-navigation/stack/src/navigators/createStackNaviga
- typeof StackNavigator
->(StackNavigator);
diff -Naur node_modules/@react-navigation/stack/src/types.tsx src/vendor/types.tsx
--- node_modules/@react-navigation/stack/src/types.tsx 2020-01-07 15:54:09.000000000 +0100
+++ src/vendor/types.tsx 2020-01-07 16:06:06.000000000 +0100
--- node_modules/@react-navigation/stack/src/types.tsx 2020-01-09 03:40:24.000000000 +0100
+++ src/vendor/types.tsx 2020-01-09 03:40:42.000000000 +0100
@@ -8,13 +8,28 @@
} from 'react-native';
import { EdgeInsets } from 'react-native-safe-area-context';
@@ -255,8 +255,8 @@ diff -Naur node_modules/@react-navigation/stack/src/types.tsx src/vendor/types.t
export type StackNavigationConfig = {
diff -Naur node_modules/@react-navigation/stack/src/views/Header/Header.tsx src/vendor/views/Header/Header.tsx
--- node_modules/@react-navigation/stack/src/views/Header/Header.tsx 2020-01-07 15:54:09.000000000 +0100
+++ src/vendor/views/Header/Header.tsx 2020-01-07 16:06:09.000000000 +0100
--- node_modules/@react-navigation/stack/src/views/Header/Header.tsx 2020-01-09 03:40:24.000000000 +0100
+++ src/vendor/views/Header/Header.tsx 2020-01-09 03:40:42.000000000 +0100
@@ -1,11 +1,13 @@
import * as React from 'react';
-import { StackActions } from '@react-navigation/routers';
@@ -325,8 +325,8 @@ diff -Naur node_modules/@react-navigation/stack/src/views/Header/Header.tsx src/
+
+export default Header;
diff -Naur node_modules/@react-navigation/stack/src/views/Header/HeaderBackButton.tsx src/vendor/views/Header/HeaderBackButton.tsx
--- node_modules/@react-navigation/stack/src/views/Header/HeaderBackButton.tsx 2020-01-07 15:54:09.000000000 +0100
+++ src/vendor/views/Header/HeaderBackButton.tsx 2020-01-07 16:06:06.000000000 +0100
--- node_modules/@react-navigation/stack/src/views/Header/HeaderBackButton.tsx 2020-01-09 03:40:24.000000000 +0100
+++ src/vendor/views/Header/HeaderBackButton.tsx 2020-01-09 03:40:42.000000000 +0100
@@ -8,9 +8,9 @@
StyleSheet,
LayoutChangeEvent,
@@ -339,8 +339,8 @@ diff -Naur node_modules/@react-navigation/stack/src/views/Header/HeaderBackButto
type Props = StackHeaderLeftButtonProps;
diff -Naur node_modules/@react-navigation/stack/src/views/Header/HeaderBackground.tsx src/vendor/views/Header/HeaderBackground.tsx
--- node_modules/@react-navigation/stack/src/views/Header/HeaderBackground.tsx 2020-01-07 15:54:09.000000000 +0100
+++ src/vendor/views/Header/HeaderBackground.tsx 2020-01-07 16:06:06.000000000 +0100
--- node_modules/@react-navigation/stack/src/views/Header/HeaderBackground.tsx 2020-01-09 03:40:24.000000000 +0100
+++ src/vendor/views/Header/HeaderBackground.tsx 2020-01-09 03:40:42.000000000 +0100
@@ -1,6 +1,6 @@
import * as React from 'react';
import { Animated, StyleSheet, Platform, ViewProps } from 'react-native';
@@ -350,9 +350,9 @@ diff -Naur node_modules/@react-navigation/stack/src/views/Header/HeaderBackgroun
export default function HeaderBackground({ style, ...rest }: ViewProps) {
const { colors } = useTheme();
diff -Naur node_modules/@react-navigation/stack/src/views/Header/HeaderContainer.tsx src/vendor/views/Header/HeaderContainer.tsx
--- node_modules/@react-navigation/stack/src/views/Header/HeaderContainer.tsx 2020-01-07 15:54:09.000000000 +0100
+++ src/vendor/views/Header/HeaderContainer.tsx 2020-01-07 16:06:06.000000000 +0100
@@ -1,16 +1,13 @@
--- node_modules/@react-navigation/stack/src/views/Header/HeaderContainer.tsx 2020-01-09 03:40:24.000000000 +0100
+++ src/vendor/views/Header/HeaderContainer.tsx 2020-01-09 03:42:01.000000000 +0100
@@ -1,11 +1,7 @@
import * as React from 'react';
import { View, StyleSheet, StyleProp, ViewStyle } from 'react-native';
-import {
@@ -366,26 +366,28 @@ diff -Naur node_modules/@react-navigation/stack/src/views/Header/HeaderContainer
import { EdgeInsets } from 'react-native-safe-area-context';
import Header from './Header';
import { forStatic } from '../../TransitionConfigs/HeaderStyleInterpolators';
@@ -14,6 +10,7 @@
forNoAnimation,
} from '../../TransitionConfigs/HeaderStyleInterpolators';
import {
+ Route,
Layout,
Scene,
StackHeaderStyleInterpolator,
@@ -93,9 +90,7 @@
@@ -94,9 +91,7 @@
insets,
scene,
previous,
- navigation: scene.descriptor.navigation as StackNavigationProp<
- ParamListBase
- >,
+ navigation: scene.descriptor.navigation as StackNavigationProp,
styleInterpolator: isHeaderStatic ? forStatic : styleInterpolator,
};
+ navigation: scene.descriptor.navigation as StackNavigationProp,
styleInterpolator:
mode === 'float'
? isHeaderStatic
diff -Naur node_modules/@react-navigation/stack/src/views/Header/HeaderSegment.tsx src/vendor/views/Header/HeaderSegment.tsx
--- node_modules/@react-navigation/stack/src/views/Header/HeaderSegment.tsx 2020-01-07 15:54:09.000000000 +0100
+++ src/vendor/views/Header/HeaderSegment.tsx 2020-01-07 16:06:06.000000000 +0100
--- node_modules/@react-navigation/stack/src/views/Header/HeaderSegment.tsx 2020-01-09 03:40:24.000000000 +0100
+++ src/vendor/views/Header/HeaderSegment.tsx 2020-01-09 03:40:42.000000000 +0100
@@ -8,7 +8,7 @@
ViewStyle,
} from 'react-native';
@@ -405,8 +407,8 @@ diff -Naur node_modules/@react-navigation/stack/src/views/Header/HeaderSegment.t
};
diff -Naur node_modules/@react-navigation/stack/src/views/Header/HeaderTitle.tsx src/vendor/views/Header/HeaderTitle.tsx
--- node_modules/@react-navigation/stack/src/views/Header/HeaderTitle.tsx 2020-01-07 15:54:09.000000000 +0100
+++ src/vendor/views/Header/HeaderTitle.tsx 2020-01-07 16:06:06.000000000 +0100
--- node_modules/@react-navigation/stack/src/views/Header/HeaderTitle.tsx 2020-01-09 03:40:24.000000000 +0100
+++ src/vendor/views/Header/HeaderTitle.tsx 2020-01-09 03:40:42.000000000 +0100
@@ -1,6 +1,6 @@
import * as React from 'react';
import { Animated, StyleSheet, Platform, TextProps } from 'react-native';
@@ -416,8 +418,8 @@ diff -Naur node_modules/@react-navigation/stack/src/views/Header/HeaderTitle.tsx
type Props = TextProps & {
tintColor?: string;
diff -Naur node_modules/@react-navigation/stack/src/views/Stack/Card.tsx src/vendor/views/Stack/Card.tsx
--- node_modules/@react-navigation/stack/src/views/Stack/Card.tsx 2020-01-07 15:54:09.000000000 +0100
+++ src/vendor/views/Stack/Card.tsx 2020-01-07 16:06:06.000000000 +0100
--- node_modules/@react-navigation/stack/src/views/Stack/Card.tsx 2020-01-09 03:40:24.000000000 +0100
+++ src/vendor/views/Stack/Card.tsx 2020-01-09 03:40:42.000000000 +0100
@@ -483,7 +483,7 @@
pointerEvents="none"
/>
@@ -428,8 +430,8 @@ diff -Naur node_modules/@react-navigation/stack/src/views/Stack/Card.tsx src/ven
<CardAnimationContext.Provider value={animationContext}>
{children}
diff -Naur node_modules/@react-navigation/stack/src/views/Stack/CardContainer.tsx src/vendor/views/Stack/CardContainer.tsx
--- node_modules/@react-navigation/stack/src/views/Stack/CardContainer.tsx 2020-01-07 15:54:09.000000000 +0100
+++ src/vendor/views/Stack/CardContainer.tsx 2020-01-07 16:06:06.000000000 +0100
--- node_modules/@react-navigation/stack/src/views/Stack/CardContainer.tsx 2020-01-09 03:40:24.000000000 +0100
+++ src/vendor/views/Stack/CardContainer.tsx 2020-01-09 03:40:42.000000000 +0100
@@ -1,11 +1,17 @@
import * as React from 'react';
import { Animated, View, StyleSheet, StyleProp, ViewStyle } from 'react-native';
@@ -461,8 +463,8 @@ diff -Naur node_modules/@react-navigation/stack/src/views/Stack/CardContainer.ts
>
<View style={styles.container}>
diff -Naur node_modules/@react-navigation/stack/src/views/Stack/CardStack.tsx src/vendor/views/Stack/CardStack.tsx
--- node_modules/@react-navigation/stack/src/views/Stack/CardStack.tsx 2020-01-07 15:54:09.000000000 +0100
+++ src/vendor/views/Stack/CardStack.tsx 2020-01-07 16:06:06.000000000 +0100
--- node_modules/@react-navigation/stack/src/views/Stack/CardStack.tsx 2020-01-09 03:40:24.000000000 +0100
+++ src/vendor/views/Stack/CardStack.tsx 2020-01-09 03:40:42.000000000 +0100
@@ -11,8 +11,7 @@
import { EdgeInsets } from 'react-native-safe-area-context';
// eslint-disable-next-line import/no-unresolved
@@ -482,8 +484,8 @@ diff -Naur node_modules/@react-navigation/stack/src/views/Stack/CardStack.tsx sr
StackHeaderMode,
StackCardMode,
diff -Naur node_modules/@react-navigation/stack/src/views/Stack/StackView.tsx src/vendor/views/Stack/StackView.tsx
--- node_modules/@react-navigation/stack/src/views/Stack/StackView.tsx 2020-01-07 15:54:09.000000000 +0100
+++ src/vendor/views/Stack/StackView.tsx 2020-01-07 16:06:06.000000000 +0100
--- node_modules/@react-navigation/stack/src/views/Stack/StackView.tsx 2020-01-09 03:40:24.000000000 +0100
+++ src/vendor/views/Stack/StackView.tsx 2020-01-09 03:44:43.000000000 +0100
@@ -1,8 +1,11 @@
import * as React from 'react';
import { Platform } from 'react-native';
@@ -547,32 +549,27 @@ diff -Naur node_modules/@react-navigation/stack/src/views/Stack/StackView.tsx sr
this.setState(state => ({
routes: state.replacingRouteKeys.length
? state.routes.filter(r => !state.replacingRouteKeys.includes(r.key))
@@ -283,15 +305,19 @@
@@ -282,10 +304,15 @@
// If a route exists in state, trigger a pop
// This will happen in when the route was closed from the card component
// e.g. When the close animation triggered from a gesture ends
// For the cleanup, the card needs to call this function again from its componentDidUpdate
- navigation.dispatch({
- ...StackActions.pop(),
- source: route.key,
- target: state.key,
- });
+ // @ts-ignore
+ navigation.dispatch(StackActions.pop({ key: route.key }));
} else {
// Otherwise, the animation was triggered due to a route removal
// In this case, we need to clean up any state tracking the route and pop it immediately
+ } else {
+ // While closing route we need to point to the previous one assuming that
+ // this previous one in routes array
+ const index = this.state.routes.findIndex(r => r.key === route.key);
+
+ this.handleTransitionComplete({
+ route: this.state.routes[Math.max(index - 1, 0)],
+ });
+
// @ts-ignore
this.setState(state => ({
routes: state.routes.filter(r => r.key !== route.key),
@@ -308,22 +334,26 @@
});
}
@@ -300,22 +327,26 @@
private handleTransitionStart = (
{ route }: { route: Route<string> },
closing: boolean