mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
update website
This commit is contained in:
+1
-1
@@ -31,7 +31,7 @@ testing scripts.</p></div></div></div></div><div><h3><a class="anchor" name="des
|
||||
<span class="token comment" spellcheck="true">
|
||||
// GOOD
|
||||
</span><span class="token keyword">var</span> icon <span class="token operator">=</span> <span class="token keyword">this</span><span class="token punctuation">.</span>props<span class="token punctuation">.</span>active <span class="token operator">?</span> <span class="token function">require<span class="token punctuation">(</span></span><span class="token string">'image!my-icon-active'</span><span class="token punctuation">)</span> <span class="token punctuation">:</span> <span class="token function">require<span class="token punctuation">(</span></span><span class="token string">'image!my-icon-inactive'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
<Image source<span class="token operator">=</span><span class="token punctuation">{</span>icon<span class="token punctuation">}</span> <span class="token operator">/</span><span class="token operator">></span></div><p>When your entire codebase respects this convention, you're able to do interesting things like automatically packaging the assets that are being used in your app. Note that in the current form, nothing is enforced, but it will be in the future.</p><h3><a class="anchor" name="adding-static-resources-to-your-app-using-images-xcassets"></a>Adding Static Resources to your App using Images.xcassets <a class="hash-link" href="#adding-static-resources-to-your-app-using-images-xcassets">#</a></h3><p><img src="/react-native/img/StaticImageAssets.png" alt=""></p><blockquote><p><strong>NOTE</strong>: App build required for new resources</p><p>Any time you add a new resource to <code>Images.xcassets</code> you will need to re-build your app through XCode before you can use it - a reload from within the simulator is not enough.</p></blockquote><p><em>This process is currently being improved, a much better workflow will be
|
||||
<Image source<span class="token operator">=</span><span class="token punctuation">{</span>icon<span class="token punctuation">}</span> <span class="token operator">/</span><span class="token operator">></span></div><p>When your entire codebase respects this convention, you're able to do interesting things like automatically packaging the assets that are being used in your app. Note that in the current form, nothing is enforced, but it will be in the future.</p><h3><a class="anchor" name="adding-static-resources-to-your-app-using-images-xcassets"></a>Adding Static Resources to your App using Images.xcassets <a class="hash-link" href="#adding-static-resources-to-your-app-using-images-xcassets">#</a></h3><p><img src="/react-native/img/StaticImageAssets.png" alt=""></p><blockquote><p><strong>NOTE</strong>: App build required for new resources</p><p>Any time you add a new resource to <code>Images.xcassets</code> you will need to re-build your app through Xcode before you can use it - a reload from within the simulator is not enough.</p></blockquote><p><em>This process is currently being improved, a much better workflow will be
|
||||
available shortly.</em></p><h2><a class="anchor" name="network-resources"></a>Network Resources <a class="hash-link" href="#network-resources">#</a></h2><p>Many of the images you will display in your app will not be available at compile time, or you will want to load some dynamically to keep the binary size down. Unlike with static resources, <em>you will need to manually specify the dimensions of your image.</em></p><div class="prism language-javascript"><span class="token comment" spellcheck="true">// GOOD
|
||||
</span><Image 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">'https://facebook.github.io/react/img/logo_og.png'</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>
|
||||
|
||||
Reference in New Issue
Block a user