美文网首页
react-navigation4.x 标签栏(二)

react-navigation4.x 标签栏(二)

作者: 喜剧收尾_XWX | 来源:发表于2020-04-21 10:38 被阅读0次

    一、标签栏

    1.安装

    npm install react-navigation-tabs --save
    

    二、使用

    1.基础使用

    import React from 'react';
    import { Text, View } from 'react-native';
    import { createAppContainer } from 'react-navigation';
    import { createBottomTabNavigator } from 'react-navigation-tabs';
    
    class HomeScreen extends React.Component {
      render() {
        return (
          <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
            <Text>Home!</Text>
          </View>
        );
      }
    }
    
    class SettingsScreen extends React.Component {
      render() {
        return (
          <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
            <Text>Settings!</Text>
          </View>
        );
      }
    }
    
    const TabNavigator = createBottomTabNavigator({
      Home: HomeScreen,
      Settings: SettingsScreen,
    });
    
    export default createAppContainer(TabNavigator);
    

    2.

    相关文章

      网友评论

          本文标题:react-navigation4.x 标签栏(二)

          本文链接:https://www.haomeiwen.com/subject/efnsihtx.html