简单的切换页面(类似于微信)


//在App.js中实现
import React from react;import { StyleSheet, Text, View } from react-native;import { StackNavigator, TabNavigator, TabBarBottom,} from react-navigation;const MainView = TabNavigator({ MessageView:{screen:MessageView}, FriendView:{screen: FriendView}, MyView:{screen:MyView}, SetView:{screen:SetView},},{ tabBarComponent:TabBarBottom, tabBarPosition:bottom, swipeEnabled:false, tabBarOptions:{ // showLabel:false, style:{ height:70, } }});


//在你需要切换的页面实现
import React, { Component } from react;import { View, Text, StyleSheet, Button, Image, Dimensions, FlatList,} from react-native;export default class FriendView extends Component { static navigationOptions={ title:朋友, headerLeft:null, headerTitleStyle:{ alignSelf:center, }, tabBarIcon:({ focused, tintColor})=>{ if(focused==true){ return( <Image style={{width:40,height:40}} source={require(../assets/images/icon2.png)} /> ) }else { return( <Image style={{width:35,height:35}} source={require(../assets/images/icon3.png)} /> ) } } }



技术分享

 

 

相关文章