react-native-screens icon indicating copy to clipboard operation
react-native-screens copied to clipboard

fix: reattach FullWindowOverlay content when refocusing on current UI…

Open rodperottoni opened this issue 2 years ago • 4 comments

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

  1. Using the example app, render anything under a <FullScreenOverlay> component.
  2. Add the react-native-image-crop-picker package and call its openPicker function.
  3. This will invoke the existing didMoveToWindow delegate, resulting in the first instance of RNSFullWindowOverlayContainer to be unmounted & removed from the superview.
  4. After closing the image picker, didMoveToWindow will be invoked again but the RNSFullWindowOverlayContainer is never re-attached to the current window.

rodperottoni avatar Apr 20 '22 02:04 rodperottoni

Could you add an example you mentioned to TestExample project that shows this case so we can easily check it?

WoLewicki avatar Apr 20 '22 13:04 WoLewicki

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.

dauby88 avatar May 02 '23 15:05 dauby88

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 avatar Jan 09 '24 15:01 dauby88

@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 🙏

tboba avatar Jan 10 '24 09:01 tboba