当我从react-native-vector-icons添加图标时反应React Native错误

时间:2018-11-19 20:05:26

标签: react-native react-navigation react-native-vector-icons

我正在用React Native构建我的第一个应用程序。 我正在使用react-navigation bottomTabNavigator,当我在标签上添加图标时,我的应用无法在Android上运行。 iOS运行正常。

Here is the gist with my Menu.js code

即使我注释掉使用图标的行(图标本身,也就是导入内容),错误仍会继续。 但是我不知道发生了什么,因为当我开始使用图标时,该错误开始于Android。

在iOS中,一切正常。

有帮助吗?

1 个答案:

答案 0 :(得分:-1)

在android中,您必须包含public ViewModel1 ViewModel1 { get; set; } = new ViewModel1(); public ViewModel2 ViewModel2 { get; set; } = new ViewModel2(); ,然后它才能工作。例如:

icon="require('some path like images')"