简体   繁体   中英

react-native-vector-icons/ react-native-elements not working

I have tried everything but cannot resolve this error. Please Help to replace this box instead of icon import { Icon } from 'react-native-elements' <Icon name="glass" ></Icon>

You could try like this:

import FontAwesome from "react-native-vector-icons/FontAwesome";
...

<FontAwesome
    name={"glass"}
    size={30}
    color="#000000" 
/>        

Code example on expo

If you want to use react-native-elements you should try to use it with props type , like this:

<Icon
    name='glass'
    type='font-awesome'
    onPress={() => console.log('hello')}
/>

If the icon is still not displayed you have to try this:

react-native link

As mentioned here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM