From a38f5b6b6a5013f31772141291716be3c4feeef0 Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Fri, 23 Jun 2017 20:32:45 -0700 Subject: [PATCH] Document URI for Android asset folder images Summary: How to load images from the Android assets folder was undocumented, and took us a little while to find out how to do it. This is a documentation-only change. To confirm the syntax works create a sample app with an image at `android/app/src/main/assets/foo.png`. Then add JSX ``. See that the image is rendered (Android only). Closes https://github.com/facebook/react-native/pull/14626 Differential Revision: D5316887 Pulled By: AaaChiuuu fbshipit-source-id: f7d07b8b83d6460de86c1a2efac0955300cfcd78 --- docs/Images.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/Images.md b/docs/Images.md index 5cd3519da..424e2dbc3 100644 --- a/docs/Images.md +++ b/docs/Images.md @@ -75,14 +75,21 @@ A caveat is that videos must use absolute positioning instead of `flexGrow`, sin ## Images From Hybrid App's Resources -If you are building a hybrid app (some UIs in React Native, some UIs in platform code) you can still use images that are already bundled into the app (via Xcode asset catalogs or Android drawable folder): +If you are building a hybrid app (some UIs in React Native, some UIs in platform code) you can still use images that are already bundled into the app. + +For images included via Xcode asset catalogs or in the Android drawable folder, use the image name without the extension: ```javascript ``` -This approach provides no safety checks. It's up to you to guarantee that those images are available in the application. Also you have to specify image dimensions manually. +For images in the Android assets folder, use the `asset:/` scheme: +```javascript + +``` + +These approaches provide no safety checks. It's up to you to guarantee that those images are available in the application. Also you have to specify image dimensions manually. ## Network Images