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

时间:2020-05-02 22:05:11

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

我正在尝试使用带有反应标签栏导航的自定义图标。但是,所有教程和文档 总是只涵盖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>

1 个答案:

答案 0 :(得分: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字体文件,并将该字体加载到应用程序中。