
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
react-native-prevent-screenshots
Advanced tools
Prevent Screenshots in your React Native app when needed. 🦄
Prevent Screenshots in your React Native app when needed. 🦄
First, you need to install the package using the command above:
npm install react-native-prevent-screenshots --save
Or if you're using Yarn:
yarn add react-native-prevent-screenshots
For React Native <= 0.59, there's no autolinking so you have to link the package using the command below:
react-native link react-native-prevent-screenshots
In order to use react-native-prevent-screenshots with Expo you have to have native android folder in your app, fortunately you can do that easily without ejecting just by using this command:
expo run:android
which will generate the android folder for you and allow you to use custom native code for android while still using Expo managed workflow.
NOTE: you don't have to do the same for iOS because we use the React Native
AppStateJavaScript API on iOS.
For iOS support you have to wrap the App component with the withPreventScreenshots call like this:
import { withPreventScreenshots } from 'react-native-prevent-screenshots';
function App() {
// ...
}
export default withPreventScreenshots(App);
Now, you can now call PreventScreenshots.start() and PreventScreenshots.stop() functions anywhere in your app to start/stop preventing screenshots.
import { PreventScreenshots } from 'react-native-prevent-screenshots';
// Prevent Screenshots (returns `Promise<boolean>` of the prevention state)
PreventScreenshots.start();
// Allow Screenshots (returns `Promise<boolean>` of the prevention state)
PreventScreenshots.stop();
FAQs
Prevent Screenshots in your React Native app when needed. 🦄
The npm package react-native-prevent-screenshots receives a total of 69 weekly downloads. As such, react-native-prevent-screenshots popularity was classified as not popular.
We found that react-native-prevent-screenshots demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.