React-Native-Element图标在搜索栏中显示为十字形

问题描述:

如何更改react-native-element中搜索栏的图标。React-Native-Element图标在搜索栏中显示为十字形

<Icon type='font-awesome' name="share-alt" size={33} color="red" /> 

上述代码确实会正确呈现图标。

但相同的图标显示为下面的代码

<SearchBar 
    lightTheme 
    icon = {"share-alt", "red"} 
    inputStyle={{margin: 0, padding:3, flex:1}} 
    containerStyle={{flex:1, height:undefined}} 
    onChangeText={() => {}} 
    placeholder='ABC' /> 

enter image description here

+0

您可以包含屏幕截图吗? –

+0

添加了屏幕截图 –

交叉只能只能改变原生图标。它在这里列表https://material.io/icons/

图标道具不接受类型。正是在这里指定react-native-elements/API/searchbar/

object {name (string), color (string), style (object)} 

根据您的屏幕截图,反应,本机矢量图标安装不正确。
1.正确安装react-native-vector-icons
2.然后你可以看到搜索图标。那时候,你可以改变搜索栏的图标。您可以使用Material icon names