-
Notifications
You must be signed in to change notification settings - Fork 91
Assets
Contents
All assets that should be embedded in the final app bundle must be declared in app.json
under the resources
field. Unless stated otherwise, assets are copied as-is into the app bundle next to the JS bundle.
Read on to learn how we handle certain resource types.
When the app is instructed to load the embedded JS bundle, it will look for and load the first file it finds from the list, starting from the top:
index.[platform].jsbundle
main.[platform].jsbundle
index.mobile.jsbundle
main.mobile.jsbundle
index.native.jsbundle
main.native.jsbundle
index.jsbundle
main.jsbundle
You can tell RNTA to use a different filename by configuring bundleRoot
.
When loading from the dev server, the app will attempt to load http://localhost:8081/index.bundle
by default.
Note
Supported as of 3.2.0.
Font files listed under the resources
field are automatically registered for use in your app. Only True Type Font (.ttf) and Open Type Font (.otf) files are supported.
Note that the name you use for the fontFamily
property may differ between platforms:
- Android: Use the filename (without its extension) as resource id
- iOS/macOS: The font name may not match the filename — check the documentation for how to find the font name: Adding a Custom Font to Your App
We currently do not implement any special handling for images. In most cases, you should let React Native manage images: https://reactnative.dev/docs/next/images
Note
Supported as of 3.2.0.
Android requires filenames of raw resources to be in all lowercase. To ensure your app works across all platforms, it is recommended to be consistent with naming on all platforms.
Supported file types: .3gp
, .aac
, .amr
, .flac
, .imy
, .m4a
, .mid
, .mkv
, .mp3
, .mp4
, .mxmf
, .ogg
, .ota
, .rtttl
, .rtx
, .ts
, .wav
, .webm
, .xmf