Workaround for restore from background (#17) prevent result of ActivityResultRegistry from working correctly
Description
I'm working on a Brownfield project and I need to interact with native contexts. The problem I'm experiencing is the failure to get activity navigation result using ActivityResultRegistry. Setting savedInstanceState to null in onCreate of the Activity Host prevents the result callback from working correctly.
private val launcher = registerForActivityResult(StartActivityForResult()) { result ->
...
}
Below, the workaround for avoid crash when restoring from background (#17), this prevent that other behaviors working in moment of restoring.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(null);
}
In my testing, i notice that onActivityResult is invoked, but this method is deprecated and changed for ActivityResultRegistry.
Base on this fact, does react-native-screens have any perspective of fixing this behavior for mitigate impact in projects that needs use ActivityResultRegistry?
Steps to reproduce
- Turn on
Don't Keep Activitieson your device - Open the app
- Click on
Navigate to MainActivity 2
Result don't works when returning to the MainActivity
Snack or a link to a repository
https://github.com/jpcoliveira/ActivityRegistrySample
Screens version
3.31.1
React Native version
0.71.6
Platforms
Android
JavaScript runtime
V8
Workflow
None
Architecture
None
Build type
None
Device
Real device
Device model
No response
Acknowledgements
Yes
@kkafar
@jpcoliveira we're aware of this issue, as it happens since #17, thus since the very beginnings of the project. This is on our agenda, however currently there items of higher priority. If you have capacity to suggest / develop a solution, any PR is welcome.