底部导航栏加图片
发布于 1 年前 作者 s123rr 440 次浏览 来自 客户端测试

import React from “react”; import { createBottomTabNavigator } from “react-navigation”; import Ionicons from “react-native-vector-icons/Ionicons”; import Publish from “./Publish”; import My from “./My”; import List from “./List”; const Good = () => { return <List tab=“good” />; }; const BottomNav = createBottomTabNavigator( { Good: { screen: Good, navigationOptions: { title: “帖子” } }, Publish: { screen: Publish, navigationOptions: { title: “发布” } }, My: { screen: My, navigationOptions: { title: “我的” } } }, { navigationOptions: ({ navigation }) => ({ tabBarIcon: ({ focused, tintColor }) => { const { routeName } = navigation.state; let iconName; if (routeName === “Good”) { //切换不同的图标 iconName = ios-document; } else if (routeName === “Publish”) { iconName = ios-create; } else if (routeName === “My”) { iconName = ios-person; } return <Ionicons name={iconName} size={25} color={tintColor} />; } }) } );

export default BottomNav;

回到顶部