Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I animate resetting react native navigation?

I have a react native app and am using react navigation (https://reactnavigation.org).

After the user logs in, I reset the navigation stack with:

const initialNavigation = NavigationActions.reset({
    index: 0,
    actions: [NavigationActions.navigate({ routeName: Main })],
});

props.navigation.dispatch(initialNavigation);

This results in a jump from the login screen to the main screen. Is there any way to animate this so that it looks like a smooth transition? For example, fading out the login screen or sliding the screen.

I understand I could "navigate" instead of "reset" the stack to get animation, but I don't want the login screen to be on the navigation stack.

like image 892
smurf Avatar asked Sep 25 '26 05:09

smurf


1 Answers

You might want to subscribe to these two github open issues since it seems like others are running into the same issue:

https://github.com/react-community/react-navigation/issues/1663

https://github.com/react-community/react-navigation/issues/1493

like image 102
kevinl Avatar answered Sep 28 '26 22:09

kevinl