首页 > 微信 > 详细

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

时间:2017-08-12 14:34:57      阅读:285      评论:0      收藏:0      [点我收藏+]

//在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)}
          />
        )
      }
    }
  }


技术分享

 

 

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

原文:http://www.cnblogs.com/sunny-pei666/p/7350027.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!