Reputation: 784
Problem:
I have font separated to 2 files, like "XSansRegular.ttf" and "XSansBold.ttf", both has same font family, like "X Sans".
I have added it as assets.
But when I'm trying to use them with setting:
style={{
fontFamily: "X Sans"
}}
it doesn't work. I need to use exact file name, like this:
style={{
fontFamily: "XSansRegular"
}}
What I want to do:
Use it with font name, instead of file name
style={{
fontFamily: "X Sans"
}}
with possibility to pass there props like bold
style={{
fontFamily: "X Sans",
fontWeight: 'bold'
}}
Upvotes: 0
Views: 968
Reputation: 41
Do you have the linked font files ?
If your react-native version >= 0.70,Run npx react-native-asset
to link font files and try again.
Upvotes: 1