【问题标题】:when I use Nativebase getImageSource React native shows me RNVectorIcons module not available当我使用 Nativebase getImageSource React native 显示 RNVectorIcons 模块不可用
【发布时间】:2019-04-14 02:49:48
【问题描述】:

当我使用 Native Base 矢量图标时,它显示“RNVectorIcons 模块不可用”

我正在安装 Native Base 但没有单独安装 RN-Vector-Icons

你能找到这个对我或其他人真的有帮助的错误吗

Here the Full Error Image

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 已安装在图标导入中

enter image description here

【问题讨论】:

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


    【解决方案1】:

    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() 动态加载图标字体。

    【讨论】:

    • 当我链接库时它告诉我 * 出了什么问题:任务 ':app:compileDebugJavaWithJavac' 执行失败。 > 编译失败;有关详细信息,请参阅编译器错误输出 * 此错误
    • @abdulMoiz 能否请您分享完整的错误或截图。
    • 亲爱的,当我在没有安装 npm install react-native-vector-icons 的情况下链接 React-native Vector Icons 时,它已成功链接并成功为 android 构建,但显示未显示
    • 你一定要检查这张图片i.stack.imgur.com/TRZDp.png 它可能会帮助你找到错误
    • 是的 react-native link react-native-vector-icons 以前使用过相同的链接。链接后,我的应用在 Android 模拟器中显示空白屏幕
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-30
    • 1970-01-01
    相关资源
    最近更新 更多