简体   繁体   English

React-native-vector-icons 显示晦涩的符号

[英]React-native-vector-icons show obscure symbols

I've installed react-native-vecotor .我已经安装了react-native-vecotor And when using them, they showing obscure symbols.并且在使用它们时,它们显示出晦涩的符号。 How to use this library?如何使用这个库? Platform: Android平台:Android

import React from 'react';
import {View, Text, StyleSheet} from 'react-native';
import Icon from 'react-native-vector-icons/Ionicons';

const SearchBar = () => {
    return (
        <View style={styles.background}>
            <Icon name="md-body" color='#000'  size={25} />
        </View>
    );
};
const styles = StyleSheet.create({
    background:{
        backgroundColor:'#F0EEEE',
        marginHorizontal: 15,
        height:45,
        borderRadius:5,
    }
});
export default SearchBar;

Ionicons has no element name body . Ionicons没有元素名称body You can check here react-native-vector-icons你可以在这里查看react-native-vector-icons

<Icon name="ios-body" color='#000'  size={25} />

If you are using react-native version 0.60++ then it must be the linking problem!如果您使用的是react-native 0.60++版本,那一定是链接问题!

I was facing same after updating react-native, but solved by this, Follow my instructions.更新 react-native 后我也面临同样的问题,但解决了这个问题,请按照我的说明进行操作。

  1. Clean your gradlew (Optional but recommended)清理你的 gradlew(可选但推荐)
    To clean gradle go to android folder and open cmd & run gradlew clean清理 gradle go 到 android 文件夹并打开 cmd & run gradlew clean
  2. Go to android/app/build.gradle add this at the end of file => apply from: "../../node_modules/react-native-vector-icons/fonts.gradle" Go 到android/app/build.gradle添加到文件末尾 => apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

  3. Now re-compile (react-native run-android/run-ios) It must be working now...现在重新编译(react-native run-android/run-ios)它现在必须工作......

I just reinstall project application from my device.我只是从我的设备重新安装项目应用程序。 It's works!其作品!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 图标未正确加载react-native-vector-icons - Icons not loading correctly react-native-vector-icons 不从 react-native-vector-icons/FontAwesome 加载图标 - Not loading Icons from react-native-vector-icons/FontAwesome 如何使用带有 react-native-vector-icons 的材质社区图标 - How to use material community icons with react-native-vector-icons react-native-vector-icons +摩卡:不变违规 - react-native-vector-icons + mocha: Invariant Violation React-native 与故事书问题 react-native-vector-icons 和 react-native-paper - React-native with storybook problem react-native-vector-icons and react-native-paper 为什么我的图标会这样显示? 这是 react-native-vector-icons - why are my icons showing up like this? this is react-native-vector-icons React native web 故事书 react-native-vector-icons 问题图标 - React native web storybook react-native-vector-icons problem icon 如何在一个文件中使用不同的字体(多个)react-native-vector-icons? - How to use different fonts (more than one) of react-native-vector-icons in one file? 使用 Jest 测试时无法读取未定义的 react-native-vector-icons 的属性“默认” - Cannot read property 'default' of undefined react-native-vector-icons when testing with Jest Feather - react-native-vector-icons - 可能处理了 promise 拒绝 (id:9) 问题 - Feather - react-native-vector-icons - possible handled promise rejection (id:9) issue
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM