该图标显示在屏幕/页面中,但不会显示在底部导航中。我尝试过的解决方案:
- 按照github的安装指南,我尝试了GRADLE和MANUAL选项,但结果相同
- 曾经尝试过
./gradlew clean
,npx react-native run-android
但结果相同 - 曾经尝试过
npx react-native link react-native-vector-icons
,npx react-native run-android
但结果相同
屏幕截图底部导航栏
截图设置画面
它确实出现在屏幕/页面中,如上面的屏幕截图所示,但不会显示在底部导航中。
注意:我已经在模拟器和真正的 android 设备上进行了测试,但仍然得到相同的结果!
底部选项卡的代码
import React from 'react'
import { StyleSheet, Text, View } from 'react-native'
import Ionicons from 'react-native-vector-icons/Ionicons'
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'
import ProductNavigation from './ProductNavigation'
import SettingScreen from '../screen/SettingScreen'
const BottomTab = createBottomTabNavigator();
const BottomTabNav = () => {
return (
<BottomTab.Navigator>
<BottomTab.Screen
name="Home"
component={ProductNavigation}
options={{
tabBarLabel: "Home",
tabBarIcon:({color, size}) => {
<Ionicons name="home-outline" color={color} size={size} />
}}} />
<BottomTab.Screen
name="Settings"
component={SettingScreen}
options={{
tabBarLabel: "Settings",
tabBarIcon: ({color, size}) => {
<Ionicons name="settings-outline" color={color} size={size}
/>
}}} />
</BottomTab.Navigator>
)
}
export default BottomTabNav
const styles = StyleSheet.create({})