0

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'
}}

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.