Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React Native? #2

Open
KyleAMathews opened this issue Feb 1, 2017 · 3 comments
Open

React Native? #2

KyleAMathews opened this issue Feb 1, 2017 · 3 comments

Comments

@KyleAMathews
Copy link
Owner

I'm not working with React Native so am not super familiar with font loading there but if I'd love it if someone added a PR to make it easy to require fonts into react native projects.

@ascorbic
Copy link

I might be able to help here, but that would require .ttf fonts in the packages. I don't think you can use woff fonts in native apps.

@wcandillon
Copy link

wcandillon commented Apr 20, 2018

You could export a class that depends on Expo to load the font.

This is how I load my fonts at the moment:

    async componentDidMount(): Promise<void> {
        await Font.loadAsync({
            "SFProText-Bold": SFProTextBold,
            "SFProText-Semibold": SFProTextSemibold,
            "SFProText-Regular": SFProTextRegular
        });
        await Promise.all([fonts, ...images, icons]);
       // App is ready now
    }

Support for woff might be available via the packagerOpts option in app.json (need to double check). In my app I have:

        "packagerOpts": {
            "assetExts": ["otf"]
        },

@saikat-aedifex
Copy link

Any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants