Hello Friends đź‘‹,

Welcome To Infinitbility! ❤️

Due to many security reasons, we want to prevent our users to take screenshots and a screen capture of our react native application.

Today, we will learn and see examples of preventing screen capture in react native.

To enable or disable screenshot, React native have package react-native-screen-capture-secure, this package help you to enable or disable screen capture.

Installation

To install the package with NPM

npm install react-native-screen-capture-secure

To install the package with YARN

yarn add react-native-screen-capture-secure

You should link the package in your application ( recommended by documentation )

npx react-native link react-native-screen-capture-secure

Usages

React native screen capture secure provide two methods to enable and disable screen capture.

To disable screen capture, ScreenCaptureSecure.enableSecure();. To enable screen capture, ScreenCaptureSecure.disableSecure();.

import ScreenCaptureSecure from 'react-native-screen-capture-secure';

ScreenCaptureSecure.enableSecure();
ScreenCaptureSecure.disableSecure();

Thanks for reading…