gbumps / react-native-screenguard

A Native screenshot blocking library for React-Native developer, with background customizable after captured. Screenshot detector are also supported.
https://gbumps.github.io/react-native-screenguard/
MIT License
231 stars 28 forks source link

Doesn't work when video is playing in webview inside modal #21

Closed Spawar1530 closed 1 year ago

Spawar1530 commented 1 year ago

Library works fine in most of the cases, I've observed that if webview is opened in modal and video is playing in webview then I am able to take screenshots and do the screen recording. This is happening for ios and android both. Any workaround for this?

gbumps commented 1 year ago

My suggestion is try to embed your Webview inside a React Native <View /> instead of a Modal. Looks like it has some drawback with the Modal view, as well as other modal view like keyboard and some alert dialog.

I think it's not gonna happened on Android in your case because neither can you receive any event nor triggering a screenshot or screen recording as Android system already blocks those methods right after activated.

You can provide more details on which of the Webview library and the Modal view lib you are using so I could suggest for you better.

Spawar1530 commented 1 year ago

I'm using [React native webview](https://www.npmjs.com/package/react-native-webview) and Modal is native module from react-native.

I've also done some research, Modal uses Android's Dialog internally and it creates new window on opening hence FLAG_SECURE doesn't get applied on newly created window.

Can you suggest me any workaround?

gbumps commented 1 year ago

bring your hole logic business to React Native View instead of a Modal, this is the only way.

Spawar1530 commented 1 year ago

Okay thanks for the suggestion