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:
@@ -291,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 shouldn’t run into any “Failed to resolve: com.facebook.react:react-native:0.x.x" 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"><uses<span class="token operator">-</span>permission android<span class="token punctuation">:</span>name<span class="token operator">=</span><span class="token string">"android.permission.INTERNET"</span> <span class="token operator">/</span><span class="token operator">></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'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 <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>
|
||||
<span class="token punctuation">}</span></div><blockquote><p>Make sure that the path is correct! You shouldn’t run into any “Failed to resolve: com.facebook.react:react-native:0.x.x" 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"><uses<span class="token operator">-</span>permission android<span class="token punctuation">:</span>name<span class="token operator">=</span><span class="token string">"android.permission.INTERNET"</span> <span class="token operator">/</span><span class="token operator">></span></div><p>If you need to access to the <code>DevSettingsActivity</code> add to your <code>AndroidManifest.xml</code>:</p><div class="prism language-javascript"><activity android<span class="token punctuation">:</span>name<span class="token operator">=</span><span class="token string">"com.facebook.react.devsupport.DevSettingsActivity"</span> <span class="token operator">/</span><span class="token operator">></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'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 <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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user