码迷,mamicode.com
首页 > 微信 > 详细

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

时间:2017-08-12 14:41:53      阅读:408      评论:0      收藏:0      [点我收藏+]

标签:sheet   dimen   .com   option   ati   label   import   screen   code   


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


技术分享

 

 

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

标签:sheet   dimen   .com   option   ati   label   import   screen   code   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!