React-native: [NavigationExperimental] how to disable animation on reset route

Created on 24 Nov 2016  路  8Comments  路  Source: facebook/react-native

When Resetting the routes on NavigationExperimental with more then one route the navigator animates to the second route. How do I prevent this? I just want the second scene to be displayed.
For example:
resetRoutesTo([ {key: 'GroupsIndex', title: "Groups"}, {key: 'QuestionsIndex'} ])
with this reducer.

    case RESET_ROUTES_TO:
      return NavigationStateUtils.reset(state,action.routes)

it still animates.

Locked

Most helpful comment

@skevy, any thoughts on how to handle disabling of animations?

My first thought is that we should add a prop like enableAnimation to NavigationCardStack, which will configure the animation to look instant. We can eventually offer nicer ways of changing this other than the prop.

All 8 comments

Can you reproduce this on rnplay.org? Please provide a link.

@mkonicek Somehow its not working in rnplay, but here is a short example:
https://rnplay.org/apps/q85Y1A
I want to reset the route to [Master,Detail] and Detail animates from the right. How can I prevent the animation?

Thanks! cc @ericvicenti who wrote NavigationExperimental.

@skevy, any thoughts on how to handle disabling of animations?

My first thought is that we should add a prop like enableAnimation to NavigationCardStack, which will configure the animation to look instant. We can eventually offer nicer ways of changing this other than the prop.

I'm also having this issue, I'm using NavigationStateUtils.reset to switch between nav tabs and I find there is a lag between when I press the tab and when the view is rendered, I'm assuming its because its running an animation before it renders?

I also having this bug when I have for example 3 routes in state and then I have this reset action my reducer:

case RESET_ROUTES:
      return NavigationStateUtils.reset(state, [action.route]);

After this animates old routes out. I would also like to disable animation or do normal push animation but without these old animations to pop out :/

Navigation Experimental has been deprecated in favor of the react-navigation library.

Heads up for those migrating from navigation experimental to react-navigation the same issue exists there.

Was this page helpful?
0 / 5 - 0 ratings