React-Native 底部切换卡(安卓)开发

import React, { Component } from 'react';
import {
    AppRegistry,
    Dimensions,
    StyleSheet,
    View,
    Text,
    Button,
    Image,
} from 'react-native';
import { TabNavigator } from "react-navigation";
let ScreenWidth = Dimensions.get('window').width;
let ScreenHeight = Dimensions.get('window').height;


class MyHomeScreen extends React.Component {
  static navigationOptions = {
    tabBarLabel: '首页',
    tabBarIcon: ({ tintColor }) => (
      
    ),
  };

  render() {
    return (
      这是第一个页面
    );
  }
}

class MyNotificationsScreen extends React.Component {
  static navigationOptions = {
    tabBarLabel: '我的',
    tabBarIcon: ({ tintColor }) => (
      
    ),
  };
  render() {
    return (
      这是第2个页面
    );
  }
}

class SearchScreen extends React.Component {
  static navigationOptions = {
    tabBarLabel: '找房',
    tabBarIcon: ({ tintColor }) => (
      
    ),
  };
  render() {
    return (
      这是第3个页面
    );
  }
}

const styles = StyleSheet.create({
  icon: {
    width: 25,
    height: 25,
  },
});

const MyApp = TabNavigator(
  {
    Home: {
      screen: MyHomeScreen,
    },
    Notifications: {
      screen: MyNotificationsScreen,
    },
    Search: {
      screen: SearchScreen,
    },
  },
  {
    tabBarPosition:"bottom",
    swipeEnabled:false,
    tabBarOptions: {
      activeTintColor: '#333',
      inactiveBackgroundColor: "#f1f1f1",//IOS
      inactiveTintColor:"#666",
      showIcon:true,
      labelStyle: {
        fontSize: 12,
        color:"#666",
      },
      style: {
        borderTopWidth:1,
        borderTopColor:'#ccc',
        backgroundColor: '#f1f1f1', //android
      },
      indicatorStyle:{
        height:0,
      },
    },
  }
);

module.exports = MyApp;


你可能感兴趣的:(React-Native 底部切换卡(安卓)开发)