neb*_*007 5 react-native react-native-vector-icons react-native-elements
使用以下小吃:https : //snack.expo.io/ry_5rCk84
我正在尝试在我的本机应用程序中使用 Material Icons 显示图标“wifi_off”(只是在博览会上将此作为零食共享以方便共享),但这不是道具“名称”的公认值。并最终显示一个“?” 对于未知图标。我可以使用 ' material-community ' 图标集来使用wifi-off图标
import * as React from 'react';
import { Text, View, StyleSheet } from 'react-native';
import { Constants } from 'expo';
import {Icon} from 'react-native-elements';
// You can import from local files
import AssetExample from './components/AssetExample';
// or any pure javascript modules available in npm
import { Card } from 'react-native-paper';
export default class App extends React.Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.paragraph}>
Change code in the editor and watch it change on your phone! Save to get a shareable url.
</Text>
<Card>
<AssetExample />
</Card>
<Icon name='wifi' size={50} type='material'/>
<Icon name='wifi-off' size={50} type='material-community' />
<Icon name='wifi_off' size={50} type='material' />
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
paddingTop: Constants.statusBarHeight,
backgroundColor: '#ecf0f1',
padding: 8,
},
paragraph: {
margin: 24,
fontSize: 18,
fontWeight: 'bold',
textAlign: 'center',
},
});
Run Code Online (Sandbox Code Playgroud)
react-native-elements
用于react-native-vector-icons
显示图标。
react-native-vector-icons
有一个目录,您可以在其中检查哪些图标可用,您可以按名称查找它们。https://oblador.github.io/react-native-vector-icons/
如果您搜索名称中包含wifi 的所有图标,您会发现MaterialIcons和MaterialCommunityIcons的以下结果
如果您搜索wifi_off,您会发现没有结果。
因此wifi_off不可用。
还值得注意的是,react-native-elements
目前不支持最新版本的react-native-vector-icons
,您可以在这个当前打开的issue 中看到。
归档时间: |
|
查看次数: |
10201 次 |
最近记录: |