This repository was archived by the owner on May 20, 2025. It is now read-only.
Support React Native 0.37.0 #602
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As identified in #582, with RN 36 and 37, CodePush will crash on Android when the app is restarted using the
InstallMode.IMMEDIATE
andInstallMode.ON_NEXT_RESUME
modes. The regression seems to originate from this change, where React'sLifeCycleEventListener
will now triggeronAppResume()
immediately if it is added while the app is in the foreground. As our code depends on this being triggered only in the act of the app being resumed from the background,loadBundle()
will be called twice, causing issues.The solution here is to modify our resume handler to only perform the action if the app is backgrounded AND THEN resumed. There is a limitation here - in the rare cases when the app is in the background when the listener is added, then it will need to be resumed twice to achieve the desired effect. It is unclear to me how to work around this - we could try to use the
RESUMED
andBEFORE_RESUME
enum values provided by React Native, but then we'd lose compatibility with earlier RN versions. It's also strange thatonHostPause()
is not also triggered immediately when added if the app is in the background, but that would have also solved this problem.