From f0a82fd185bfc4971f32031c82e2ad9c81bd3952 Mon Sep 17 00:00:00 2001 From: Satyajit Sahoo Date: Thu, 9 Jan 2020 03:48:11 +0100 Subject: [PATCH] chore: sync latest stack --- packages/stack/package.json | 2 +- packages/stack/scripts/stack.patch | 87 +++++++++++++++--------------- packages/stack/yarn.lock | 28 +++++----- 3 files changed, 57 insertions(+), 60 deletions(-) diff --git a/packages/stack/package.json b/packages/stack/package.json index 702524b8..3e132826 100644 --- a/packages/stack/package.json +++ b/packages/stack/package.json @@ -50,7 +50,7 @@ "@expo/vector-icons": "^10.0.6", "@react-native-community/bob": "^0.7.0", "@react-native-community/masked-view": "^0.1.5", - "@react-navigation/stack": "^5.0.0-alpha.56", + "@react-navigation/stack": "^5.0.0-alpha.58", "@release-it/conventional-changelog": "^1.1.0", "@types/color": "^3.0.1", "@types/jest": "^24.0.25", diff --git a/packages/stack/scripts/stack.patch b/packages/stack/scripts/stack.patch index e2d0164c..b2af649b 100644 --- a/packages/stack/scripts/stack.patch +++ b/packages/stack/scripts/stack.patch @@ -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 {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 > 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 }, closing: boolean diff --git a/packages/stack/yarn.lock b/packages/stack/yarn.lock index eb565aa7..696e3aba 100644 --- a/packages/stack/yarn.lock +++ b/packages/stack/yarn.lock @@ -1369,10 +1369,10 @@ query-string "^6.4.2" react-is "^16.8.6" -"@react-navigation/core@^5.0.0-alpha.30": - version "5.0.0-alpha.30" - resolved "https://registry.yarnpkg.com/@react-navigation/core/-/core-5.0.0-alpha.30.tgz#cde10907b051148e714f6eb92811a9151791e0c7" - integrity sha512-3FnTvyYqNl7uobdyvJhQ15JXhVcT4oKzJqS9em7miXUZQe0s+xIFhUhmNbptNrbOgCc8Ya3B2UMK+gsbe4OX+g== +"@react-navigation/core@^5.0.0-alpha.32": + version "5.0.0-alpha.32" + resolved "https://registry.yarnpkg.com/@react-navigation/core/-/core-5.0.0-alpha.32.tgz#b7c4f68e405080062df95936998be8e44ceb3e2a" + integrity sha512-HCPNXPoTzE8IOsexrjqr14F/w1B5C9ZoTdeokKphK7oxvMrt8ceDkb1AR7KmNT2zEXbzt3FZ9LW0V+Y9sGY2LA== dependencies: escape-string-regexp "^2.0.0" query-string "^6.9.0" @@ -1388,20 +1388,20 @@ react-native-safe-area-view "^0.14.1" react-native-screens "^1.0.0 || ^1.0.0-alpha" -"@react-navigation/routers@^5.0.0-alpha.20": - version "5.0.0-alpha.20" - resolved "https://registry.yarnpkg.com/@react-navigation/routers/-/routers-5.0.0-alpha.20.tgz#f0c89baf2331f01ff90391f3e9a00a9d048a45be" - integrity sha512-Kxft5TEcA5JWGxw5KyvY/AAC14+yOS7gdtlVm9EhEkZYbJRMudFwj8MnG4XtOll9uhEwJdFLV4e1wbTTJP2Hlw== +"@react-navigation/routers@^5.0.0-alpha.22": + version "5.0.0-alpha.22" + resolved "https://registry.yarnpkg.com/@react-navigation/routers/-/routers-5.0.0-alpha.22.tgz#db2086012ad9660da95df7b34fcb23b89f4a7429" + integrity sha512-GaTDJk7PeSbdStUfODb4VSDkwPUNtuZRYToTqwbI7WvY1yuRJbYZS2Jkrk/waOdf13U0rt7xDcdpmfGUNuZ2DQ== dependencies: - "@react-navigation/core" "^5.0.0-alpha.30" + "@react-navigation/core" "^5.0.0-alpha.32" shortid "^2.2.15" -"@react-navigation/stack@^5.0.0-alpha.56": - version "5.0.0-alpha.56" - resolved "https://registry.yarnpkg.com/@react-navigation/stack/-/stack-5.0.0-alpha.56.tgz#1ea44e6511b52df004659ae8f849a123e9a2fecf" - integrity sha512-Cq21URqCmqPo2UKKR1hJ5PrxdCD9njmcwrACorMouOVx7irkE0Kl52ffQJhemG2PfadJrLfVHIKhca9n30BfHg== +"@react-navigation/stack@^5.0.0-alpha.58": + version "5.0.0-alpha.58" + resolved "https://registry.yarnpkg.com/@react-navigation/stack/-/stack-5.0.0-alpha.58.tgz#4c2dbd2356ea7c5cc6a934a79ef9c353bdac9b55" + integrity sha512-oHwG5D6dZLoB7jZBxlKuIzXaNcFTwnyL948UNbQaNBBLj1umW3B9Wn3ekoRUhBY40P/wcCQkGnUARTzH1c1dhw== dependencies: - "@react-navigation/routers" "^5.0.0-alpha.20" + "@react-navigation/routers" "^5.0.0-alpha.22" color "^3.1.2" react-native-iphone-x-helper "^1.2.1"