Skip to content
Tommy Nguyen edited this page Feb 12, 2024 · 18 revisions

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.

JavaScript Bundle

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:

  1. index.[platform].jsbundle
  2. main.[platform].jsbundle
  3. index.mobile.jsbundle
  4. main.mobile.jsbundle
  5. index.native.jsbundle
  6. main.native.jsbundle
  7. index.jsbundle
  8. 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.

Fonts

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

Images

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

Media

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

Clone this wiki locally