自定义图标与react导航5

问题描述 投票:0回答:1

我想在react标签栏导航中使用自定义图标。但是,所有的教程和文档都只涉及Ionicons或Materialdesign的图标。有什么方法可以实现我自己的图标吗?

目前的代码是这样的。

<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个回答
1
投票

你需要将你的图标保存为一种字体。查看这些链接,看看是否有帮助。

https:/www.reactnative.guide12-svg-icons-using-react-native-vector-icons12.1-creating-custom-iconset.html

https:/medium.comam-techadd-custom-icons-to-your-react-native-application-f039c244386c。

你需要把你的.svg文件,并使用像IcoMoon这样的服务,生成一个.ttf字体文件,并将该字体加载到你的应用程序中。

© www.soinside.com 2019 - 2024. All rights reserved.