I'm having a problem where, on android, the transitions between scenes/ pages is vertical, instead of horizontal. I was thinking I could add a prop to a scene, like so: <Scene direction="leftToRight" /> but this does not work. How should I go about fixing the transitions on android devices?
Scenes transition horizontally (i.e. left-to-right) on both android and iOS devices.
On android: scenes transition vertically (from bottom-to-top) instead of horizontally like they do in iOS.
<Router>
<Stack>
<Scene />
<Scene />
...
I've tried <Stack key="root" transitionConfig={() => ({ screenInterpolator: CardStackStyleInterpolator.forHorizontal })}> but this throws an error: undefined is not a function (evaluating 'addListener'. Please do not link to https://github.com/aksonov/react-native-router-flux/issues/2628 and close this issue, because I've read through that thread and I'm still having issues.
Import this at the file you register scenes.
import CardStackStyleInterpolator from 'react-navigation/src/views/CardStack/CardStackStyleInterpolator';
And Add this to transitionConfig={() => ({ screenInterpolator: CardStackStyleInterpolator.forHorizontal })} Edit : this error may occur of react-native-router-flux version i had this error before. I am using version
to your stack like this :
"react-native-router-flux": "^4.0.0-beta.26", now and it`s working perfectly fine.
Show your main file with all your Scenes, as well as your imports please
@Dorentin1997 upgrading react-native-router-flux from v4.0.0-beta.22 to 4.0.0-beta.26 fixed it for me, thank you! Closing issue.
Most helpful comment
Import this at the file you register scenes.
import CardStackStyleInterpolator from 'react-navigation/src/views/CardStack/CardStackStyleInterpolator';
And Add this to transitionConfig={() => ({ screenInterpolator: CardStackStyleInterpolator.forHorizontal })}
to your stack like this :
Edit : this error may occur of react-native-router-flux version i had this error before. I am using version
"react-native-router-flux": "^4.0.0-beta.26", now and it`s working perfectly fine.