mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Updated docs for next
This commit is contained in:
@@ -24,7 +24,8 @@
|
||||
<span class="token punctuation">}</span><span class="token punctuation">,</span>
|
||||
body<span class="token punctuation">:</span> <span class="token string">'Your Body goes here'</span>
|
||||
<span class="token punctuation">}</span><span class="token punctuation">}</span>
|
||||
style<span class="token operator">=</span><span class="token punctuation">{</span><span class="token punctuation">{</span>width<span class="token punctuation">:</span> <span class="token number">400</span><span class="token punctuation">,</span> height<span class="token punctuation">:</span> <span class="token number">400</span><span class="token punctuation">}</span><span class="token punctuation">}</span> <span class="token operator">/</span><span class="token operator">></span></div><h3><a class="anchor" name="cache-control-ios-only"></a>Cache Control (iOS Only) <a class="hash-link" href="docs/images.html#cache-control-ios-only">#</a></h3><p>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 <code>cache</code> source property gives you control over how the network layer interacts with the cache.</p><ul><li><code>default</code>: Use the native platforms default strategy.</li><li><code>reload</code>: The data for the URL will be loaded from the originating source.
|
||||
style<span class="token operator">=</span><span class="token punctuation">{</span><span class="token punctuation">{</span>width<span class="token punctuation">:</span> <span class="token number">400</span><span class="token punctuation">,</span> height<span class="token punctuation">:</span> <span class="token number">400</span><span class="token punctuation">}</span><span class="token punctuation">}</span> <span class="token operator">/</span><span class="token operator">></span></div><h2><a class="anchor" name="uri-data-images"></a>Uri Data Images <a class="hash-link" href="docs/images.html#uri-data-images">#</a></h2><p>Sometimes, you might be getting encoded image data from a REST API call. You can use the <code>'data:'</code> uri scheme to use these images. Same as for network resources, <em>you will need to manually specify the dimensions of your image</em>.</p><blockquote><p>This is recommended for very small and dynamic images only, like icons in a list from a DB.</p></blockquote><div class="prism language-javascript"><span class="token comment" spellcheck="true">// include at least width and height!
|
||||
</span><span class="token operator"><</span>Image style<span class="token operator">=</span><span class="token punctuation">{</span><span class="token punctuation">{</span>width<span class="token punctuation">:</span> <span class="token number">51</span><span class="token punctuation">,</span> height<span class="token punctuation">:</span> <span class="token number">51</span><span class="token punctuation">,</span> resizeMode<span class="token punctuation">:</span> Image<span class="token punctuation">.</span>resizeMode<span class="token punctuation">.</span>contain<span class="token punctuation">}</span><span class="token punctuation">}</span> source<span class="token operator">=</span><span class="token punctuation">{</span><span class="token punctuation">{</span>uri<span class="token punctuation">:</span> <span class="token string">'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADMAAAAzCAYAAAA6oTAqAAAAEXRFWHRTb2Z0d2FyZQBwbmdjcnVzaEB1SfMAAABQSURBVGje7dSxCQBACARB+2/ab8BEeQNhFi6WSYzYLYudDQYGBgYGBgYGBgYGBgYGBgZmcvDqYGBgmhivGQYGBgYGBgYGBgYGBgYGBgbmQw+P/eMrC5UTVAAAAABJRU5ErkJggg=='</span><span class="token punctuation">}</span><span class="token punctuation">}</span><span class="token operator">/</span><span class="token operator">></span></div><h3><a class="anchor" name="cache-control-ios-only"></a>Cache Control (iOS Only) <a class="hash-link" href="docs/images.html#cache-control-ios-only">#</a></h3><p>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 <code>cache</code> source property gives you control over how the network layer interacts with the cache.</p><ul><li><code>default</code>: Use the native platforms default strategy.</li><li><code>reload</code>: The data for the URL will be loaded from the originating source.
|
||||
No existing cache data should be used to satisfy a URL load request.</li><li><code>force-cache</code>: The existing cached data will be used to satisfy the request,
|
||||
regardless of its age or expiration date. If there is no existing data in the cache
|
||||
corresponding the request, the data is loaded from the originating source.</li><li><code>only-if-cached</code>: The existing cache data will be used to satisfy a request, regardless of
|
||||
|
||||
Reference in New Issue
Block a user