Below is the transition config that I create so that I can pass custom transition from any screen:
const TransitionConfiguration = () => ( {
// Define scene interpolation, eq. custom transition
screenInterpolator: ( sceneProps ) => {
const { position, scene } = sceneProps;
const { index, route } = scene;
const params = route.params || {};
const defaultTransition = () => ( {} );
const transition = params.transition || defaultTransition;
return transition( index, position );
},
} );
const navigationOptions = {
navigationOptions: {
headerStyle: {
backgroundColor: background.color4,
shadowColor: primary.color2,
},
headerTitleStyle: { color: primary.color1 },
},
transitionConfig: TransitionConfiguration,
};
As you can observe, I check if I have passed transition as a route param or not. If it's not passed, I pass a default function which returns an empty object.
Is it possible to switch back to StackNavigator's default transition if I don't pass transition config?