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:
@@ -54,17 +54,17 @@ as well as one from network and even from data provided in the <code>'data:
|
||||
<span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> DisplayAnImageWithStyle
|
||||
<span class="token punctuation">)</span><span class="token punctuation">;</span></div><iframe style="margin-top:4px;" width="880" height="420" data-src="//cdn.rawgit.com/dabbott/react-native-web-player/gh-v1.2.6/index.html#code=import%20React%2C%20%7B%20Component%20%7D%20from%20'react'%3B%0Aimport%20%7B%20AppRegistry%2C%20View%2C%20Image%2C%20StyleSheet%20%7D%20from%20'react-native'%3B%0A%0Aconst%20styles%20%3D%20StyleSheet.create(%7B%0A%20%20stretch%3A%20%7B%0A%20%20%20%20width%3A%2050%2C%0A%20%20%20%20height%3A%20200%0A%20%20%7D%0A%7D)%3B%0A%0Aexport%20default%20class%20DisplayAnImageWithStyle%20extends%20Component%20%7B%0A%20%20render()%20%7B%0A%20%20%20%20return%20(%0A%20%20%20%20%20%20%3CView%3E%0A%20%20%20%20%20%20%20%20%3CImage%0A%20%20%20%20%20%20%20%20%20%20style%3D%7Bstyles.stretch%7D%0A%20%20%20%20%20%20%20%20%20%20source%3D%7Brequire('.%2Fimg%2Ffavicon.png')%7D%0A%20%20%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%3C%2FView%3E%0A%20%20%20%20)%3B%0A%20%20%7D%0A%7D%0A%0A%2F%2F%20skip%20these%20lines%20if%20using%20Create%20React%20Native%20App%0AAppRegistry.registerComponent(%0A%20%20'DisplayAnImageWithStyle'%2C%0A%20%20()%20%3D%3E%20DisplayAnImageWithStyle%0A)%3B" frameborder="0"></iframe></div><h3><a class="anchor" name="gif-and-webp-support-on-android"></a>GIF and WebP support on Android <a class="hash-link" href="docs/image.html#gif-and-webp-support-on-android">#</a></h3><p>When building your own native code, GIF and WebP are not supported by default on Android.</p><p>You will need to add some optional modules in <code>android/app/build.gradle</code>, depending on the needs of your app.</p><div class="prism language-javascript">dependencies <span class="token punctuation">{</span>
|
||||
<span class="token comment" spellcheck="true"> // If your app supports Android versions before Ice Cream Sandwich (API level 14)
|
||||
</span> compile <span class="token string">'com.facebook.fresco:animated-base-support:1.0.1'</span>
|
||||
</span> compile <span class="token string">'com.facebook.fresco:animated-base-support:1.3.0'</span>
|
||||
|
||||
<span class="token comment" spellcheck="true"> // For animated GIF support
|
||||
</span> compile <span class="token string">'com.facebook.fresco:animated-gif:1.0.1'</span>
|
||||
</span> compile <span class="token string">'com.facebook.fresco:animated-gif:1.3.0'</span>
|
||||
|
||||
<span class="token comment" spellcheck="true"> // For WebP support, including animated WebP
|
||||
</span> compile <span class="token string">'com.facebook.fresco:animated-webp:1.0.1'</span>
|
||||
compile <span class="token string">'com.facebook.fresco:webpsupport:1.0.1'</span>
|
||||
</span> compile <span class="token string">'com.facebook.fresco:animated-webp:1.3.0'</span>
|
||||
compile <span class="token string">'com.facebook.fresco:webpsupport:1.3.0'</span>
|
||||
|
||||
<span class="token comment" spellcheck="true"> // For WebP support, without animations
|
||||
</span> compile <span class="token string">'com.facebook.fresco:webpsupport:1.0.1'</span>
|
||||
</span> compile <span class="token string">'com.facebook.fresco:webpsupport:1.3.0'</span>
|
||||
<span class="token punctuation">}</span></div><p>Also, if you use GIF with ProGuard, you will need to add this rule in <code>proguard-rules.pro</code> :</p><div class="prism language-javascript"><span class="token operator">-</span>keep <span class="token keyword">class</span> <span class="token class-name">com<span class="token punctuation">.</span>facebook<span class="token punctuation">.</span>imagepipeline<span class="token punctuation">.</span>animated<span class="token punctuation">.</span>factory<span class="token punctuation">.</span>AnimatedFactoryImpl</span> <span class="token punctuation">{</span>
|
||||
<span class="token keyword">public</span> <span class="token function">AnimatedFactoryImpl</span><span class="token punctuation">(</span>com<span class="token punctuation">.</span>facebook<span class="token punctuation">.</span>imagepipeline<span class="token punctuation">.</span>bitmaps<span class="token punctuation">.</span>PlatformBitmapFactory<span class="token punctuation">,</span> com<span class="token punctuation">.</span>facebook<span class="token punctuation">.</span>imagepipeline<span class="token punctuation">.</span>core<span class="token punctuation">.</span>ExecutorSupplier<span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
<span class="token punctuation">}</span></div></div><h3><a class="anchor" name="props"></a>Props <a class="hash-link" href="docs/image.html#props">#</a></h3><div class="props"><div class="prop"><h4 class="propTitle"><a class="anchor" name="blurradius"></a>blurRadius?: <span class="propType">number</span> <a class="hash-link" href="docs/image.html#blurradius">#</a></h4><div><p>blurRadius: the blur radius of the blur filter added to the image</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="onerror"></a>onError?: <span class="propType">function</span> <a class="hash-link" href="docs/image.html#onerror">#</a></h4><div><p>Invoked on load error with <code>{nativeEvent: {error}}</code>.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="onlayout"></a>onLayout?: <span class="propType">function</span> <a class="hash-link" href="docs/image.html#onlayout">#</a></h4><div><p>Invoked on mount and layout changes with
|
||||
|
||||
Reference in New Issue
Block a user