React Native JsBundle preloading is implemented based on the latest version of React Native
First, open source library introduction
A new open source library, The React-Nav library, gained much attention in January. In less than three months, Github has more than 4,000 stars. Fb recommends using libraries and removing Navigator from React Native’s current version, 0.44. React-navigation is said to have a native-like performance experience. It could become the mainstay of future React Native navigation components. This article is based on version [^1.0.0-beta.9] to introduce the use of the library and practical tips. As you can see, although it’s a beta version, it’s basically stable and you can safely use it in your project. The library contains three types of components:
(1) StackNavigator: Used to jump pages and pass parameters
(2) TabNavigator: similar to the bottom navigation bar, used to switch between different interfaces under the same screen
(3) DrawerNavigator: Side slide menu navigation bar, used to easily set the screen with drawer navigation
Use of react navigation
The specific content can be roughly divided into the following:
(1) React-Navigation library properties introduction
(2) StackNavigator and TabNavigator realize interface skipping and Tab switching
(3) Jump, transfer and value transfer between StackNavigator interfaces
(4) DrawerNavigator realizes drawer navigation menu
(5) DrawerNavigator extension function
(6) Modify the source code, customize the UI interface
1. StackNavigator properties
view plain
copy
?
- NavigationOptions: Configures some properties of StackNavigator.
- Title: title. If this is set, the title of the navigation bar and TAB bar will be the same. It is not recommended
- Header: You can set some navigation properties. If you want to hide the top navigation bar, set this property to NULL
- HeaderTitle: Set the navigation title. Recommended
- HeaderBackTitle: Sets the text after the return arrow on the left of the page to jump to. The default is the title of the previous page. The value can be custom or null
- HeaderTruncatedBackTitle: Default to “back” if the previous page title does not match the text after the back arrow
- HeaderRight: Sets the right side of the navigation bar. This can be a button or other view control
- HeaderLeft: Sets the left side of the navigation bar. This can be a button or other view control
- HeaderStyle: Sets the style of the navigation bar. Background color, width and height
- HeaderTitleStyle: Sets the navigation text style
- HeaderBackTitleStyle: Sets the navigation bar ‘back’ text style
- HeaderTintColor: Sets the navigation bar color
- HeaderPressColorAndroid: Android unique Settings color texture, android version greater than 5.0
- GesturesEnabled: Indicates whether the swipe back gesture is supported. By default, it is supported on iOS and disabled on Android
- Screen: indicates the interface name. You need to fill in the page after import
- Mode: defines the jump style
- Card: Use the default style of iOS and Android
- Modal: iOS specifically draws the screen from the bottom. Ios-like present effect
- HeaderMode: Animation effect when returning to the previous page
- Float: iOS default effect
- Screen: The entire page is returned during the slide
- None: No animation
- CardStyle: Customizes jump effects
- TransitionConfig: Custom Settings slide-back configuration
- OnTransitionStart: function called when the transition animation is about to start
- OnTransitionEnd: The function that will be called when the transition animation is complete
- Path: indicates the override mapping configuration of the path specified in the route
- InitialRouteName: Sets the default page component, which must be registered above
- InitialRouteParams: indicates the initial route parameter
NavigationOptions: Configures some properties of StackNavigator. Title: The title of the navigation bar will be the same as the title of the TAB bar if this is set. It is not recommended to use header: Some navigation properties can be set. To hide the top navigation bar, just set this property to null headerTitle: Set the title of the navigation bar. HeaderBackTitle is recommended: Set the text after the return arrow on the left of the page. The default title is the previous page. This parameter can be customized or set to NULL headerTruncatedBackTitle: If the previous page title does not match the text after the return arrow, the default value is "Back" headerRight: Set the right side of the navigation bar. Can be a button or other view control. HeaderLeft: Sets the left side of the navigation bar. This can be a button or other view control headerStyle: Sets the style of the navigation bar. Background color, wide high headerTitleStyle: Set navigation bar text style headerBackTitleStyle: Set navigation bar 'back' text style headerTintColor: Set navigation bar color headerPressColorAndroid: GesturesEnabled: Whether the swipe back gesture is supported, which is supported by iOS by default, and disabled by Android by default screen: corresponds to the interface name, you need to fill in the page after import mode: defines the jump style card: Use iOS and Android's default modal style: iOS only draws the screen from the bottom. Present effect similar to iOS headerMode: animation effect when returning to the previous page Float: default effect of iOS Screen: None: no animation is returned throughout the page during scrolling cardStyle: OnTransitionStart: the function that will be called when the transition animation is about to begin onTransitionEnd: the function that will be called when the transition animation is complete path: InitialRouteName: Sets the default page component, which must be the page component registered above initialRouteParams: initial route parameterCopy the code
Note: Path may be confusing to you. The path property applies to other apps or browsers that use the URL to open the app and enter the specified page. The path attribute is used to declare an interface path, for example, [/pages/Home]. At this point, we can enter: APP name ://pages/Home in the mobile browser to start the app and enter the Home interface.
2. TabNavigator properties introduction
view plain
copy
?
- Screen: Provides the same function as navigation. You can use this screen to transfer values or jump to other pages corresponding to the interface name.
- NavigationOptions: Configures some properties of the TabNavigator
- Title: Specifies the title of the navigation bar and TAB bar
- TabBarVisible: Indicates whether to hide the label bar. Default not to hide (true)
- TabBarIcon: Icon for setting the TAB bar. You need to set it for each of them
- TabBarLabel: Sets the title of the label bar. recommended
- Navigation Bar Configuration
- TabBarPosition: Sets the tabbar position, which is at the bottom for iOS and at the top for Android. (Attribute values: ‘top’, ‘bottom’)
- SwipeEnabled: Whether to allow sliding between labels
- AnimationEnabled: Whether to display animation when changing labels
- Lazy: Whether to render tabs lazily as needed, rather than ahead, meaning that the bottom TAB bar is loaded when the app is opened. Default is false, and true is recommended
- TrueinitialRouteName: Sets the default page component
- BackBehavior: Indicates whether to press the back key to switch to the first Tab(home page)
- TabBarOptions: Configures some properties of the TAB bar iOS properties
- ActiveTintColor: Labels and ICONS are active in the foreground
- ActiveBackgroundColor: activeBackgroundColor of label and icon
- InactiveTintColor: Label and icon in inactive foreground color state
- InactiveBackgroundColor: The background color of label and icon is inactive
- ShowLabel: indicates whether to display label. Style: tabbar is enabled by default
- LabelStyle: The style android attribute of the label
- ActiveTintColor: Labels and ICONS are active in the foreground
- InactiveTintColor: Label and icon in inactive foreground color state
- ShowIcon: Indicates whether to display ICONS. The value is disabled by default
- ShowLabel: indicates whether to display label. Style: tabbar is enabled by default
- LabelStyle: indicates the label style. UpperCaseLabel: indicates whether to uppercase the label. The default value is true
- PressColor: Material Ripple effect color (Android version needs to be greater than 5.0)
- PressOpacity: Press TAB transparency changes (Android version requires less than 5.0)
- ScrollEnabled: indicates whether to enable the scrollable TAB tabStyle: indicates the style of TAB
- IndicatorStyle: The style object for the label indicator (the line at the bottom of the TAB). Android has an extra line at the bottom, so you can fix this by setting height to 0
- LabelStyle: The style of the label
- IconStyle: iconStyle
Screen: Provides the same function as navigation. You can use this screen to transfer values or jump to other pages corresponding to the interface name. NavigationOptions: set some properties of the TabNavigator. Title: set the title of the navigation bar and the tabBarVisible: whether to hide the TAB bar. Default unhidden (true) tabBarIcon: Sets the icon of the TAB bar. You need to set tabBarLabel for each: Set the title of the label bar. TabBarPosition: Set the tabbar position, which is at the bottom by default on iOS and at the top by default on Android. (Property values: 'top', 'bottom') swipeEnabled: Whether to allow sliding between labels animationEnabled: Whether to display animation when changing labels Lazy: Whether to render tabs lazily as needed, rather than early, meaning to load the bottom TAB bar when the app opens. Default is false, and true is recommended. TabBarOptions: Configures some properties of the Tab bar. IOS properties activeTintColor: ActiveBackgroundColor: activeBackgroundColor of label and icon InactiveBackgroundColor: Background color of label and icon inactive showLabel: Whether to display label, enabled by default Style: Tabbar style labelStyle: ActiveTintColor: Label and icon inactive state inactiveTintColor: Label and icon in inactive state showIcon: Style: tabbar style labelStyle: Label style upperCaseLabel: Indicates whether to uppercase the label. The default value is true pressColor: Indicates whether to uppercase the label. Material Ripple effect color (Android version > 5.0) pressOpacity: Change the transparency of the TAB when pressed (Android version < 5.0) scrollEnabled: Whether to enable the scrollable TAB tabStyle: IndicatorStyle: The style object for the label indicator (the line at the bottom of the TAB). Android will have an extra line at the bottom, so you can temporarily fix this by setting height to 0Copy the code
3. Introduction of DrawerNavigator properties
view plain
copy
?
- DrawerNavigatorConfig
- DrawerWidth – The width of the drawer
- DrawerPosition – Options are left or right. The default position is left
- ContentComponent – Components used to render the contents of the drawer, such as navigation items. Receive drawer navigation. The default is DrawerItems
- ContentOptions – Configures drawer contents
- InitialRouteName – Indicates the routeName of the initial route
- Order – routeNames array that defines the order of drawer items.
- Path – Provides a mapping of routeName to the path configuration, which overrides the path set in routeConfigs.
- BackBehavior – Does the back button switch to the initial route? If so, set it to initialRoute, otherwise none. The default is the initialRoute behavior
- The contentOptions property of DrawerItems
- ActiveTintColor – Active label and icon colors
- ActiveBackgroundColor – The background color of the active label
- InactiveTintColor – Label and icon colors for inactive labels
- InactiveBackgroundColor – Background color of an inactive label
- Style style object for the content section
- LabelStyle – The style object to override the text style in the content section when your label is a string
Drawerconfig drawerWidth - drawerWidth drawerPosition - options are left or right. The default is left contentComponent - a component that renders the contents of the drawer, such as navigation items. Receive drawer navigation. Default is DrawerItems contentOptions - configure drawer contents initialRouteName - routeName order for the initial route - routeNames array that defines DrawerItems order. Path - Provides a mapping of routeName to the path configuration, which overrides the path set in routeConfigs. BackBehavior - Does the back button switch to the initial route? If so, set it to initialRoute, otherwise none. Default is initialRoute behavior contentOptions property of DrawerItems activeTintColor - Active label label and icon color activeBackgroundColor - Active label background color InactiveTintColor - Label and icon colors for inactive labels inactiveBackgroundColor - Style of content section for inactive labels Style object labelStyle - When your label is a string, The style object to override the text style in the content sectionCopy the code
Given the basic properties of the three components of react navigation, it’s time to roll up our sleeves and see the magic.
4. Use StackNavigator + TabNavigator to switch Tab interface and navigate between interfaces
The API definition: StackNavigator (RouteConfigs StackNavigatorConfig), TabNavigator (RouteConfigs, NPM install React-navigation –save
view plain
copy
?
- import {StackNavigator,TabNavigator,TabBarBottom} from ‘react-navigation’;
- import HomeScreen from ‘./pages/HomePage’;
- import MineScreen from ‘./pages/MinePage’;
import {StackNavigator,TabNavigator,TabBarBottom} from 'react-navigation';
import HomeScreen from './pages/HomePage';
import MineScreen from './pages/MinePage';Copy the code
(3) Define TabNavigator
view plain
copy
?
- const Tab = TabNavigator(
- {
- Home:{
- screen:HomeScreen,
- navigationOptions:({navigation}) => ({
- TabBarLabel: ‘front page’,
- tabBarIcon:({focused,tintColor}) => (
- <TabBarItem
- tintColor={tintColor}
- focused={focused}
- normalImage={require(‘./imgs/[email protected]’)}
- selectedImage={require(‘./imgs/[email protected]’)}
- />
- )
- }),
- },
- Mine:{
- screen:MineScreen,
- navigationOptions:({navigation}) => ({
- TabBarLabel: ‘I’,
- tabBarIcon:({focused,tintColor}) => (
- <TabBarItem
- tintColor={tintColor}
- focused={focused}
- normalImage={require(‘./imgs/[email protected]’)}
- selectedImage={require(‘./imgs/[email protected]’)}
- />
- )
- }),
- },
- },
- {
- tabBarComponent:TabBarBottom,
- tabBarPosition:’bottom’,
- swipeEnabled:false,
- animationEnabled:false,
- lazy:true,
- tabBarOptions:{
- activeTintColor:’#06c1ae’,
- inactiveTintColor:’#979797′,
- style:{backgroundColor:’#ffffff’,},
- labelStyle: {
- FontSize: 20, // Text size
- },
- }
- }
- );
Const Tab = TabNavigator({Home:{screen:HomeScreen, navigationOptions:({navigation}) => ({tabBarLabel:' Home ', tabBarIcon:({focused,tintColor}) => ( <TabBarItem tintColor={tintColor} focused={focused} normalImage={require('./imgs/[email protected]')} selectedImage={require('./imgs/[email protected]')} /> ) }), }, Mine:{screen:MineScreen, navigationOptions:({navigation}) => ({tabBarLabel:' I ', tabBarIcon:({focused,tintColor}) => ( <TabBarItem tintColor={tintColor} focused={focused} normalImage={require('./imgs/[email protected]')} selectedImage={require('./imgs/[email protected]')} /> ) }), }, }, { tabBarComponent:TabBarBottom, tabBarPosition:'bottom', swipeEnabled:false, animationEnabled:false, lazy:true, tabBarOptions:{ activeTintColor:'#06c1ae', inactiveTintColor:'#979797', style:{backgroundColor:'#ffffff',}, labelStyle: {fontSize: 20, // text size},}});Copy the code
TabBarItem is an encapsulated component:
view plain
copy
?
- import React,{Component} from ‘react’;
- import {Image} from ‘react-native’;
- export default class TabBarItem extends Component {
- render() {
- return(
- <Image source={ this.props.focused ? this.props.selectedImage : this.props.normalImage }
- style={ { tintColor:this.props.tintColor,width:25,height:25 } }
- />
- )
- }
- }
import React,{Component} from 'react';
import {Image} from 'react-native';
export default class TabBarItem extends Component {
render() {
return(
<Image source={ this.props.focused ? this.props.selectedImage : this.props.normalImage }
style={ { tintColor:this.props.tintColor,width:25,height:25 } }
/>
)
}
}Copy the code
As you can see, we have defined a navigation component named TabNavigator [Tab]. In a component, there are two layers of parameters:
(1) The parameters of the first layer define the interface to be switched, namely [home page] and [ME] interface components, which are specified by screen attribute. And set the related property parameters through the navigationOptions property.
(2) Set the navigation bar property parameters.
Once TabNavigator is defined, you need to use StackNavigator, which, as the name suggests, holds the entire interface as a stack, whereas TabNavigator switches between different sub-interfaces within an interface. So we also need to define StackNavigator:
view plain
copy
?
- const Navigator = StackNavigator(
- {
- Tab:{screen:Tab},
- Product:{screen:ProductScreen}
- },
- {
- navigationOptions:{
- headerBackTitle:null,
- headerTintColor:’#333333′,
- showIcon:true,
- swipeEnabled:false,
- animationEnabled:false,
- },
- mode:’card’,
- });
const Navigator = StackNavigator(
{
Tab:{screen:Tab},
Product:{screen:ProductScreen}
},
{
navigationOptions:{
headerBackTitle:null,
headerTintColor:'#333333',
showIcon:true,
swipeEnabled:false,
animationEnabled:false,
},
mode:'card',
});
Copy the code
It looks similar to TabNavigator, which also specifies two parameters:
(1) Specify the interface component to jump to. The screen attribute is also used to identify interface components.
(2) Define jump attribute parameters, that is, some parameter Settings and jump modes of the top navigation bar.
As you can see, we set Tab as an interface to StackNavigator. In this way, Tab navigation and interface hopping can be achieved.
Finally, the StackNavigator reference in render:
view plain
copy
?
- export default class Demo extends Component {
- render() {
- return (
- <Navigator />
- );
- }
- }
export default class Demo extends Component { render() { return ( <Navigator /> ); }}Copy the code
StackNavigator also provides an onNavigationStateChange callback method to listen for changes in navigation state. I will not repeat the details. Realize the interface jump and switch, then it is time to increase the feelings between the interfaces, to see how to realize the interface between the value and value.
5. Jump, transfer and value between interfaces
When the interface component is injected into the StackNavigator, the interface component is given a navigation property, that is, the interface component can be retrieved and performed with [this.props. Navigation]. Navigate (1) to navigate between interfaces, navigate provides a number of functions in the navigation attribute to make it easier to navigate between interfaces.
view plain
copy
?
- this.props.navigation.navigate(‘Mine’);
this.props.navigation.navigate('Mine');Copy the code
The parameter is the name we registered the interface component with StackNavigator. It is also possible to return to the previous page from the current page:
view plain
copy
?
- // return to the previous page
- this.props.navigation.goBack();
/ / return back this props. Navigation. GoBack ();Copy the code
(2) Value transfer during jump:
view plain
copy
?
- This. Props. Navigation. Navigate (‘ Mine ‘{info:’ the value in the past ‘});
This. Props. Navigation. Navigate (' Mine '{info:' the value in the past '});Copy the code
The first parameter is also the name of the interface component to jump to. The second parameter is the parameter to pass.
(3) Obtain value:
view plain
copy
?
- {this.props.navigation.state.params.info}
{this.props.navigation.state.params.info}Copy the code
Get the passed parameter via state.params followed by the key value. This is info.
With that done, we can have fun ~~ What? Suddenly found the effect on Android and IOS effect is not the same. Boss want interface consistent wow ~ how to do? Then we need to do a simple adaptation.
DrawerNavigator realizes drawer navigation
1. Navigation implementation
API definition: DrawerNavigator (RouteConfigs, DrawerNavigatorConfig)
(1) DrawerNavigator is defined in the interface:
view plain
copy
?
- import {StackNavigator,TabNavigator,DrawerNavigator} from ‘react-navigation’;
- import HomeScreen from ‘./pages/HomePage’;
- import MineScreen from ‘./pages/MinePage’;
- export default class Demo extends Component {
- render() {
- return (
- <Navigator />
- );
- }
- }
- const Navigator = DrawerNavigator({
- Home:{screen:HomeScreen},
- Mine:{screen:MineScreen},
- });
- const styles = StyleSheet.create({
- container: {
- flex: 1,
- },
- });
- AppRegistry.registerComponent(‘Demo’, () => Demo);
import {StackNavigator,TabNavigator,DrawerNavigator} from 'react-navigation';
import HomeScreen from './pages/HomePage';
import MineScreen from './pages/MinePage';
export default class Demo extends Component {
render() {
return (
<Navigator />
);
}
}
const Navigator = DrawerNavigator({
Home:{screen:HomeScreen},
Mine:{screen:MineScreen},
});
const styles = StyleSheet.create({
container: {
flex: 1,
},
});
AppRegistry.registerComponent('Demo', () => Demo);Copy the code
The definition is basically similar to StackNavigator, so I won’t go into details here.
(2) HomeScreen interface and MineScreen interface:
view plain
copy
?
- export default class HomePage extends Component {
- static navigationOptions = {
- DrawerLabel: ‘home ‘,
- drawerIcon:({tintColor}) => (
- <Image
- source={require(‘./.. /imgs/ic_happy.png’)}
- style={[styles.icon, {tintColor: tintColor}]}/>
- ),
- };
- render() {
- return(
- <View style={{flex:1}} >
- <Text onPress={this._skip.bind(this)} >Click the jump</Text>
- </View>
- );
- }
- _skip() {
- this.props.navigation.navigate(“Mine”);
- }
- }
- export default class MinePage extends Component {
- static navigationOptions = {
- DrawerLabel: ‘I’,
- drawerIcon: ({ tintColor }) => (
- <Image
- source={require(‘./.. /imgs/ic_h.png’)}
- style={[styles.icon, {tintColor: tintColor}]}
- />
- ),
- };
- render() {
- return(
- <View style={{flex:1}} >
- <Text onPress={this._skip.bind(this)} >The previous screen is displayed</Text>
- </View>
- );
- }
- / * *
- * jump
- * /
- _skip() {
- this.props.navigation.goBack();
- }
- }
export default class HomePage extends Component { static navigationOptions = { drawerLabel: 'front page' drawerIcon: {tintColor}) = > (< Image source = {the require ('. /.. /imgs/ic_happy.png')} style={[styles.icon, {tintColor: tintColor}]}/> ), }; Render () {return(<View style={{{flex:1}}> <Text onPress={this._skip.bind(this)}> </Text> </View>); } _skip() { this.props.navigation.navigate("Mine"); }} export default class MinePage extends Component {static navigationOptions = {drawerLabel:' I ', drawerIcon: ({ tintColor }) => ( <Image source={require('./.. /imgs/ic_h.png')} style={[styles.icon, {tintColor: tintColor}]} /> ), }; Render () {return(<View style={{{flex:1}}> <Text onPress={this._skip.bind(this)}> </Text> </View>); } / jump * * * * / _skip () {this. Props. Navigation. GoBack (); }}Copy the code
The code is very simple, to achieve the jump between the interface.
2. Extended functions
(1) Default DrawerView is not scrollable. To implement scrollable views, you must use a custom container with contentComponent, as shown below:
view plain
copy
?
- {
- DrawerWidth: 200,
- Drawer position: “Right”
- ContentComponent:props => <ScrollView> <DrawerItems {… props} /> </ ScrollView >
- }
{drawerWidth: 200, DrawerItems: "props" contentComponent: > <ScrollView> <DrawerItems {... props} /> </ ScrollView> }Copy the code
(2) You can override the default navigation components and use DrawerItems to customize the navigation components:
view plain
copy
?
- import {DrawerItems} from ‘react-navigation’;
- const CustomDrawerContentComponent = (props) => (
- <View style = {style.container}>
- <DrawerItems {… props} />
- </View>
- );
import {DrawerItems} from 'react-navigation';
const CustomDrawerContentComponent = (props) => (
<View style = {style.container}>
<DrawerItems {... props} />
</View>
);
Copy the code
(3) Nested drawer navigation
If you have nested DrawerNavigation, the drawer will appear below the parent navigation.
4. React-navigation
(1) Adapt to the top navigation bar title:
In tests, the title bar title is centered on the iPhone, but left aligned on Android. So we need to modify the source code, adaptation.
Node_modules — react-navigation — SRC — views — header. js
view plain
copy
?
- title: {
- bottom: 0,
- left: TITLE_OFFSET,
- right: TITLE_OFFSET,
- top: 0,
- position: ‘absolute’,
- alignItems: ‘center’,
- }
title: {
bottom: 0,
left: TITLE_OFFSET,
right: TITLE_OFFSET,
top: 0,
position: 'absolute',
alignItems: 'center',
}Copy the code
(2) Remove the text display of return key:
Node_modules — react-navigation — SRC — views — headerbackbutton.js node_modules — react-navigation — SRC — views — headerbackbutton.js
view plain
copy
?
- {Platform.OS === ‘ios’ &&
- title &&
- <Text
- onLayout={this._onTextLayout}
- style={[styles.title, { color: tintColor }]}
- numberOfLines= {1}
- >
- {backButtonTitle}
- </Text>}
{Platform.OS === 'ios' &&
title &&
<Text
onLayout={this._onTextLayout}
style={[styles.title, { color: tintColor }]}
numberOfLines={1}
>
{backButtonTitle}
</Text>}Copy the code
Delete the above code.
(3) Set the button click event of the title bar:
NavigationOptions needs to be static when setting the title parameter in the interface component. Bind (this) can’t call a custom function directly through this.xxx.bind(this). It can be solved by:
view plain
copy
?
- class demo extends Component {
- static navigationOptions =({navigation})=>({
- right:( <Button onPress={state.params.clickParams} />)
- })
- _btnClick= = ()> {
- Alert (‘ click ‘)
- };
- componentWillMount() {
- this.props.navigation.setParams({clickParams:this._btnClick})
- }
- }
class demo extends Component { static navigationOptions =({navigation})=>({ right:( <Button OnPress = {state. Params. ClickParams}}) / >) _btnClick = () = > {alert (' click ')}; componentWillMount() { this.props.navigation.setParams({clickParams:this._btnClick}) } }Copy the code
(4) Dynamically set the title bar display and hide
According to the idea in (3), we can use setParams to dynamically modify the display and hide of the status bar:
view plain
copy
?
- class demo extends Component {
- static navigationOptions = ({navigation}) =>({
- visible: state.params.headerState ,
- });
- render(){
- return(
- <Button
- title=“Hide Header”
- onPress= = {()> this.props.navigation.setParams({ headerState : ‘none’ })}
- />)
- }
- }
class demo extends Component {
static navigationOptions = ({navigation}) =>({
visible: state.params.headerState ,
});
render(){
return(
<Button
title="Hide Header"
onPress={() => this.props.navigation.setParams({ headerState : 'none' })}
/>)
}
}Copy the code
Five, effect drawing
Drawer navigation:
These are the attributes and skills commonly used in our actual combat. Specific operation still needs everybody to test experience in practice process.