首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >IOS无法呈现@expo/vector-icons

IOS无法呈现@expo/vector-icons
EN

Stack Overflow用户
提问于 2020-11-27 00:24:42
回答 1查看 251关注 0票数 0

我们正在使用expo的纯工作流项目在用户应用程序中实现图标。

世博会文档说,不需要在ios设备中进行更多配置,但当我在ios中安装expo install @expo/vector-icons时,它不能很好地工作。图标不会被渲染。只有一个‘?’会被渲染。

在托管工作流中,它工作得很好。但我需要在简单的工作流程中。

我没有错误消息。只有图标不会出现。

在xcode中,我尝试将fonts文件夹复制到xcode项目中,然后运行pod install并链接react-native依赖项。但没有成功。

有人有这个问题吗?解决方案是什么?谢谢!

代码语言:javascript
复制
// 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;
EN

回答 1

Stack Overflow用户

发布于 2020-11-27 00:30:51

听起来你的图标的名字在expo/vector-icons中并不存在,也许如果你提供了一些代码,故障排除会容易得多。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65025805

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档