fix: Discard persisted state on Android Activity restart #946
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.
PlayStore console reported some crashes related to react-native-screens that are related to Activity's
onCreate
methodThis bug is well documented in the react-native-screens repository and the recommended action is to discard the Activity's persisted state when restarted
This is because the JS state (redux stores, in-component state etc) is not persisted the same way as the Android activity state, so there can be some inconsistencies between them when the app is restarted
Discarding the state implies that if Android kills the Activity when app is on background, then on when going back to the app it will behave like if it was a fresh start
Another impact is for foldable phones in which the app will restart when splitted into multi-window. But as the app does not support this mode, then this would not be an issue (at least for now)
Related documentation:
https://github.com/software-mansion/react-native-screens#android
Related issue:
software-mansion/react-native-screens#17