Closed Kudo closed 1 month ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Updated (UTC) |
---|---|---|---|
vector-icons | ✅ Ready (Inspect) | Visit Preview | Aug 14, 2023 4:28pm |
Any updates on this or workarounds to make custom fonts work in bare workflow?
I don't really like to ping PRs but is there any chance that this will land soon?
sorry for being late to this pr. together with Brent we discussed an alternative solution than this pr. basically that Font.isLoaded(fontName)
should support fonts added from native setup.
i will create a pr before sdk 50 and the issue should be fixed in sdk 50. does that make sense to you? or let me know if the issue is a blocker to you.
Why
react-native-vector-icons uses
createIconSet(glyphmaps: Record<string, number>, fontName: string, fontFileName: string)
to load custom fonts. the third parameter is passed in string and developers should include the font into native (learn more from the doc).since we alias react-native-vector-icons to @expo/vector-icons, if people using bare react-native with custom fonts. our font loading logic will break react-native-vector-icons custom font.
How
our way to load the font is something like
createIconSet(glyphmaps, fontName, require('./assets/MaterialIcons.ttf')
. we can check the first parameter with AssetRegistry, if it is not a valid asset, we then fallback to the react-native-vector-icons use case.to make the
@ts-expect-error
work, i have bumped typescript version inside expo-module-scripts in this pr.Test Plan
tested the two cases on react-native 0.72 (adding the
MaterialIcons2.ttf
to xcode)@expo/vector-icons classic code
react-native-vector-icons custom fonts