react-native - 当我使用 Nativebase getImageSource React native 时显示 RNVectorIcons 模块不可用
问题描述
当我使用 Native Base 矢量图标时,它显示“RNVectorIcons 模块不可用”
我正在安装 Native Base 但没有单独安装 RN-Vector-Icons
你能找到这个错误吗?它对我或其他人真的有帮助吗
import { Navigation } from "react-native-navigation";
import Icon from 'react-native-vector-icons/AntDesign'; // for nativeBase getImageSource
const goAuth = () => {
Promise.all([
Icon.getImageSource('adduser', 15),
Icon.getImageSource('login', 15)
]).then(source => {
Navigation.setRoot({
root: {
id: 'authSccreen',
bottomTabs: {
children: [{
component: {
name: 'signIn',
options: {
text: 'signIn',
icon: source[0]
}
}
},
{
component: {
name: 'signUp',
options: {
text: 'signUp',
icon: source[1]
}
}
}],
}
}
})
})
}
export default goAuth
并检查此图像,它显示 GetImageSource 已安装在图标导入中
解决方案
在 npm install react-native-vector-icons
您拥有该矢量图标库的链接之后。如果您尝试使用android ,我认为您忘记链接该库只需触发此命令
react-native link react-native-vector-icons
对于ios
将以下内容添加到您的 Podfile 并运行 pod update:
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
如上所述编辑 Info.plist。
如果您使用的是 use_frameworks!在您的 Podfile 中,您需要在引导应用程序时通过执行 Icon.loadFont() 来动态加载图标字体。
推荐阅读
- javafx - 在 Eclipse 中使用 MediaPlayer 编译示例 JavaFx 代码时出错
- php - Symfony - 使用 swiftmailer 的电子邮件中未显示图像
- c# - 使用 ViewModel 将 WPF 数据绑定到 UserControl 上的属性
- vhdl - 在 7 段显示器上显示 3 位
- security - 如何从页面源中隐藏敏感 URL
- swift - 如何重置 SceneKit pointOfView 相机
- stata - 将秒数更改为字符串
- dart - 同步 ListView 滚动位置
- android - 资产文件夹图像上的倒数计时器
- android - Pie中的Android vndk