From ee6c6aa08e528aa00721182f69dcc3f55e5caa7e Mon Sep 17 00:00:00 2001 From: Brent Vatne Date: Wed, 17 Oct 2018 15:26:13 -0700 Subject: [PATCH] Fix bug where transitioner freezes when nested state change occurs in the middle of transition --- example/App.js | 6 ++ example/src/SwitchWithStacks.js | 118 ++++++++++++++++++++++++++++++++ src/views/Transitioner.js | 18 +++++ 3 files changed, 142 insertions(+) create mode 100644 example/src/SwitchWithStacks.js diff --git a/example/App.js b/example/App.js index e53bbba..e7c6205 100644 --- a/example/App.js +++ b/example/App.js @@ -14,6 +14,7 @@ import TransparentStack from './src/TransparentStack'; import ModalStack from './src/ModalStack'; import LifecycleInteraction from './src/LifecycleInteraction'; import GestureInteraction from './src/GestureInteraction'; +import SwitchWithStacks from './src/SwitchWithStacks'; // Comment the following two lines to stop using react-native-screens import { useScreens } from 'react-native-screens'; @@ -42,6 +43,11 @@ const data = [ title: 'Gesture Interaction', routeName: 'GestureInteraction', }, + { + component: SwitchWithStacks, + title: 'Switch with Stacks', + routeName: 'SwitchWithStacks', + }, ]; // Cache images diff --git a/example/src/SwitchWithStacks.js b/example/src/SwitchWithStacks.js new file mode 100644 index 0000000..3fb5645 --- /dev/null +++ b/example/src/SwitchWithStacks.js @@ -0,0 +1,118 @@ +import React from 'react'; +import { + ActivityIndicator, + Button, + AsyncStorage, + StatusBar, + StyleSheet, + View, +} from 'react-native'; +import { createSwitchNavigator } from '@react-navigation/core'; +import { createStackNavigator } from 'react-navigation-stack'; + +class SignInScreen extends React.Component { + static navigationOptions = { + title: 'Please sign in', + }; + + render() { + return ( + +