1

I want to add simple horizantal transition in my react-native app on both IOS/Android, I have tried this Implementation but it didnt' work:

<MainStack.Screen
  name="PostDetails"
  component={PostDetails}
  options={{ animation: 'slide_from_left' }}
/>

I am using react-navigation v 6.xx.

Thank you and have a nice day

warCommander
  • 392
  • 4
  • 19

1 Answers1

1

In the <Stack.Navigator>, which should wrap your screens, you add the parameter:

import {createStackNavigator, TransitionPresets} from "@react-navigation/stack";

<Stack.Navigator
screenOptions={() => ({...TransitionPresets.SlideFromRightIOS})}>
...
screens
...
</Stack.Navigator>

It will work for android as well.