图标未出现在react-native中

时间:2018-10-10 14:27:32

标签: 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

4 个答案:

答案 0 :(得分:1)

通过使用df %>% mutate(x=str_replace_all(chartr("M",".",Position),"E","\\(\\.\\)"), output=paste0(str_replace(Col1,x,"\\1"),"|",str_replace(Col2,x,"\\1"), " , ",str_replace(Col1,x,"\\2"),"|",str_replace(Col2,x,"\\2"))) # Col1 Col2 Position Desired.Output x output #1 Stores Ostues EMMEMM S|O , r|u (.)..(.).. S|O , r|u #2 University Unasersity MMEEMMMMMM i|a , v|s ..(.)(.)...... i|a , v|s #3 Street Straeq MMMEME e|a , t|q ...(.).(.) e|a , t|q 确保在iOS工作区中链接了字体,然后重新构建应用程序

按照文档进行操作,并确保所有设置均如他们提到的那样 https://github.com/oblador/react-native-vector-icons#ios

答案 1 :(得分:1)

运行命令npm i -g rnpm。并在项目文件夹上运行rnpm链接。然后运行项目。

答案 2 :(得分:0)

在您的项目文件夹中运行以下命令。

$react-native 链接

答案 3 :(得分:0)

您是否将其粘贴到应用级别的 gradle 中??

apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"