javascript - 图标没有出现在 react native 中

标签 javascript reactjs react-native react-navigation

我使用react-native-vector-icons/FontAwesome来显示图标,使用react-navigation来显示选项卡。我试图在按钮导航中显示主页图标,但图标没有出现。

Icon和createBottomTabNavigator的PFB相关代码

import React from 'react';
import { createBottomTabNavigator } from 'react-navigation';
// import { Icon } from 'react-native-elements';
import Icon from 'react-native-vector-icons/FontAwesome';

import Account from '../../Form/components/Account';
import Home from '../../Layout/components/Home';

export const Tabs = createBottomTabNavigator({
  Account: { 
    screen: Account,
    navigationOptions: {
      tabBarLabel: 'Account',
      tabBarIcon: ({ tintColor }) => <Icon name="rocket" size={35} color="#fdc94c" />
    }
  },
  Home: { 
    screen: Home,
    navigationOptions: {
      tabBarLabel: 'Home',
      tabBarIcon: ({ tintColor }) => <Icon name="rocket" size={35} color="#fdc94c" />
    },
 }
}, {
  order: ['Home', 'Account'],
  tabBarOptions: {
      showLabel: true,
      showIcon: true,
      activeBackgroundColor: '#42a5f5',
      style: {
        backgroundColor: '#42a5f5',
        paddingVertical: 10,
        height: 60
      },
      indicatorStyle: {
        backgroundColor: '#42a5f5',
      }
    }
})

还有 PFB 屏幕截图。

我需要做什么才能显示主页图标? enter image description here

最佳答案

使用 react-native link react-native-vector-icons 确保字体已链接到您的 iOS 工作区中,然后重建应用程序

遵循文档并确保一切都按照他们提到的方式设置 https://github.com/oblador/react-native-vector-icons#ios

关于javascript - 图标没有出现在 react native 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52742538/

相关文章:

javascript - 获取 url 到 React 组件

javascript - 在 React 状态中保持更新的对象关系

ios - react 导航重置操作不起作用

javascript - 在javascript中将整数数组转换为字符串

javascript - 将值传递给 javascript 到 php 变量 : It do not work?

javascript - 如何在 react 传单中选择一个区域

javascript - 如何在其他域中嵌入 React 组件?

javascript - 错误 : Unable to resolve module `@react-native-community/toolbar-android`

javascript - React Native 在新初始化的应用程序上找不到模块 ./index

javascript - 如何在 Leaflet map 中显示 ArcGIS Server TileLayer