From dfd3b222757f87a7ff563e78b1eac2b5f311aef9 Mon Sep 17 00:00:00 2001 From: harry-g Date: Mon, 10 Jul 2017 14:15:04 -0700 Subject: [PATCH] Better doc for 'data:' uri scheme Summary: It is quite confusing that the 'data:' uri scheme is not documented, but working. It is very useful when getting e.g. an icon from a REST call. Closes https://github.com/facebook/react-native/pull/14827 Differential Revision: D5392326 Pulled By: hramos fbshipit-source-id: 815851c27273f99ce281fb35fc6fbcf8cf781ff9 --- docs/Images.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/Images.md b/docs/Images.md index 424e2dbc3..65ebc2903 100644 --- a/docs/Images.md +++ b/docs/Images.md @@ -120,6 +120,17 @@ Many of the images you will display in your app will not be available at compile style={{width: 400, height: 400}} /> ``` +## Uri Data Images + +Sometimes, you might be getting encoded image data from a REST API call. You can use the `'data:'` uri scheme to use these images. Same as for network resources, *you will need to manually specify the dimensions of your image*. + +> This is recommended for very small and dynamic images only, like icons in a list from a DB. + +```javascript +// include at least width and height! + +``` + ### Cache Control (iOS Only) In some cases you might only want to display an image if it is already in the local cache, i.e. a low resolution placeholder until a higher resolution is available. In other cases you do not care if the image is outdated and are willing to display an outdated image to save bandwidth. The `cache` source property gives you control over how the network layer interacts with the cache.