fix: reattach FullWindowOverlay content when refocusing on current UI…
Description
I recently noticed an issue where any views rendered under FullScreenOverlay would disappear and never come back after opening an image picker (e.g. PHPickerViewController) in my React Native application.
Changes
I added some conditional logic to the didMoveToWindow delegate that checks whether the existing RNSFullWindowOverlayContainer is not nil & has no superview, and if that's the case, reattaches it to the current UIWindow.
Test code and steps to reproduce
- Using the example app, render anything under a
<FullScreenOverlay>component. - Add the
react-native-image-crop-pickerpackage and call itsopenPickerfunction. - This will invoke the existing
didMoveToWindowdelegate, resulting in the first instance ofRNSFullWindowOverlayContainerto be unmounted & removed from the superview. - After closing the image picker,
didMoveToWindowwill be invoked again but theRNSFullWindowOverlayContaineris never re-attached to the current window.
Could you add an example you mentioned to TestExample project that shows this case so we can easily check it?
The same issue occurs when a video from a native AVPlayerViewController goes fullscreen. Just like the picker described in step 2, the window overlay container gets removed and never comes back.
This issue is fixed for me by this: https://github.com/software-mansion/react-native-screens/pull/1872 I no longer need this patch.
@dauby88 hi, thanks for the info! @rodperottoni can you confirm the issue this PR fixes no longer exists for you on the newest version of screens? Or should we still leave this PR?
I would also like to apologize for the huge delay of reviewing this PR, since in react-native-screens there are things that need to be cared of 🙏