Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 6733ac2

Browse files
andresesfmitoys
authored andcommitted
Add documentation to RNN V2 (#1239)
Add steps to integrate CodePush with React Native Navigation V2.
1 parent 58be2bc commit 6733ac2

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

docs/setup-android.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,55 @@ public class MainApplication extends NavigationApplication implements ReactInsta
311311
}
312312
}
313313
```
314+
If you are using [WIX React Native Navigation **version 2.x**](https://github.com/wix/react-native-navigation/tree/v2) based application, please do the following steps to integrate CodePush:
315+
316+
1. As per React Native Navigation's documentation, `MainActivity.java` should extend `NavigationActivity`, no changes required to incorporate CodePush:
317+
318+
```java
319+
import com.reactnativenavigation.NavigationActivity;
320+
321+
public class MainActivity extends NavigationActivity {
322+
323+
}
324+
```
325+
326+
2. Update the `MainApplication.java` file to use CodePush via the following changes:
327+
328+
```java
329+
// ...
330+
import com.facebook.react.ReactInstanceManager;
331+
332+
// Add CodePush imports
333+
import com.microsoft.codepush.react.CodePush;
334+
335+
public class MainApplication extends NavigationApplication {
336+
337+
@Override
338+
public boolean isDebug() {
339+
return BuildConfig.DEBUG;
340+
}
341+
342+
@Override
343+
protected ReactGateway createReactGateway() {
344+
ReactNativeHost host = new NavigationReactNativeHost(this, isDebug(), createAdditionalReactPackages()) {
345+
@javax.annotation.Nullable
346+
@Override
347+
protected String getJSBundleFile() {
348+
return CodePush.getJSBundleFile();
349+
}
350+
351+
};
352+
return new ReactGateway(this, isDebug(), host);
353+
}
354+
355+
@Override
356+
public List<ReactPackage> createAdditionalReactPackages() {
357+
return Arrays.<ReactPackage>asList(
358+
new CodePush("deployment-key-here", getApplicationContext(), isDebug())
359+
//,MainReactPackage , etc...
360+
}
361+
}
362+
```
314363

315364
#### Code Signing setup
316365

0 commit comments

Comments
 (0)