不加载react-native-vector-icons/FontAwesome 中的图标

Den*_*nes 1 javascript android ios font-awesome react-native

你们今天对react-native-vector-icons/FontAwesome 有问题吗?我使用的是react-native 版本>0.6,所以我认为问题不在于链接。

正如你们在图片中看到的那样,它没有显示我要求的任何图标,我不知道发生了什么......

这是我的 Android 模拟器上显示的图片: Print-Scream-Icon-Not-Showing-up

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



export default function ActionButton(props) {

    return(
        <TouchableOpacity>
        <View style={styles.container}>
           
           <Icon name='plus' size={30} color='#777' />
           <Icon name='trash' size={30} color='#777' />
           <Icon name='search'  size={30} color='#777' />
        </View>
        </TouchableOpacity>
    )
}

const styles = StyleSheet.create({
    container:{
        justifyContent:'center',
        alignItems:'center',
        width:80,
        height:40,
        backgroundColor:'#FFF',
        elevation:9,
        marginTop:20,
        borderRadius:6,
        paddingVertical:15,
        marginBottom:10
       
    }
})


Run Code Online (Sandbox Code Playgroud)

Den*_*nes 5

所以该库react-native-vector-icons不支持react-native> 6.0上的自动链接,这意味着您必须运行命令npx react-native link react-native-vector-icons才能链接,链接后重新运行android模拟器,一切都会正常工作。!. 特别感谢帮助我解答的匿名人士!!!