I'm using react-native-navigation v2.
What's the recommended/best way to use code-push?
This is how I initialize my app:
Navigation.events().onAppLaunched(() => {
initializeTracking();
Navigation.setRoot({
container: {
name: ROOT_SCREEN,
},
});
});
I was thinking maybe wrapping
I'm not using RNNv2, but I think maybe you only need to register code-push in your ROOT_SCREEN ?
You're right. thanks
@emroot i was stuck with this. May i know how did you use / using codepush with RNN V2
Update the MainApplication.java file to use CodePush via the following changes:
// ...
import com.facebook.react.ReactInstanceManager;
// Add CodePush imports
import com.microsoft.codepush.react.CodePush;
public class MainApplication extends NavigationApplication {
@Override
public boolean isDebug() {
return BuildConfig.DEBUG;
}
@Override
protected ReactGateway createReactGateway() {
ReactNativeHost host = new NavigationReactNativeHost(this, isDebug(), createAdditionalReactPackages()) {
@javax.annotation.Nullable
@Override
protected String getJSBundleFile() {
return CodePush.getJSBundleFile();
}
};
return new ReactGateway(this, isDebug(), host);
}
@Override
public List<ReactPackage> createAdditionalReactPackages() {
return Arrays.<ReactPackage>asList(
new CodePush("deployment-key-here", getApplicationContext(), isDebug())
//,MainReactPackage , etc...
}
}
For more details, please follow the link below:
https://github.com/Microsoft/react-native-code-push/blob/master/docs/setup-android.md#wix-react-native-navigation-applications
credits to @andresesfm
Most helpful comment
Update the
MainApplication.javafile to use CodePush via the following changes:For more details, please follow the link below:
https://github.com/Microsoft/react-native-code-push/blob/master/docs/setup-android.md#wix-react-native-navigation-applications
credits to @andresesfm