mirror of
https://github.com/status-im/react-native.git
synced 2025-02-11 17:07:09 +00:00
Merge pull request #3495 from dsandor/master
Clarified ReactInstanceManager paragraph.
This commit is contained in:
commit
81317bd27a
@ -106,14 +106,17 @@ class AnExampleReactPackage implements ReactPackage {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
The package needs to be provided to the ReactInstanceManager when it is built. See `UIExplorerActivity.java` for an example. The default package when you initialize a new project is `MainReactPackage.java`.
|
The package needs to be provided to the **ReactInstanceManager** when it is built. To accomplish this you will need to insert an `.addPackage(new YourPackageName())` call to the `mReactInstanceManager = ReactInstanceManager.builder()` call chain.
|
||||||
|
|
||||||
|
Refer to the code below and add the `addPackage` statement to your application's `MainActivity.java` file. This file exists under the android folder in your react-native application directory. The path to this file is: `android/app/src/main/java/com/your-app-name/MainActivity.java`.
|
||||||
|
|
||||||
|
|
||||||
```java
|
```java
|
||||||
mReactInstanceManager = ReactInstanceManager.builder()
|
mReactInstanceManager = ReactInstanceManager.builder()
|
||||||
.setApplication(getApplication())
|
.setApplication(getApplication())
|
||||||
.setBundleAssetName("AnExampleApp.android.bundle")
|
.setBundleAssetName("AnExampleApp.android.bundle")
|
||||||
.setJSMainModuleName("Examples/AnExampleApp/AnExampleApp.android")
|
.setJSMainModuleName("Examples/AnExampleApp/AnExampleApp.android")
|
||||||
.addPackage(new AnExampleReactPackage())
|
.addPackage(new AnExampleReactPackage()) // <-- Add this line with your package name.
|
||||||
.setUseDeveloperSupport(true)
|
.setUseDeveloperSupport(true)
|
||||||
.setInitialLifecycleState(LifecycleState.RESUMED)
|
.setInitialLifecycleState(LifecycleState.RESUMED)
|
||||||
.build();
|
.build();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user