React native 图标未显示在react Native中的BottomTabNavigator中

React native 图标未显示在react Native中的BottomTabNavigator中,react-native,react-navigation,react-native-navigation,React Native,React Navigation,React Native Navigation,我一直在开发这个简单的移动应用程序。我试图在底部选项卡导航上显示一些图标,而不是标签,但图标没有显示出来。有人能帮我找出问题所在吗 我一直在开发这个简单的移动应用程序。我试图在底部选项卡导航上显示一些图标,而不是标签,但图标没有显示出来。有人能帮我找出问题所在吗 这是我的密码: import React from 'react'; import { StyleSheet, Text, View, Image } from 'react-native'; import { createAppCon

我一直在开发这个简单的移动应用程序。我试图在底部选项卡导航上显示一些图标,而不是标签,但图标没有显示出来。有人能帮我找出问题所在吗

我一直在开发这个简单的移动应用程序。我试图在底部选项卡导航上显示一些图标,而不是标签,但图标没有显示出来。有人能帮我找出问题所在吗

这是我的密码:

import React from 'react';
import { StyleSheet, Text, View, Image } from 'react-native';
import { createAppContainer } from 'react-navigation';
import { createBottomTabNavigator } from 'react-navigation-tabs';
import { createStackNavigator } from 'react-navigation-stack';

import { Icon } from 'react-native-elements';

// Components
import Home from './src/components/home/Home'
import EventInfo from './src/components/common/eventInfo/EventInfo'
import Profile from './src/components/profile/Profile'
import Browse from './src/components/browse/Browse'
import Activity from './src/components/activity/Activity'

import homeIcon from './src/images/home.png'
import browseIcon from './src/images/home.png'
import activityIcon from './src/images/home.png'
import profileIcon from './src/images/home.png'

import myIcon from './src/images/activity.png';

const HomeStackNavigator = createStackNavigator({
  Home: {
    screen: Home
  },
  EventInfo: {
    screen: EventInfo
  },
},{
  initialRouteName: 'Home', 
})

const BrowseStackNavigator = createStackNavigator({
  Browse: {
    screen: Browse
  },
},{
  initialRouteName: 'Browse', 
})

const ActivityStackNavigator = createStackNavigator({
  Activity: {
    screen: Activity
  },
},{
  initialRouteName: 'Activity', 
})

const ProfileStackNavigator = createStackNavigator({
  Profile: {
    screen: Profile
  },
  EventInfo: {
    screen: EventInfo
  },
},{
  initialRouteName: 'Profile', 
})

const AppNavigator = createBottomTabNavigator({
  Home : HomeStackNavigator,
  Browse: BrowseStackNavigator,
  Activity: ActivityStackNavigator,
  Profile : ProfileStackNavigator,
},{
  initialRouteName:'Profile',
  defaultNavigationOptions: ({ navigation }) => ({
    tabBaricon: ({ focused, horizontal, tintColor }) => {
        return (
          <Image 
            source={myIcon}
            style={{width:30, height:30}} 
          />
        );
    },
  }),
  tabBarOptions: {
  }
}

);

export default createAppContainer(AppNavigator);

从“React”导入React;
从“react native”导入{样式表、文本、视图、图像};
从“react navigation”导入{createAppContainer};
从“反应导航选项卡”导入{CreateBoottomTabNavigator};
从“反应导航堆栈”导入{createStackNavigator};
从“react native elements”导入{Icon};
//组成部分
从“./src/components/Home/Home”导入主目录
从“./src/components/common/EventInfo/EventInfo”导入事件信息
从“./src/components/Profile/Profile”导入配置文件
从“./src/components/Browse/Browse”导入浏览
从“./src/components/Activity/Activity”导入活动
从“./src/images/home.png”导入homeIcon
从“./src/images/home.png”导入browseIcon
从“./src/images/home.png”导入activityIcon
从“./src/images/home.png”导入profileIcon
从“/src/images/activity.png”导入myIcon;
const HomeStackNavigator=createStackNavigator({
主页:{
屏幕:主页
},
事件信息:{
屏幕:EventInfo
},
},{
initialRouteName:“主页”,
})
const BrowseStackNavigator=createStackNavigator({
浏览:{
屏幕:浏览
},
},{
initialRouteName:“浏览”,
})
常量ActivityStackNavigator=createStackNavigator({
活动:{
屏幕:活动
},
},{
initialRouteName:“活动”,
})
const ProfileStackNavigator=createStackNavigator({
简介:{
屏幕:配置文件
},
事件信息:{
屏幕:EventInfo
},
},{
initialRouteName:“配置文件”,
})
const AppNavigator=createBottomTabNavigator({
主页:HomeStackNavigator,
Browse:BrowseStackNavigator,
活动:ActivityStackNavigator,
Profile:ProfileStackNavigator,
},{
initialRouteName:“配置文件”,
defaultNavigationOptions:({navigation})=>({
tabBaricon:({聚焦、水平、着色})=>{
返回(
);
},
}),
选项卡选项:{
}
}
);
导出默认createAppContainer(AppNavigator);

这将解决您的问题。你也应该考虑通过文档并更好地理解。
。。。
const AppNavigator=createBottomTabNavigator({
简介:{
屏幕:配置文件,
导航选项:{
tabBarIcon:({focused})=>(
)
}
},
事件信息:{
屏幕:EventInfo,
导航选项:{
tabBarIcon:({focused})=>(
)
}
},
}, {
initialRouteName:“配置文件”,
});
...

请让我知道这是否有帮助。

这将解决您的问题。你也应该考虑通过文档并更好地理解。
。。。
const AppNavigator=createBottomTabNavigator({
简介:{
屏幕:配置文件,
导航选项:{
tabBarIcon:({focused})=>(
)
}
},
事件信息:{
屏幕:EventInfo,
导航选项:{
tabBarIcon:({focused})=>(
)
}
},
}, {
initialRouteName:“配置文件”,
});
...

如果这有帮助,请告诉我。

@Alex Cool。那么请接受它作为正确答案。@Alex很酷。那么请接受它作为正确答案。