【发布时间】:2015-04-28 12:59:40
【问题描述】:
有人尝试使用 react-native-icons?我按照以下步骤操作:
- npm install react-native-icons@latest --save
- 在 XCode 中,在项目导航器中右键单击库 ➜ 将文件添加到 [您的项目名称]
- 转到 node_modules ➜ react-native-icons➜ ios 并添加 ReactNativeIcons.xcodeproj
- 将 libReactNativeIcons.a(来自 ReactNativeIcons.xcodeproj 下的“产品”)添加到项目的构建阶段 ➜ 将二进制文件与库链接阶段
- 将要使用的字体文件添加到项目的 Copy Bundle Resources 构建阶段(单击“+”并单击“添加其他...”,然后从 node_modules/react-native-icons/ 中选择字体文件ios/库/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