Updated docs for next

This commit is contained in:
Website Deployment Script
2016-10-14 16:00:01 +00:00
parent 1054f6e21a
commit 4ce6820362
@@ -87,6 +87,7 @@ target <span class="token string">&#x27;NumberTileGame&#x27;</span> <span class=
pod <span class="token string">&#x27;React&#x27;</span><span class="token punctuation">,</span> <span class="token punctuation">:</span>path <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token string">&#x27;../node_modules/react-native&#x27;</span><span class="token punctuation">,</span> <span class="token punctuation">:</span>subspecs <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">[</span>
<span class="token string">&#x27;Core&#x27;</span><span class="token punctuation">,</span>
<span class="token string">&#x27;RCTText&#x27;</span><span class="token punctuation">,</span>
<span class="token string">&#x27;RCTNetwork&#x27;</span><span class="token punctuation">,</span>
<span class="token string">&#x27;RCTWebSocket&#x27;</span><span class="token punctuation">,</span> # needed <span class="token keyword">for</span> debugging
# Add any other subspecs you want to use <span class="token keyword">in</span> your project
<span class="token punctuation">]</span>
@@ -107,6 +108,7 @@ target <span class="token string">&#x27;swift-2048&#x27;</span> <span class="tok
pod <span class="token string">&#x27;React&#x27;</span><span class="token punctuation">,</span> <span class="token punctuation">:</span>path <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token string">&#x27;../node_modules/react-native&#x27;</span><span class="token punctuation">,</span> <span class="token punctuation">:</span>subspecs <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">[</span>
<span class="token string">&#x27;Core&#x27;</span><span class="token punctuation">,</span>
<span class="token string">&#x27;RCTText&#x27;</span><span class="token punctuation">,</span>
<span class="token string">&#x27;RCTNetwork&#x27;</span><span class="token punctuation">,</span>
<span class="token string">&#x27;RCTWebSocket&#x27;</span><span class="token punctuation">,</span> # needed <span class="token keyword">for</span> debugging
# Add any other subspecs you want to use <span class="token keyword">in</span> your project
<span class="token punctuation">]</span>
@@ -289,7 +291,7 @@ AppRegistry<span class="token punctuation">.</span><span class="token function">
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token punctuation">}</span></div><blockquote><p>Make sure that the path is correct! You shouldnt run into any “Failed to resolve: com.facebook.react:react-native:0.x.x&quot; errors after running Gradle sync in Android Studio.</p></blockquote><p>Next, make sure you have the Internet permission in your <code>AndroidManifest.xml</code>:</p><div class="prism language-javascript">&lt;uses<span class="token operator">-</span>permission android<span class="token punctuation">:</span>name<span class="token operator">=</span><span class="token string">&quot;android.permission.INTERNET&quot;</span> <span class="token operator">/</span><span class="token operator">&gt;</span></div><p>This is only really used in dev mode when reloading JavaScript from the development server, so you can strip this in release builds if you need to.</p><h2><a class="anchor" name="add-native-code"></a>Add native code <a class="hash-link" href="docs/integration-with-existing-apps.html#add-native-code">#</a></h2><p>You need to add some native code in order to start the React Native runtime and get it to render something. To do this, we&#x27;re going to create an <code>Activity</code> that creates a <code>ReactRootView</code>, starts a React application inside it and sets it as the main content view.</p><blockquote><p>If you are targetting Android version &lt;5, use the <code>AppCompatActivity</code> class from the <code>com.android.support:appcompat</code> package instead of <code>Activity</code>.</p><p>If you find out later that your app crashes due to <code>Didn&#x27;t find class &quot;com.facebook.jni.IteratorHelper&quot;</code> exception, uncomment the <code>setUseOldBridge</code> line. <a href="https://github.com/facebook/react-native/issues/8701" target="_blank">See related issue on GitHub.</a></p></blockquote><div class="prism language-javascript">public class <span class="token class-name">MyReactActivity</span> extends <span class="token class-name">Activity</span> implements <span class="token class-name">DefaultHardwareBackBtnHandler</span> <span class="token punctuation">{</span>
<span class="token punctuation">}</span></div><blockquote><p>Make sure that the path is correct! You shouldnt run into any “Failed to resolve: com.facebook.react:react-native:0.x.x&quot; errors after running Gradle sync in Android Studio.</p></blockquote><p>Next, make sure you have the Internet permission in your <code>AndroidManifest.xml</code>:</p><div class="prism language-javascript">&lt;uses<span class="token operator">-</span>permission android<span class="token punctuation">:</span>name<span class="token operator">=</span><span class="token string">&quot;android.permission.INTERNET&quot;</span> <span class="token operator">/</span><span class="token operator">&gt;</span></div><p>This is only really used in dev mode when reloading JavaScript from the development server, so you can strip this in release builds if you need to.</p><h2><a class="anchor" name="add-native-code"></a>Add native code <a class="hash-link" href="docs/integration-with-existing-apps.html#add-native-code">#</a></h2><p>You need to add some native code in order to start the React Native runtime and get it to render something. To do this, we&#x27;re going to create an <code>Activity</code> that creates a <code>ReactRootView</code>, starts a React application inside it and sets it as the main content view.</p><blockquote><p>If you are targetting Android version &lt;5, use the <code>AppCompatActivity</code> class from the <code>com.android.support:appcompat</code> package instead of <code>Activity</code>.</p></blockquote><div class="prism language-javascript">public class <span class="token class-name">MyReactActivity</span> extends <span class="token class-name">Activity</span> implements <span class="token class-name">DefaultHardwareBackBtnHandler</span> <span class="token punctuation">{</span>
private ReactRootView mReactRootView<span class="token punctuation">;</span>
private ReactInstanceManager mReactInstanceManager<span class="token punctuation">;</span>
@@ -305,8 +307,7 @@ AppRegistry<span class="token punctuation">.</span><span class="token function">
<span class="token punctuation">.</span><span class="token function">addPackage<span class="token punctuation">(</span></span><span class="token keyword">new</span> <span class="token class-name">MainReactPackage</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">setUseDeveloperSupport<span class="token punctuation">(</span></span>BuildConfig<span class="token punctuation">.</span>DEBUG<span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">setInitialLifecycleState<span class="token punctuation">(</span></span>LifecycleState<span class="token punctuation">.</span>RESUMED<span class="token punctuation">)</span>
<span class="token comment" spellcheck="true"> //.setUseOldBridge(true) // uncomment this line if your app crashes
</span> <span class="token punctuation">.</span><span class="token function">build<span class="token punctuation">(</span></span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">.</span><span class="token function">build<span class="token punctuation">(</span></span><span class="token punctuation">)</span><span class="token punctuation">;</span>
mReactRootView<span class="token punctuation">.</span><span class="token function">startReactApplication<span class="token punctuation">(</span></span>mReactInstanceManager<span class="token punctuation">,</span> <span class="token string">&quot;HelloWorld&quot;</span><span class="token punctuation">,</span> <span class="token keyword">null</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">setContentView<span class="token punctuation">(</span></span>mReactRootView<span class="token punctuation">)</span><span class="token punctuation">;</span>