欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

RN底部导航栏 本地图片

程序员文章站 2022-07-16 14:38:31
...

本地图片
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"
// }

}

相关标签: RN