- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
How to reset the navigation stack without animation? #1493
Comments
I'm having the same problem with animations when I reset or navigate backwards more than 1 screen. Here's the StackOverflow question |
I have the same issue also. I am wondering if using a custom Transitioner would allow resetting the stack without any animations: https://reactnavigation.org/docs/views/transitioner |
@diegorodriguesvieira hey, you need not to jump to another page, just use header null , and setstate in one page render different component |
@diegorodriguesvieira i don't understand? |
@aqnaruto but if I just navigate to a page without a header, I'll still have the navigation stack with the items because it has not been reset, can I have performance issues with that? |
@LaurensLang I need to reset to the first navigation page inside the tab, however without seeing the animations for each card in the stack |
@davidysong I will try, thanks |
+1 anyone with a solution? |
+1 |
2 similar comments
+1 |
+1 |
@diegorodriguesvieira did you figure this out yet? What you are trying to accomplish is basically default iOS behaviour and should work out of the box ideally. |
Here's a concise proposal that will fix this in many other issues: |
I've really similar issue. TabNavigator The problem is - when first land on Tab1, it shows Screen1 and I can navigate to Screen2. I've spent so much time to solve this issue and googled a lot. I want to show animation when navigating and only want to remove animation when resetting. |
+1 |
@diegorodriguesvieira Did you find a workaround for this? |
Hello @jamesone, unfortunately I have not found any workaround yet... |
@diegorodriguesvieira @jamesone |
@cccRaim 中间页面的闪屏怎么去掉,,,你有方法吗? |
Has anyone found any solution for this issue? |
@rajsuvariya yeah~ I change some project code then it work fine. You can check this https://github.com/gorokhovich/react-navigation/commit/30e6d0cc73406e7697f5b846a3a7c6a1ddca9862 |
@NSShentu sorry I am not able to understand anything from the link. Can you provide code for removing animations? |
use the + code replace the function: |
@NSShentu Thanks it solved the issue |
Same issue. From the reactions on this issue, it sounds like most would assume a single transition animation on a reset should be the default. @NSShentu are you going to submit a PR? |
+1 |
@NSShentu your code works, but it gives black screen for a second. any solution? |
My temporary solution is creating a custom action and my reducer looks like
|
@evollu this ended up overwriting my Home routename (though it may be more related to my setup). This solution worked for my personal setup:
|
+1 |
2 similar comments
+1 |
+1 |
This solution worked for me. Note that if you have 4 screen A, B, C, D and want to back from D to A, you have to call
|
closing since this was fixed by #2520, but feel free to reopen in case the issue persists |
@vonovak #2520 does not work as intended. After almost giving up on react-navigation I found your example for extending the NavigatorService but it is incomplete, it's missing the return for when there are no nested navigators. function getRouteWithName(navigationState, name) {
if (!navigationState) {
return null;
}
const route = navigationState.routes[navigationState.index];
// dive into nested navigators
if (route.routes) {
// NOTE +1 is because goBack accepts from, not to!
const index = route.routes.findIndex(r => r.routeName === name);
if (index > -1) {
return route.routes[index + 1];
}
return getRouteWithName(route, name);
} else {
const index = navigationState.routes.findIndex(r => r.routeName === name);
if (index > -1) return navigationState.routes[index + 1];
}
return null;
} |
does this issues solved? In iOS we can simply push viewcontrollers by nav just disable the animation. |
|
welcome to RNRF, easy case for that~ |
How is it solved in RNRF @dustturtle |
@luqmanrom it is not solved there as well. RNRF is based on React Navigation. |
can someone please create a new issue for this and include a link to an example reproducing it on https://snack.expo.io or github? please without any superfluous code. I'd be happy to investigate. thanks! |
How can I reset the navigation stack without this animation?
My code:
The text was updated successfully, but these errors were encountered: