react-native-dom icon indicating copy to clipboard operation
react-native-dom copied to clipboard

Document Asset Handling

Open darthtrevino opened this issue 6 years ago • 1 comments

It looks like the way to use custom fonts is to add a link in the index.html. It would be nice if there were a mechanism to link and load them as first-class resources like you can on iOS and Android. I'm not sure how other asset types are handled here.

darthtrevino avatar May 18 '18 17:05 darthtrevino

When I think about how fonts are loaded in iOS and Android, it's essentially leveraging a configuration option provided by the platform itself, and in the case of the web adding those link tags to the html file is the closest equivalent.

I'm all for a more first-class way to support font loading but unfortunately that isn't really a part of React Native's core and in the early stages of this project I want to focus most on supporting the entirely of the RN core before we move on to creating builtin, web-specific features.

In most cases, if you're itching to get a more streamlined experience you can still implement your own native module which provides that platform specific behavior. For example, like you I wanted to streamline font loading for the demos I was building so I wrote a small native module to allow for loading them from the "react thread": https://gist.github.com/vincentriemer/b8e5e97a92a44638a118016801d378cd

vincentriemer avatar May 20 '18 14:05 vincentriemer