Stackedo
Stackedo

Reputation: 933

How to detect a screenshot in a RN application?

I'm having some problem about a screenshot-detector in an application.

I'm using EXPO, but I've no idea about how can I detect a screenshot. Suppose that I've a profile screen. Each user has a profile page, I want to detect when another user does a screenshot on the screen.

My problem is: how can I detect this? I readed about the gesture here, but it didn't help me. With the gestures I can detect, instead, the scroll in a page, the location x and location y.

I readed also this answer, but about the event touchesCancelled:withEvent:touchesCancelled:withEvent: I have not found anything in React Native docs (and also EXPO docs).

So: which is the idea behind a screenshot detector? Thanks for your help!

Upvotes: 0

Views: 1697

Answers (2)

Abdulaziz Alkharashi
Abdulaziz Alkharashi

Reputation: 1316

Currently with expo there is no way to do that, But if you detach you can use this package it supports android&ios screenshot detecting react-native-detector

Upvotes: 0

user3764429
user3764429

Reputation: 402

You can't do it without detaching EXPO. There is already a feature request for that.

If you decide to detach EXPO, react-native-screenshot-detector might be helpful. The solution is very similar to the one from the linked question.

Upvotes: 1

Related Questions