Reputation: 797
Using react-navigation-stack 1.10.3, applying a headerTransitionPreset of 'uikit' transitioned header titles from left-to-right while fading in/out whatever elements were in headerRight or headerLeft.
With react-navigation-stack 2.0.15, this transition is deprecated in favor of using headerStyleInterpolator.forUIKit, but that transition applies universally to the entire header, not just the title.
How do I replicate the previous behavior on 1.10.X with 2.0.X where I can use forFade on headerRight and headerLeft?
The main issue is the removal of the fade animation when going back in the stack and it's replacement with a left-to-right transition.
Upvotes: 0
Views: 1999
Reputation: 10152
The forUIKit
styles mimic the native iOS behavior. If you don't want the same behavior, you can use a custom style interpolator instead.
If you want to keep the same interpolator from forUIKit
, but want to fade the left and right button instead of the default transition, you can override those styles with something like this:
function forCustomHeaderAnimation(options) {
const { progress } = options.current;
const styles = HeaderStyleInterpolators.forUIKit(options);
return {
...styles,
leftButtonStyle: { opacity: progress },
leftLabelStyle: {},
rightButtonStyle: { opacity: progress },
};
}
// ...
static navigationOptions = {
headerStyleInterpolator: forCustomHeaderAnimation
}
Upvotes: 0