0

我只是在我的搜索图标应该在的位置看到一个问号图标。还为我的其他字体获取无法识别的字体。

  <SearchBar
                round
                containerStyle={{
                    borderTopWidth: 0,
                    borderBottomWidth: 0
                }}
                inputStyle={{ backgroundColor: "white" }}
                inputContainerStyle={{
                    borderRadius: 5,
                    backgroundColor: "white"
                }}
                icon={{
                    type: "fontAwesome",
                    color: "#86939e",
                    name: "fa-search"
                }}
                onSubmitEditing={this.onSubmitEdit}
                searchIcon={{ size: 18 }}
                onChangeText={text => this.SearchFilterFunction(text)}
                onClear={text => this.SearchFilterFunction("")}
                placeholder="Type Here..."
                value={term}
            />

除了我的 serahc 图标没有出现,我无法让我的字体显示使用:

  menuText: {
    fontSize: 15,
    color: "#fff",
    opacity: 1,
    fontFamily: "lato-regular",
    textTransform: "uppercase"
  }

我已经链接了包,并将字体文件复制到 xcode 中。

我所有的字体都出现Resources在 xcode 中。如何显示我的图标?

我在 info.plist 中有我的字体:

<key>UIAppFonts</key>
<array>
    <string>Lato-Regular.ttf</string>
    <string>Lato-Light.ttf</string>
    <string>FontAwesome.ttf</string>
    <string>Lato-Bold.ttf</string>
    <string>MaterialIcons.ttf</string>
    <string>Lato-Black.ttf</string>
    <string>Lato-BlackItalic.ttf</string>
    <string>Lato-BoldItalic.ttf</string>
    <string>Lato-Hairline.ttf</string>
    <string>Lato-HairlineItalic.ttf</string>
    <string>Lato-Heavy.ttf</string>
    <string>Lato-HeavyItalic.ttf</string>
    <string>Lato-Italic.ttf</string>
    <string>Lato-LightItalic.ttf</string>
    <string>Lato-Medium.ttf</string>
    <string>Lato-MediumItalic.ttf</string>
    <string>Lato-Semibold.ttf</string>
    <string>Lato-SemiboldItalic.ttf</string>
    <string>Lato-Thin.ttf</string>
    <string>Lato-ThinItalic.ttf</string>
    <string>SpaceMono-Regular.ttf</string>
</array>
4

2 回答 2

1

尝试这个:-

import Icon from 'react-native-vector-icons/FontAwesome';
const myIcon = <Icon name="rocket" size={30} color="#900" />;

在您的代码中使用 myIcon 。

于 2019-09-25T10:21:39.847 回答
0

如果您使用的是 react-native-vector-icons,请查看此https://oblador.github.io/react-native-vector-icons/以找到您的图标

名称不是fa-search,而只是search

于 2019-09-25T10:16:35.917 回答