簡體   English   中英

帶有反應導航的自定義圖標 5

[英]Custom icons with react navigation 5

我正在嘗試使用帶有反應標簽欄導航的自定義圖標。 然而,所有的教程和文檔總是只涵蓋通過 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>

您需要將圖標另存為字體。 查看這些鏈接,看看它們是否有幫助:

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 字體文件並將該字體加載到您的應用程序中。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM