[docs] Add information about how to configure CodePush for applications using ReactInstanceManager.builder() to initialize RN (#1098)

This commit is contained in:
Ruslan Bikkinin 2017-12-06 10:32:23 +03:00 коммит произвёл GitHub
Родитель eceb26158f
Коммит 0d6f0b4876
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 37 добавлений и 1 удалений

Просмотреть файл

@ -66,6 +66,8 @@ After installing the plugin and syncing your Android Studio project with Gradle,
**For React Native >= v0.29**
If you are integrating Code Push into React Native application please do the following steps:
Update the `MainApplication.java` file to use CodePush via the following changes:
```java
@ -107,6 +109,40 @@ protected String getJSMainModuleName() {
}
```
If you are integrating React Native into existing native application please do the following steps:
Update `MyReactActivity.java` (it could be named differently in your app) file to use CodePush via the following changes:
```java
...
// 1. Import the plugin class.
import com.microsoft.codepush.react.CodePush;
public class MyReactActivity extends Activity {
private ReactRootView mReactRootView;
private ReactInstanceManager mReactInstanceManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
...
mReactInstanceManager = ReactInstanceManager.builder()
// ...
// Add CodePush package
.addPackage(new CodePush("deployment-key-here", getApplicationContext(), BuildConfig.DEBUG))
// Get the JS Bundle File via Code Push
.setJSBundleFile(CodePush.getJSBundleFile())
// ...
.build();
mReactRootView.startReactApplication(mReactInstanceManager, "MyReactNativeApp", null);
setContentView(mReactRootView);
}
...
}
```
**For React Native v0.19 - v0.28**
Update the `MainActivity.java` file to use CodePush via the following changes:
@ -236,4 +272,4 @@ new CodePushBuilder("deployment-key-here",getApplicationContext())
.setIsDebugMode(BuildConfig.DEBUG)
.setPublicKeyResourceDescriptor(R.string.CodePushPublicKey)
.build()
```
```