首页 > 解决方案 > react-native-vector-icon 显示“错误”图标

问题描述

我正在使用react-native-vector-icons我的 React 本机项目。最近,当我打开我的应用程序时,它一直显示我在该name字段中填写的错误图标,或者显示该图标不存在(“问号”)。

我觉得很尴尬,因为大约一两周后就正常了。我一直在 SOF 或他们的 github 上搜索,但感觉没有希望。

你能帮我解决这个问题吗?

<Icon
    containerStyle={{
        display: (this.state.email.length > 0) ? 'flex' : 'none',
        marginRight: normalize(10),
    }}
    name="mail-outline"
    type="ionicon"
    color="#7384B4"
    size={22}
    onPress={() => {
        this.setState({ email: '' });
    }}
/>

这是我的代码,它应该显示邮件图标,但我有这个 在此处输入图像描述

这是我在我的package.json

"react": "16.9.0",
"react-native": "0.61.3",
"react-native-elements": "^1.2.0",
"react-native-vector-icons": "^7.0.0",

谢谢,祝你有美好的一天。

标签: reactjsreact-nativereact-native-vector-icons

解决方案


I had the same problem. It's related to manually linking vs autolinking (new version)

Details on autolinking

Solution: npx react-native unlink react-native-vector-icons npm run android

npm run android actually runs: react-native run-android


推荐阅读