Add documentation for supporting custom require types

Summary:
See https://github.com/facebook/metro-bundler/pull/4
Closes https://github.com/facebook/react-native/pull/14433

Differential Revision: D5230109

Pulled By: shergin

fbshipit-source-id: f797218ad214dc3912ab3a9bcf837103502bfce4
This commit is contained in:
Andrew Linfoot 2017-06-12 13:19:54 -07:00 committed by Facebook Github Bot
parent 2e4284215c
commit 94116dbad5

View File

@ -67,7 +67,9 @@ Note that image sources required this way include size (width, height) info for
## Static Non-Image Resources
The `require` syntax described above can be used to statically include audio, video or document files in your project as well. Most common file types are supported including `.mp3`, `.wav`, `.mp4`, `.mov`, `.html` and `.pdf` (see the [packager defaults](https://github.com/facebook/react-native/blob/master/packager/defaults.js) file for the full list).
The `require` syntax described above can be used to statically include audio, video or document files in your project as well. Most common file types are supported including `.mp3`, `.wav`, `.mp4`, `.mov`, `.html` and `.pdf`. See [packager defaults](https://github.com/facebook/metro-bundler/blob/master/packages/metro-bundler/src/defaults.js#L13-L18) for the full list.
You can add support for other types by creating a packager config file (see the [packager config file](https://github.com/facebook/react-native/blob/master/local-cli/util/Config.js#L34-L39) for the full list of configuration options).
A caveat is that videos must use absolute positioning instead of `flexGrow`, since size info is not currently passed for non-image assets. This limitation doesn't occur for videos that are linked directly into Xcode or the Assets folder for Android.