有人试图使用react-native-icons?我按照以下步骤操作:
我的守则
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 });
Run Code Online (Sandbox Code Playgroud)
在我构建之后,他说该文件不存在......
Font file doesn't exist
Run Code Online (Sandbox Code Playgroud)
我清理DerivedData并尝试多次构建,但不起作用.
Dha*_*ali 18
在反应原生中安装和使用Ionicons,FontAwesome和Entypo字体图标的步骤.
首先,您需要使用以下命令进行安装.
react-native install react-native-vector-icons
Run Code Online (Sandbox Code Playgroud)
然后需要链接:
react-native link react-native-vector-icons
Run Code Online (Sandbox Code Playgroud)
将字体包文件导入页面:
import Ionicons from 'react-native-vector-icons/Ionicons';
import FontAwesome from 'react-native-vector-icons/FontAwesome';
import Entypo from 'react-native-vector-icons/Entypo';
Run Code Online (Sandbox Code Playgroud)
用法示例:
<View>
<Text>Ionicons Icons</Text>
<Icon name='md-bicycle' />
<Text>FontAwesome Icons</Text>
<FontAwesome name='trophy' />
<Text>Entypo Icons</Text>
<Entypo name='aircraft' />
</View>
Run Code Online (Sandbox Code Playgroud)
如果要查看可用图标列表,可以查看以下目录:
Ionicons:
\node_modules\react-native-vector-icons\glyphmaps\Ionicons.json
Run Code Online (Sandbox Code Playgroud)
FontAwesome:
\node_modules\react-native-vector-icons\glyphmaps\FontAwesome.json
Run Code Online (Sandbox Code Playgroud)
Entypo:
\node_modules\react-native-vector-icons\glyphmaps\Entypo.json
Run Code Online (Sandbox Code Playgroud)
给你我的应用截图.
flq*_*flq 15
首先,
react-native-icons他自己的维护者指向更新和维护的react-native-vector-icons换句话说,你的生活就像打字一样简单
react-native install react-native-vector-icons
react-native link react-native-vector-icons
Run Code Online (Sandbox Code Playgroud)
你可能会很高兴*)
*)至少它在我的机器上工作
小智 5
您是否将文件导入node_modules/react-native-icons/ios/ReactNativeIcons/Libraries/FontAwesomeKit/ionicons.ttf到您的项目中?
| 归档时间: |
|
| 查看次数: |
34956 次 |
| 最近记录: |