Updated docs for next

This commit is contained in:
Website Deployment Script
2016-03-05 21:55:51 +00:00
parent a3c8a1d8fe
commit a160a99eb2
+1 -1
View File
@@ -56,7 +56,7 @@ html <span class="token punctuation">{</span>
font<span class="token operator">-</span>family<span class="token punctuation">:</span> <span class="token string">&#x27;lucida grande&#x27;</span><span class="token punctuation">,</span> tahoma<span class="token punctuation">,</span> verdana<span class="token punctuation">,</span> arial<span class="token punctuation">,</span> sans<span class="token operator">-</span>serif<span class="token punctuation">;</span>
font<span class="token operator">-</span>size<span class="token punctuation">:</span> 11px<span class="token punctuation">;</span>
color<span class="token punctuation">:</span> #<span class="token number">141823</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span></div><p>When the browser is trying to render a text node, it&#x27;s going to go all the way up to the root element of the tree and find an element with a <code>font-size</code> attribute. An unexpected property of this system is that <strong>any</strong> node can have <code>font-size</code> attribute, including a <code>&lt;div&gt;</code>. This was designed for convenience, even though not really semantically correct.</p><p>In React Native, we are more strict about it: <strong>you must wrap all the text nodes inside of a <code>&lt;Text&gt;</code> component</strong>; you cannot have a text node directly under a <code>&lt;View&gt;</code>.</p><div class="prism language-javascript"><span class="token comment" spellcheck="true">// BAD: will fatal, can&#x27;t have a text node as child of a &lt;View&gt;
<span class="token punctuation">}</span></div><p>When the browser is trying to render a text node, it&#x27;s going to go all the way up to the root element of the tree and find an element with a <code>font-size</code> attribute. An unexpected property of this system is that <strong>any</strong> node can have <code>font-size</code> attribute, including a <code>&lt;div&gt;</code>. This was designed for convenience, even though not really semantically correct.</p><p>In React Native, we are more strict about it: <strong>you must wrap all the text nodes inside of a <code>&lt;Text&gt;</code> component</strong>; you cannot have a text node directly under a <code>&lt;View&gt;</code>.</p><div class="prism language-javascript"><span class="token comment" spellcheck="true">// BAD: will raise exception, can&#x27;t have a text node as child of a &lt;View&gt;
</span>&lt;View<span class="token operator">&gt;</span>
Some text
&lt;<span class="token operator">/</span>View<span class="token operator">&gt;</span>