本地图片
Showye: {
screen: Showye,
navigationOptions: {
title: “首页”,
、、、、、、本地图片
tabBarIcon: ({ focused, tintColor }) => {
return (
<Image
style={{ width: 30, height: 30 }}
source={require("./ima/r.png")}
/>
);
}
}
},
2.底部导航栏设置属性:
导入三方图片库:yarn add react-native-vector-icons
引入关联:react-native link
导入依赖:
import Ionicons from "react-native-vector-icons/Ionicons";
import React, { Component } from "react";
Android项目中做编译,运行(更新、更新、更改implementation)
{
navigationOptions: ({ navigation }) => ({
tabBarIcon: ({ focused, horizontal, tintColor }) => {
const { routeName } = navigation.state;
let iconName;
if (routeName === "BottDemo1") {
iconName = `ios-information-circle`;
} else if (routeName === "Route") {
iconName = `ios-options`;
} else if (routeName === "BottDemo2") {
iconName = `ios-document`;
}
return (
<Ionicons
name={iconName}
size={horizontal ? 20 : 25}
color={tintColor}
/>
);
}
})
// tabBarOptions: {
// activeTintColor: "#0000FF",
// inactiveTintColor: "gray",
// activeBackgroundColor: "#00FF00",
// inactiveBackgroundColor: "#FF0000"
// }
}