software-mansion / react-native-screens

Native navigation primitives for your React Native app.
https://docs.swmansion.com/react-native-screens/
MIT License
3.11k stars 521 forks source link

FullWindowOverlay - UI is not touchable when over iOS file-viewer's QuickLook #1666

Open Ldoppea opened 1 year ago

Ldoppea commented 1 year ago

Description

Hi,

Note I found this issue that is also about interaction problem #1663. But i'm not sure if it is related or not

My project is using both react-native-screens and react-native-file-viewer

I need to be able to display an Overlay on top of the QuickLook View opened by react-native-file-viewer. So i'm using <FullWindowOverlay>.

When doing so, my Overlay is correctly displayed on top of the QuickLook View. But some UI components does not react to touch inputs anymore:

I created a reproduction repository. Here is what is displayed: simulator_screenshot_9BE7F4BB-8188-4C43-A184-76287E763D2A

✅ The input text can be used. You can enter a in the keyboard to hide the screen.

❌ If you click on the Close the Overlay button, nothing will happen.

✅ But if you close the QuickLook first, then click on the button, the screen will be hidden.

I tried to implement this PR #1582 has it is about touch interaction. When doing so, the hitTest method correctly detect the clicked button. But nothing happens after that (onPress callback is not called) (this modification is not included in my reproduction reprository) image

Do you understand why this happens?

Steps to reproduce

Snack or a link to a repository

https://github.com/Ldoppea/react-native-bug-reports/tree/bug/react-native-screens-file-viewer

Screens version

3.18.2

React Native version

0.66.4

Platforms

iOS

JavaScript runtime

None

Workflow

React Native (without Expo)

Architecture

Paper (Old Architecture)

Build type

Debug mode

Device

iOS simulator

Device model

iPhone 14

Acknowledgements

Yes

Ldoppea commented 1 year ago

I made some more investigations.

I applied this patch on the react-native-file-viewer extension : https://github.com/vinzscam/react-native-file-viewer/pull/111/files which convert the file-viewer into a modal (vs fullScreen).

When doing so, the interaction with the overlay is working correctly.

If I put fullScreen back, then the interaction doesn't work anymore.

navigationController.modalPresentationStyle = UIModalPresentationFullScreen;

So it seems related to having a fullscreen ViewController behind the Overlay.

StanislavSava commented 1 year ago

I just stumbled upon the exact same problem, when I try to render a FullWindowOverlay on top of a fullScreenModal, the overlay renders correctly, but nothing inside it is interactable. @Ldoppea did you find a solution for this?

StanislavSava commented 1 year ago

I found a solution for this. If anyone stumbles upon this issue in the future, try using touchables from react-native-gesture-handler instead of react-native, they seem to handle gestures better and all the buttons should work, regardless of what's behind the FullWindowOverlay!

bsonmez commented 1 year ago

Same here

teivienn commented 11 months ago

I think this will work as a temporary solution. I had a slightly different problem with the portals. And I achieved the desired result by adding these lines

<Portal>
  <FullWindowOverlay>
      <GestureHandlerRootView style={{ flex: 1 }}>
         {props.children}
      </GestureHandlerRootView>
  </FullWindowOverlay>
</Portal>

Specifically my problem was with the react-navigation presentation modal

idudinov commented 2 months ago

just came across a somewhat similar issue, not sure if that's relevant to the original issue though, but just wanted to share an alternative solution without react-native-gesture-handler.

I was trying to use FullWindowOverlay for displaying a loading indicator over the stack navigators's modal (I think it's relevant for native Modal as well). My goal was to handle any touches on the top layer so they don't go down, but immediate Pressable child of FullWindowOverlay didn't want to handle touches at all, same as for some people above.

After some time spent on research, I realized that in the original example of FullWindowOverlay there's an additional View wrapper with pointerEvents="box-none":

https://github.com/software-mansion/react-native-screens/blob/61ef1865c19a1eef005120001cbba9e72db388dc/apps/src/tests/Test1096.tsx#L37-L39

And then in its turn there's a button inside it, which obviously works.

So I've added such wrapper and it fixed my issue. Hopefully this helps someone.