简体   繁体   English

带有反应导航的自定义图标 5

[英]Custom icons with react navigation 5

I am trying to use custom icons with a react tabbar navigation.我正在尝试使用带有反应标签栏导航的自定义图标。 However, all the tutorials and docs always just cover implementing icons by Ionicons or Materialdesign.然而,所有的教程和文档总是只涵盖通过 Ionicons 或 Materialdesign 实现图标。 Is there a way I can implement my own Icons?有没有办法实现我自己的图标?

This is how the code looks like atm:这是代码看起来像 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>

You need to save your icons as a font.您需要将图标另存为字体。 Check out these links and see if they help:查看这些链接,看看它们是否有帮助:

https://www.reactnative.guide/12-svg-icons-using-react-native-vector-icons/12.1-creating-custom-iconset.html 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 https://medium.com/bam-tech/add-custom-icons-to-your-react-native-application-f039c244386c

You need to take your.svg files and, using a service like IcoMoon, generate a.ttf font file and load that font into your application.您需要获取您的 .svg 文件,并使用 IcoMoon 之类的服务生成一个 .ttf 字体文件并将该字体加载到您的应用程序中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM