killserver / react-native-screenshot-prevent

MIT License
98 stars 38 forks source link

Screenshot prevention has stopped working with iOS 17 #28

Open notclive opened 1 year ago

notclive commented 1 year ago

I understand that the iOS screenshot prevention is unofficial, and is based on a bit of a hack. It looks like this hack has stopped working as of iOS 17.

ajayranga commented 1 year ago

not working on ios 17

Nikooos commented 1 year ago

Running into the same problem here. Interested to see how we can get it working for iOS17 again.

baesumin commented 1 year ago

+1

Nikooos commented 1 year ago

This could offer a possible solution: https://gist.github.com/ashishkakkad8/747223d68f3675dce4f05e4396baec7e

shonie2xx commented 1 year ago

+1

ajayranga commented 1 year ago

HI any update on it

riorafe commented 1 year ago

+1 Its not working in IOS 17

Nikooos commented 1 year ago

I've made this PR that addresses this issues. It works for me by patching this package, but I wanted to contribute with a PR. @killserver

https://github.com/killserver/react-native-screenshot-prevent/pull/31

killserver commented 1 year ago

send update in version 1.1.9. check pls and thx all )

vishalyad16 commented 12 months ago

@killserver @Nikooos @notclive @riorafe After taking screenshot, warning pop-up is not closing & when we come to other screen it takes screenshot

here is my code import ScreenshotPrevent, { addListener } from 'react-native-screenshot-prevent';

componentDidMount(){ // Prevent screenshots when the component is mounted ScreenshotPrevent.enabled(true); ScreenshotPrevent.enableSecureView(); // Add a listener to handle screenshot prevention events this.subscription = addListener(() => { }); } componentWillUnmount() { this._engine?.destroy(); ScreenshotPrevent.enabled(false); ScreenshotPrevent.disableSecureView(); this.subscription.remove(); }

7dp commented 8 months ago

Hi! Thanks for this useful package. 👍🏼 So I have tried version v1.1.9 on iPhone X running iOS 17.2.1, but Im still able to take screenshot.

The screenshot:

image

Code (App.tsx):

!__DEV__ && PreventScreenshot.enableSecureView()

package.json:

"react": "17.0.2",
"react-native": "0.65.1",
"react-native-screenshot-prevent": "^1.1.9",

Any kind of help would be appreciated, thanks.

GianniCarlo commented 3 months ago

I've put up a PR that should fix this issue, the only thing is that since we didn't need the image functionality in my workplace, I didn't have time to test and keep support for it, but the main idea is to add the textfield secure layer to the app's UIWindow, and from there it should work, and we should be able to add the image as a background to the textfield so it works

7dp commented 1 month ago

Thanks @GianniCarlo ! I tried your PR and the enable/disable screenshot works as expected (tested on iOS 17.5 simulator, android not yet).