Transitioner: Fix instantaneous transitions (#4404)

* Transitioner: Fix instantaneous transitions

The transitioner will always perform an animation on state change. Instead we should check if the navigation state is requesting a transition with isTransitioning. If not, we follow a similar codepath to transitioning, without any animation.

* Update .eslintrc
This commit is contained in:
Eric Vicenti
2018-06-04 12:46:08 -07:00
committed by Brent Vatne
parent 80016b7218
commit 4be99b6645
3 changed files with 45 additions and 13 deletions

View File

@@ -15,6 +15,8 @@ import {
createStackNavigator,
SafeAreaView,
withNavigation,
NavigationActions,
StackActions,
} from 'react-navigation';
import invariant from 'invariant';
@@ -62,6 +64,22 @@ class MyNavScreen extends React.Component<MyNavScreenProps> {
onPress={() => push('Profile', { name: 'Jane' })}
title="Push a profile screen"
/>
<Button
onPress={() =>
navigation.dispatch(
StackActions.reset({
index: 0,
actions: [
NavigationActions.navigate({
routeName: 'Photos',
params: { name: 'Jane' },
}),
],
})
)
}
title="Reset photos"
/>
<Button
onPress={() => navigation.navigate('Photos', { name: 'Jane' })}
title="Navigate to a photos screen"