当我使用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
并检查此图像,它显示我在Icon导入中安装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()来动态加载图标字体。