forked from microsoft/react-native-code-push
-
Notifications
You must be signed in to change notification settings - Fork 15
Closed
Description
It seems CodePush instance could be instantiated multiple times on new architecture if you initiate ReactPackage in ReactHostHelper Function.
// Not working
override val reactHost: ReactHost get() = getDefaultReactHost(
context = this,
packageList = PackageList(this).packages.apply {
// Packages that cannot be autolinked yet can be added manually here, for example:
// add(MyReactNativePackage())
},
jsBundleFilePath = CodePush.getJSBundleFile(),
useDevSupport = BuildConfig.DEBUG,
isHermesEnabled = BuildConfig.IS_HERMES_ENABLED
)To prevent this, we guide to instantiate ReactPackage seperatly from ReactHost like this, but it's not intuitive, and different with default react-native configuration.
val defaultPackageList by lazy {
PackageList(this).packages.apply {
// Packages that cannot be autolinked yet can be added manually here, for example:
// add(MyReactNativePackage())
}
}
override val reactHost: ReactHost get() = getDefaultReactHost(
context = this,
packageList = defaultPackageList,
jsBundleFilePath = CodePush.getJSBundleFile(),
useDevSupport = BuildConfig.DEBUG,
isHermesEnabled = BuildConfig.IS_HERMES_ENABLED
)
Decouple CodePush initializing lifecycle from ReactPackage initailizing, so that RN configuration code doesn't affect on CodePush
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels