React-native-screens: Push animation between screens not working

Created on 11 Nov 2020  路  7Comments  路  Source: software-mansion/react-native-screens

This is the version that was working for me:

    "@react-navigation/bottom-tabs": "^5.10.2",
    "@react-navigation/native": "^5.8.2",
    "@react-navigation/stack": "^5.11.1",
    "react": "17.0.1",
    "react-native": "0.63.3",
    "react-native-screens": "^2.12.0",

I recently updated to this version and on iOS, navigation no longer has any animation, it happens instantly:

    "@react-navigation/bottom-tabs": "^5.11.1",
    "@react-navigation/native": "^5.8.9",
    "@react-navigation/stack": "^5.12.6",
    "react": "17.0.1",
    "react-native": "0.63.3",
    "react-native-screens": "^2.14.0",

I have deleted Podfile.lock and npx pod-install ios, still not work.

When I changed createNativeStackNavigator() to createStackNavigator(), it worked fine again with animation.

Please let me know if it's a bug or what config I need to use to have the slide (push) animation?

iOS

Most helpful comment

@dylancom hey thanks for that, I'm using exactly the same thing too.

All 7 comments

Can you provide a repo/snack with minimal configuration needed to reproduce the issue?

Same here since I updated from version 2.12. Going to a new screen doesn't show an animation anymore. Navigating back to a screen shows an animation though.

@dylancom please provide a repo that shows this bug so I can work on it.

@WoLewicki I created a repo that shows the bug (iOS): https://github.com/dylancom/react-native-screens-animation-bug.
If you press on "Go to Details" there is no animation.

It seems to happen when you use the "modal stack" pattern: https://reactnavigation.org/docs/modal#creating-a-modal-stack.
So in my case the RootStack is created with: createStackNavigator and the MainStack with createNativeStackNavigator.
This was working fine before updating from 2.12.

@dylancom hey thanks for that, I'm using exactly the same thing too.

I tested the reproduction and I can spot this bug too. Until we find the solution, the workaround is to set detachInactiveScreens to false on iOS in the stack navigator.

@longprao @dylancom can you check if #714 resolves the problem?

Was this page helpful?
0 / 5 - 0 ratings