typefaces icon indicating copy to clipboard operation
typefaces copied to clipboard

React Native?

Open KyleAMathews opened this issue 8 years ago • 3 comments

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.

KyleAMathews avatar Feb 01 '17 07:02 KyleAMathews

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.

ascorbic avatar Nov 14 '17 11:11 ascorbic

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"]
        },

wcandillon avatar Apr 20 '18 15:04 wcandillon

Any updates on this?

saikat-aedifex avatar Apr 20 '20 08:04 saikat-aedifex