From f6933ac401e5f47dbe2a977c7fa2c3f187e91a4b Mon Sep 17 00:00:00 2001 From: Eric Vicenti Date: Mon, 4 Jun 2018 12:46:08 -0700 Subject: [PATCH] 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 --- packages/react-navigation/.eslintrc | 21 ++++++++----------- .../NavigationPlayground/js/SimpleStack.js | 18 ++++++++++++++++ .../src/views/Transitioner.js | 19 ++++++++++++++++- 3 files changed, 45 insertions(+), 13 deletions(-) diff --git a/packages/react-navigation/.eslintrc b/packages/react-navigation/.eslintrc index 73e0a8d7..8e10f4f8 100644 --- a/packages/react-navigation/.eslintrc +++ b/packages/react-navigation/.eslintrc @@ -7,18 +7,18 @@ "prettier/react" ], "parser": "babel-eslint", - "plugins": [ - "react", - "prettier" - ], + "plugins": ["react", "prettier"], "env": { "jasmine": true }, "rules": { - "prettier/prettier": ["error", { - "trailingComma": "es5", - "singleQuote": true - }], + "prettier/prettier": [ + "error", + { + "trailingComma": "es5", + "singleQuote": true + } + ], "no-underscore-dangle": "off", "no-use-before-define": "off", @@ -27,14 +27,11 @@ "no-plusplus": "off", "no-class-assign": "off", "no-duplicate-imports": "off", - "import/extensions": "off", "import/no-extraneous-dependencies": "off", "import/no-unresolved": "off", - "react/jsx-filename-extension": [ - "off", { "extensions": [".js", ".jsx"] } - ], + "react/jsx-filename-extension": ["off", { "extensions": [".js", ".jsx"] }], "react/sort-comp": "off", "react/prefer-stateless-function": "off", diff --git a/packages/react-navigation/examples/NavigationPlayground/js/SimpleStack.js b/packages/react-navigation/examples/NavigationPlayground/js/SimpleStack.js index 9b572788..d77822c2 100644 --- a/packages/react-navigation/examples/NavigationPlayground/js/SimpleStack.js +++ b/packages/react-navigation/examples/NavigationPlayground/js/SimpleStack.js @@ -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 { onPress={() => push('Profile', { name: 'Jane' })} title="Push a profile screen" /> +