我们正在使用expo的纯工作流项目在用户应用程序中实现图标。
世博会文档说,不需要在ios设备中进行更多配置,但当我在ios中安装expo install @expo/vector-icons时,它不能很好地工作。图标不会被渲染。只有一个‘?’会被渲染。
在托管工作流中,它工作得很好。但我需要在简单的工作流程中。
我没有错误消息。只有图标不会出现。
在xcode中,我尝试将fonts文件夹复制到xcode项目中,然后运行pod install并链接react-native依赖项。但没有成功。
有人有这个问题吗?解决方案是什么?谢谢!

// Example to Use React Native Vector Icons
// https://aboutreact.com/react-native-vector-icons/
// Import React
import React from 'react';
// Import required component
import {SafeAreaView, StyleSheet, Text, View} from 'react-native';
// Import vector icons
import Icon from 'react-native-vector-icons/FontAwesome';
const App = () => {
return (
<SafeAreaView style={{flex: 1}}>
<View style={{flex: 1, padding: 16}}>
<View style={styles.container}>
<Text style={styles.heading}>
Example to Use React Native Vector Icons
</Text>
<View style={styles.iconContainer}>
<Text>
<Icon name="rocket" size={30} color="#900" />
</Text>
{/* Icon Component */}
<Icon name="rocket" size={30} color="#900" />
</View>
<View style={{marginTop: 16, marginBottom: 16}}>
{/* Icon.Button Component */}
<Icon.Button
name="facebook"
backgroundColor="#3b5998"
onPress={() => alert('Login with Facebook')}>
Login with Facebook
</Icon.Button>
</View>
</View>
<Text style={styles.footerTitle}>Vector Icons</Text>
<Text style={styles.footerText}>www.aboutreact.com</Text>
</View>
</SafeAreaView>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
heading: {
fontSize: 20,
textAlign: 'center',
marginBottom: 20,
},
iconContainer: {
marginTop: 16,
marginBottom: 16,
justifyContent: 'center',
alignItems: 'center',
textAlign: 'center',
},
footerTitle: {
fontSize: 18,
textAlign: 'center',
color: 'grey',
},
footerText: {
fontSize: 16,
textAlign: 'center',
color: 'grey',
},
});
export default App;发布于 2020-11-27 00:30:51
听起来你的图标的名字在expo/vector-icons中并不存在,也许如果你提供了一些代码,故障排除会容易得多。
https://stackoverflow.com/questions/65025805
复制相似问题