代码拉取完成,页面将自动刷新
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow strict-local
*/
import React, {Component} from 'react';
import {StyleSheet, View, StatusBar} from 'react-native';
import Home from './component/tabbars/Home';
import Me from './component/tabbars/Me';
import Search from './component/tabbars/Search';
import ShopCar from './component/tabbars/ShopCar';
//导入tabbar组件
//导入图标组件
import Icon from 'react-native-vector-icons/FontAwesome';
import TabNavigator from 'react-native-tab-navigator';
export default class App extends Component {
constructor(props) {
super(props);
this.state = {
selectedTab: 'Home',
};
}
render() {
return (
<View style={styles.container}>
<StatusBar backgroundColor="#FB7299" />
<TabNavigator>
<TabNavigator.Item
selected={this.state.selectedTab === 'Home'}
title="Home"
renderIcon={() => <Icon name="home" size={30} color="#ccc" />}
renderSelectedIcon={() => (
<Icon name="home" size={30} color="#0079ff" />
)}
onPress={() => this.setState({selectedTab: 'Home'})}>
<Home />
</TabNavigator.Item>
<TabNavigator.Item
selected={this.state.selectedTab === 'Search'}
title="Search"
renderIcon={() => <Icon name="search" size={30} color="#ccc" />}
renderSelectedIcon={() => (
<Icon name="search-plus" size={30} color="#0079ff" />
)}
onPress={() => this.setState({selectedTab: 'Search'})}>
<Search />
</TabNavigator.Item>
<TabNavigator.Item
selected={this.state.selectedTab === 'ShopCar'}
title="ShopCar"
renderIcon={() => (
<Icon name="shopping-bag" size={28} color="#ccc" />
)}
renderSelectedIcon={() => (
<Icon name="shopping-bag" size={28} color="#0079ff" />
)}
badgeText="1"
onPress={() => this.setState({selectedTab: 'ShopCar'})}>
<ShopCar />
</TabNavigator.Item>
<TabNavigator.Item
selected={this.state.selectedTab === 'me'}
title="Me"
renderIcon={() => <Icon name="user-o" size={28} color="#ccc" />}
renderSelectedIcon={() => (
<Icon name="user" size={28} color="#0079ff" />
)}
onPress={() => this.setState({selectedTab: 'me'})}>
<Me />
</TabNavigator.Item>
</TabNavigator>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
});
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。