Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird transition when resetting to other screen #6704

Closed
leethree opened this issue Oct 21, 2019 · 3 comments · Fixed by react-navigation/navigation-ex#137
Closed

Weird transition when resetting to other screen #6704

leethree opened this issue Oct 21, 2019 · 3 comments · Fixed by react-navigation/navigation-ex#137

Comments

@leethree
Copy link
Contributor

Current Behavior

  • Use example project, change the button on the album screen to trigger reset:
onPress={() => navigation.reset({
                      index: 0,
                      routes: [{ name: 'article' }],
                    })}
  • When button is clicked, the transition is problematic because a blank page is shown first and then the "Article" screen comes in with animation.

Kapture 2019-10-21 at 17 47 57

Expected Behavior

  • The transition should be smooth and without sudden blank page.

How to reproduce

diff --git a/packages/example/src/Screens/SimpleStack.tsx b/packages/example/src/Screens/SimpleStack.tsx
index e2d4b07..28f588d 100644
--- a/packages/example/src/Screens/SimpleStack.tsx
+++ b/packages/example/src/Screens/SimpleStack.tsx
@@ -57,10 +57,13 @@ const AlbumsScreen = ({
       <View style={styles.buttons}>
         <Button
           mode="contained"
-          onPress={() => navigation.push('article', { author: 'Babel fish' })}
+          onPress={() => navigation.reset({
+                      index: 0,
+                      routes: [{ name: 'article' }],
+                    })}
           style={styles.button}
         >
-          Push article
+          Reset article
         </Button>
         <Button
           mode="outlined"

Your Environment

software version
react-navigation 70f7e7a
react-native 0.59.10
expo ^34.0.1
node 10.15.0
npm or yarn yarn 1.17.3
@satya164
Copy link
Member

Which version of stack are you on?

@leethree
Copy link
Contributor Author

I checked out the latest code from master.

satya164 referenced this issue in react-navigation/navigation-ex Oct 22, 2019

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
I can't think of a scenario a screen would unmount when opening.
So it's probably a safe-bet to always call onClose.

Fixes #136
satya164 referenced this issue in react-navigation/navigation-ex Oct 22, 2019

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
I can't think of a scenario a screen would unmount when opening.
So it's probably a safe-bet to always call onClose.

Fixes #136
osdnk referenced this issue in react-navigation/navigation-ex Oct 22, 2019

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
I can't think of a scenario a screen would unmount when opening.
So it's probably a safe-bet to always call onClose.

Fixes #136
@leethree
Copy link
Contributor Author

I can confirm it's no longer happening. Thanks for the fix!

@satya164 satya164 transferred this issue from react-navigation/navigation-ex Feb 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants