In React Native (iOS), React navigation's stack navigator has a default transition animation to move screens left or right based on the stack order. Is there any way to disable the transition animation?
-
3Thanks for your good question. – AmerllicA Jul 12 '20 at 14:16
11 Answers
React Navigation 5
{/* Screen level */}
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen
name="HomeScreen"
component={HomeScreen}
options={{
animationEnabled: false,
}}
/>
</Stack.Navigator>
</NavigationContainer>
{/* Whole navigation stack */}
<Stack.Navigator screenOptions={{ animationEnabled: false }}></Stack.Navigator>
React Navigation 6
<Stack.Navigator screenOptions={{ animation: 'none' }}></Stack.Navigator>
More options here https://reactnavigation.org/docs/stack-navigator/

- 12,348
- 24
- 92
- 162
-
7
-
4If you're setting this on a per-screen basis, note that you need to disable `animationEnabled` on the screen you're navigating TO, not from. It can be a little bit confusing since a transition involves 2 screens. – starlabs May 20 '20 at 15:21
-
2This seems very limiting. I would rather be able to disable the animation a the time I'm navigating to the screen. For instance, if there's a screen I want to animate most of the time with a few edge case exceptions. It would be nice to just turn it off when I need to. – Euroclydon37 Jan 06 '21 at 21:30
-
1@Euroclydon37 you can enable it in the screen via [setOptions](https://reactnavigation.org/docs/navigation-prop/#setoptions) – wobsoriano Jan 07 '21 at 09:18
-
1
-
5
-
1@FlorentRoques THANK YOU. This needs to be higher. I thought I was going crazy. The docs on the website still reference animationEnabled. – Kyle J Jun 06 '22 at 00:57
-
1In React Navigation 6 how can you disable it (or enable it) for specific screens? – yem Jun 15 '22 at 18:57
React Navigation v6:
Use screenOptions={{ animation: 'none' }}
on the Navigator to disable all animations inside the Navigator
or
use options={{ animation: 'none' }}
on the Screen you wan't to navigate to without animation.
Code Example:
<Stack.Navigator screenOptions={{ animation: 'none' }}>
<Stack.Screen name="Home" component={Home} />
<Stack.Screen name="Store" options={{ animation: 'none' }} component={Store} />
</Stack.Navigator>

- 998
- 8
- 20
Hope it would help you. Please try as below.
const StackNavigatorConfig = {
[...]
transitionConfig : () => ({
transitionSpec: {
duration: 0,
timing: Animated.timing,
easing: Easing.step0,
},
}),
}
export const Navigator = StackNavigator(RouteConfiguration,StackNavigatorConfig)

- 719
- 5
- 13
I don't think there is a Boolean variable controls the transition animation. So we can't directly hide the animation.
But there is a variable controls the animation duration !
Try this~ ↓
const RootStackNavigator = createStackNavigator({
// ...
}, {
transitionConfig: () => ({
transitionSpec: {
duration: 0, // Set the animation duration time as 0 !!
},
}),
});

- 161
- 8
Update for react-native : 0.61.5
We were able to turnoff the animations/transitions using the below props in navigationOptions.
animationEnabled:false,
transitionConfig: () => ({
transitionSpec: {
duration:0,
timing: 0,
},
})
Other relevant packages that we're using are:
- "react-navigation": "~4.0.10"
- "react-navigation-stack": "^2.1.0"
- "react-native-screens": "2.0.0-beta.2"

- 51
- 1
- 2
If you're using @react-navigation/native-stack
you can disable transition by using animation
option of Stack.Navigator
component.
// create Stack component
import {createNativeStackNavigator} from '@react-navigation/native-stack';
const Stack = createNativeStackNavigator();
// use Stack component in JSX
<Stack.Navigator screenOptions={{ animation: 'none' }}>
<Stack.Screen name={'Home'} component={Home} />
<Stack.Screen name={'Page'} component={Page} />
</Stack.Navigator>

- 241
- 3
- 9
For my case, I'm disabling animation for home screen.
"react-navigation": "^4.3.9",
"react-navigation-stack": "^2.7.0",
const StackNavigator = createStackNavigator(
{
SplashScreen: SplashScreen,
MainScreen: {
name: 'HomeScreen',
screen: HomeScreen,
navigationOptions: ({ navigation }) => ({
animationEnabled: false,
transitionConfig: () => ({
transitionSpec: {
duration: 0,
timing: 0,
},
})
}),
},
},
{
initialRouteName: 'SplashScreen',
headerMode: 'none'
})

- 1,994
- 2
- 15
- 17
In the newest version of react-native (in my case: )
"react-native": "0.60.5",
"react-navigation": "^4.0.10",
"react-navigation-stack": "^1.10.3",
just put the following config:
transitionConfig: () => ({
transitionSpec: {
timing: Animated.timing,
},
screenInterpolator: () => {},
}),

- 5,224
- 2
- 39
- 65
Simplest answer:
<NavigationContainer>
<Stack.Navigator
screenOptions={{
{/* || ||
\/ \/ */}
animationEnabled: false
}}
>
<Stack.Screen name="Landing" component={Landing}/>
<Stack.Screen name="Register" component={Register}/>
</Stack.Navigator>
</NavigationContainer>

- 337
- 1
- 3
- 17
<Stack.Screen name='Timeline' component={Timeline} options={{ animation: 'none', headerShown: true, headerTitle: "Timeline" }} />
Just pass "animation as none" with options

- 143
- 3