微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

react-native – 反应本机图标

有人尝试使用反应本机图标?我按照这些步骤:

> npm install react-native-icons @ latest –save
>在XCode中,在项目导航器中,右键单击库➜将文件添加到[您的项目名称]
>转到node_modules➜react-native-icons➜ios并添加ReactNativeIcons.xcodeproj
>将libReactNativeIcons.a(从“ReactNativeIcons.xcodeproj下的”Products“)添加到项目的构建阶段➜链接二进制库与库阶段
>将您要使用的字体文件添加到项目的“复制包资源”构建阶段(单击“’并单击”添加其他…“,然后从node_modules / react-native-icons / ios / Libraries中选择字体文件/ FontAwesomeKit).
运行你的项目(Cmd R)

我的代码

var React = require('react-native');
var Icon = require('FAKIconImage');
var { AppRegistry,StyleSheet,Text,View} = React;

class BringgersApp extends React.Component {

  constructor(props) {
    super(props);
  }

  render() {
    return(
      <View style={styles.container}>        
        <Text style={styles.welcome}>
          Welcome to Bringgers!          
        </Text>
        <Icon
          name='ion|beer'
          size={150}
          color='#887700'
          style={styles.beer} />       
      </View>
    )
  }
}

var styles = StyleSheet.create({
  container: {
    flex: 1,justifyContent: 'center',alignItems: 'center',backgroundColor: '#F5FCFF',},welcome: {
    fontSize: 20,textAlign: 'center',margin: 10,instructions: {
    textAlign: 'center',color: '#333333',marginBottom: 5,});

React.AppRegistry.registerComponent('BringgersApp',function() { return BringgersApp });

我建立后,他说该文件不存在…

Font file doesn't exist

我清理DerivedData并尝试构建很多次,但不起作用.

首先,

>反馈 – 本土图标的维护者指向较新的&维持react-native-vector-icons
>显然,截至目前,rnpm项目已经合并为反应性.

换句话说,你的生活可以像打字一样简单

react-native install react-native-vector-icons
react-native link react-native-vector-icons

你可能会很好* *

*)至少它在我的机器上工作

原文地址:https://www.jb51.cc/react/300743.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐