React native 将react原生元素用于材质图标-无法识别某些图标

React native 将react原生元素用于材质图标-无法识别某些图标,react-native,react-native-elements,react-native-vector-icons,React Native,React Native Elements,React Native Vector Icons,使用以下零食: 我试图在我的react native应用程序中使用材质图标显示图标“wifi_off”(只是在expo上作为小吃分享,以便于分享),但这不是道具“name”的公认值。 并最终显示未知图标的“?”。 我可以使用“材料社区””图标集关闭wifi图标 import * as React from 'react'; import { Text, View, StyleSheet } from 'react-native'; import { Constants } from 'expo

使用以下零食:

我试图在我的react native应用程序中使用材质图标显示图标“wifi_off”(只是在expo上作为小吃分享,以便于分享),但这不是道具“name”的公认值。 并最终显示未知图标的“?”。 我可以使用“材料社区””图标集关闭wifi图标

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',
  },
});
import*as React from'React';
从“react native”导入{Text,View,StyleSheet};
从“expo”导入{Constants};
从“react native elements”导入{Icon};
//可以从本地文件导入
从“./components/AssetExample”导入AssetExample;
//或npm中可用的任何纯javascript模块
从“react native paper”导入{Card};
导出默认类App扩展React.Component{
render(){
返回(
在编辑器中更改代码,并在手机上观看代码的更改!保存以获得可共享的url。

react native elements
使用
react native vector图标来显示图标

react native vector icons
有一个目录,您可以在其中检查哪些图标可用,您可以按名称查找它们

如果您搜索名称中包含wifi的所有图标,您会发现MaterialCons和MaterialCommunicationIcons的以下结果

如果搜索wifi\u off,您将发现没有结果

因此,wifi\u off无法使用


还值得注意的是,
react native elements
当前不支持最新版本的
react native vector icons
,您可以在当前打开的中看到这一点。

当您使用react native elements Icon时,它会在后台列表中搜索,在这里您可以找到支持的图标名称已移植,您可以看到“wifi_off”不在此处,或许您可以尝试“signal wifi off”。

感谢您的澄清和详细解释。我要查找的图标似乎也不是react本机矢量图标的一部分(不仅仅是react本机元素),而包的GitHub文档提到它使用的是最新版本的材质图标。这是否意味着包中不会包含该版本的所有图标?我相信是这样的。我不知道为什么不包含该图标。我猜这就是为什么他们有目录,以便您可以检查包含哪些图标。您可以ld在回购协议上打开另一个问题,要求包括附加图标。