React native Navigation(路由)
1.先安装所需要的包
yarn add react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-community/masked-view
2.新建文件,配置路由(这个文件是总路由)
import React, {
Component } from 'react'
import {
createAppContainer } from 'react-navigation'
import {
createBottomTabNavigator, BottomTabBar } from 'react-navigation-tabs'
import {
Image, StyleSheet, } from 'react-native'
//引入要tabar的页面
import IndexRootStack from './Homerouter'
import Usersrouter from './Usersrouter'
//底部导航配置
const Tabs = {
Index: {
screen: IndexRootStack, // 上面引入的tabar页面
navigationOptions: {
tabBarLabel: "首页", //底部tabar的title
headerTitleStyle: {
fontSize: 20, color: 'white', fontWeight: '500' }, //头部导航样式
//tabar激活与不激活的图片
tabBarIcon: ({
focused }) =>