【问题标题】:Custom icons with react navigation 5带有反应导航的自定义图标 5
【发布时间】:2020-05-02 22:05:11
【问题描述】:

我正在尝试使用带有反应标签栏导航的自定义图标。但是,所有的教程和文档 总是只涵盖通过 Ionicons 或 Materialdesign 实现图标。有没有办法实现我自己的图标?

这就是代码看起来像 atm 的样子:

<Tab.Navigator tabBarOptions={{
  inactiveTintColor: '#707070',
  activeTintColor: 'red',
  style: {
    backgroundColor: '#F1F1F1',
    height: 60,
    color: 'red',
    paddingBottom: 5
  }
}}>
  <Tab.Screen name="Bestellungen" component={BestellungenOverview}/>
  <Tab.Screen name="Kunden" component={KundenOverview} />
  <Tab.Screen name="Zahlungen" component={ZahlungenOverview} />
  <Tab.Screen name="Statistiken" component={StatistikenOverview} />
  <Tab.Screen name="Einstellungen" component={Einstellungen} />
</Tab.Navigator>

【问题讨论】:

    标签: react-native react-navigation react-navigation-v5 react-navigation-bottom-tab


    【解决方案1】:

    您需要将图标另存为字体。查看这些链接,看看它们是否有帮助:

    https://www.reactnative.guide/12-svg-icons-using-react-native-vector-icons/12.1-creating-custom-iconset.html

    https://medium.com/bam-tech/add-custom-icons-to-your-react-native-application-f039c244386c

    您需要获取 .svg 文件,并使用 IcoMoon 等服务生成 .ttf 字体文件并将该字体加载到您的应用程序中。

    【讨论】:

    猜你喜欢
    • 2020-09-16
    • 2018-12-09
    • 2020-06-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-18
    • 1970-01-01
    • 2018-05-23
    相关资源
    最近更新 更多