Release 2.0.0-alpha.0
Pre-release2.0.0-alpha.0 (2019-06-14)
This release is a rewrite of the stack navigator for improved animations and gesture performance.
Upgrade instructions
Installation
Open a Terminal in the project root and run:
yarn add react-navigation-stack@alphaIf you are using Expo, you are done. Otherwise, continue to the next step.
Install and link react-native-reanimated. To install and link it, run:
yarn add react-native-reanimated
react-native link react-native-reanimatedBREAKING CHANGES
Library exports
The library now exports the following items:
createStackNavigatorAssetsHeaderHeaderTitleHeaderBackButtonCardStyleInterpolatorsHeaderStyleInterpolatorsTransitionPresetsStackGestureContext
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)
mode- mode of the header,'float'or'screen'scene- scene object for the screen the header is shown forprevious- scene object for previous screennavigation- the navigation propstyleInterpolator- style interpolator function for the header
HeaderBackButton (headerLeft option)
disabledonPresspressColorAndroidbackImagetintColorlabeltruncatedLabellabelVisiblelabelStyleallowFontScalingonLabelLayout- callback to measure the layout of the labelscreenLayout- layout of the screentitleLayout- layout of the title text in the header
Stack navigator options
The following configuration options have been removed:
headerLayoutPresetheaderTransitionPresettransitionConfig
The transition configuration is revamped. The library exports several presets under the TransitionPresets export, but its straightforward to write a custom transition preset.
A transition preset consists of following properties:
direction- direction of the gesture,verticalorhorizontaltransitionSpec- an object with aopenandcloseproperty which contains the animation config for opening and closing a screen respectively- cardStyleInterpolator` - function which returns interpolated styles for the card. It can contain the following properties:
containerStylecardStyleoverlayStyleshadowStyle
headerStyleInterpolator- function which returns interpolated styles for the header. It can contain the following properties:- leftLabelStyle
- leftButtonStyle
- rightButtonStyle
- titleStyle
- backgroundStyle
All the properties in a preset can be specified in the stack navigator's config to customize the screen transition.
navigationOptions
The following navigationOptions have been removed:
headerTransparent- useheaderStyleinsteadheaderForceInset- useheaderStatusBarHeightinsteadgestureDirection- usedirectionin stack configuration instead
The headerRight and headerBackground options now accept a function returning a React Element instead of a React Element directly to keep consistency with other options.
The following navigationOptions have been added:
animationEnabled- whether transition animation should be enabled for a screen,trueby default
Known issues
react-native-screensintegration is broken