Releases: react-navigation/stack
Release 2.0.8
2.0.8 (2020-01-05)
Release 2.0.7
2.0.7 (2020-01-05)
Release 2.0.6
Release 2.0.5
2.0.5 (2020-01-05)
Release 2.0.4
2.0.4 (2020-01-03)
Release 2.0.3
Release 2.0.2
Release 2.0.1
2.0.1 (2020-01-01)
BREAKING CHANGES
In this release, we decided to move several options into navigationOptions so that you can configure options per screen instead of per navigator. This lets you do things like customize animations for a particular screen, set options based on screenProps etc. Usage of built-in components such as Header and HeaderBackButton has also been simplified. Other changes are made to improve consistency within the API.
From this version, all state changes have an animation, including replace and reset which didn't do an animation previously. If you don't want animations, you can specify animationEnabled: false in navigationOptions for a specific screen, or in defaultNavigationOptions for the whole navigator.
Note: The alpha versions for 2.0 used Reanimated for the animations. We've replaced Reanimated with React Native's Animated API in the stable release. If you did any custom animations with the alpha, please migrate your code to the Animated API.
New peer dependencies
The new version requires 2 new peer dependencies. Install them in your project:
yarn add react-native-safe-area-context @react-native-community/masked-viewOr
npm install react-native-safe-area-context @react-native-community/masked-viewStack Navigator config
The following configuration options have been removed or moved:
cardShadowEnabled- moved tonavigationOptionscardOverlayEnabled- moved tonavigationOptionscardStyle- moved tonavigationOptionstransparentCard- removed in favor ofcardStyle: { backgroundColor: 'transparent' }innavigationOptionsheaderBackTitleVisible- moved tonavigationOptionsheaderLayoutPreset- moved tonavigationOptionsasheaderTitleAlignonTransitionStart- moved tonavigationOptionsonTransitionEnd- moved tonavigationOptionsheaderTransitionPreset- removed in favor of new APIs for animations innavigationOptionstransitionConfig- removed in favor of new APIs for animations innavigationOptions
navigationOptions
The following navigationOptions have been removed or changed:
headerForceInset- usesafeAreaInsetsinsteadgesturesEnabled- renamed togestureEnabledfor consistencyheader- now accepts a function returning react element instead, useheaderShown: falseinstead ofheader: nullto hide the headerheaderTitle- now accepts a function returning a React element or a stringheaderLeft- now accepts a function returning a React elementheaderRight- now accepts a function returning a React elementheaderBackImage- now accepts a function returning a React elementheaderBackTitle- now specifies the back title visible in current screen instead of next, specifyingnullno longer hides back title, usebackTitleVisibleinstead, for a screen to change next screen's back title, it can pass paramsheaderBackground- now accepts a function returning a React element
The following navigationOptions have been added:
gestureEnabledanimationEnabledheaderTitleAligncardShadowEnabledcardOverlayEnabledcardStyleheaderBackgroundStyleheaderBackTitleVisibleswipeVelocityImpactonTransitionStartonTransitionEnd
You can find more details about these options in the documentation.
Library exports
The library now exports the following items:
createStackNavigatorStackViewHeaderHeaderTitleHeaderBackButtonCardStyleInterpolatorsHeaderStyleInterpolatorsTransitionSpecsTransitionPresetsStackGestureContextStackAnimationContext
The following components now receive different set of props, so if you use them, or use your own custom component, you will need to update them:
Header (header option)
modelayoutscenepreviousnavigationstyleInterpolator
HeaderBackButton (headerLeft option)
disabledonPresspressColorAndroidbackImagetintColorlabeltruncatedLabellabelVisiblelabelStyleallowFontScalingonLabelLayoutscreenLayouttitleLayoutcanGoBack
Removal of Transitioner
The old Transitioner component has been removed as a result of rewrite of the animation logic. We're not going to expose the new animation logic since it's internal implementation detail and we want to be able to change it without breaking your code. If you need Transitioner in your project for some reason, you can copy the old files into your project https://github.com/react-navigation/stack/blob/1.0/src/views/Transitioner.tsx