# react-native-screenshot-prevent

> This fork contains fully working blank screenshot on IOS13+ including screen recording

Latest version **1.2.2** (published 2026-03-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-screenshot-prevent
pnpm add react-native-screenshot-prevent
yarn add react-native-screenshot-prevent
bun add react-native-screenshot-prevent
```

## Health

**Score 60/100 (C)** — status: active.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.2.2 |
| Published | 2026-03-21 |
| First published | 2021-05-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 16.0.0 |
| Dependencies | 0 |
| Unpacked size | 77.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 134 |
| Author | killserver |
| Maintainers | killserverx100 |
| Keywords | react-native, ios, android |

## Links

- npm: https://www.npmjs.com/package/react-native-screenshot-prevent
- Repository: https://github.com/killserver/react-native-screenshot-prevent
- Homepage: https://github.com/killserver/react-native-screenshot-prevent#readme
- Issues: https://github.com/killserver/react-native-screenshot-prevent/issues
- npm.io page: https://npm.io/package/react-native-screenshot-prevent

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.2.2 (latest) — 2026-03-21
- 1.2.1 — 2024-06-02
- 1.2.0 — 2024-03-14
- 1.1.9 — 2023-10-04
- 1.1.8 — 2023-10-04
- 1.1.7 — 2023-06-29
- 1.1.6 — 2023-06-23
- 1.1.4 — 2023-06-19
- 1.1.3 — 2023-06-16
- 1.1.1 — 2023-03-14
- 1.1.0 — 2023-03-13
- 1.0.11 — 2023-03-09
- 1.0.10 — 2023-03-09
- 1.0.9 — 2023-03-07
- 1.0.8 — 2023-03-07
- … 8 more at https://npm.io/package/react-native-screenshot-prevent/versions

## README

[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)

# react-native-screenshot-prevent

### This fork contains fully working blank screenshot on IOS13+ including screen recording
### This fork contains fully working image screenshot cover on IOS13+ including screen recording
### App layout is white / or black in dark theme

#### For now you might disable RNPreventScreenshot.enableSecureView() in development mode (check __DEV__ variable)
#### because disableSecureView() is not working yet correctly


## Getting started

`$ npm install react-native-screenshot-prevent --save`

### Mostly automatic installation

### React-Native version 0.59.X and higher: on IOS you might use only `pod install` in your ios folder

`$ react-native link react-native-screenshot-prevent`

### Manual installation


#### iOS

1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`
2. Go to `node_modules` ➜ `react-native-screenshot-prevent` and add `RNScreenshotPrevent.xcodeproj`
3. In XCode, in the project navigator, select your project. Add `libRNScreenshotPrevent.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`
4. Run your project (`Cmd+R`)<

#### Android

1. Open up `android/app/src/main/java/[...]/MainApplication.java`
  - Add `import com.killserver.screenshotprev.RNScreenshotPreventPackage;` to the imports at the top of the file
  - Add `new RNScreenshotPreventPackage()` to the list returned by the `getPackages()` method
2. Append the following lines to `android/settings.gradle`:
  	```
  	include ':react-native-screenshot-prevent'
  	project(':react-native-screenshot-prevent').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-screenshot-prevent/android')
  	```
3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
  	```
       implementation project(':react-native-screenshot-prevent')
  	```



## Usage
```javascript

// sample code

import RNScreenshotPrevent, { addListener } from 'react-native-screenshot-prevent';

/* (IOS, Android) for android might be the only step to get secureView
 * on IOS enables blurry view when app goes into inactive state
 */
RNScreenshotPrevent.enabled(true/false);

/* (IOS) enableSecureView for IOS13+ 
 * creates a hidden secureTextField which prevents Application UI capture on screenshots
 */
if(!__DEV__) RNScreenshotPrevent.enableSecureView();

/* (IOS) enableSecureView for IOS13+ 
 * creates a hidden secureTextField which prevents Application UI capture on screenshots
 * and uses imgUri as the source of the background image (can be both https://, file:///)
 */
if(!__DEV__) RNPreventScreenshot.enableSecureView(imgUri);

/* (IOS) disableSecureView for IOS13+ 
 * remove a hidden secureTextField which prevents Application UI capture on screenshots
 */
if(!__DEV__) RNScreenshotPrevent.disableSecureView();

/* (IOS) notification handler
 * notifies when user has taken screenshot (yes, after taking) - you can show alert or do some actions
 *
 * @param {function} callback fn
 * @returns object with .remove() method
 */
addListener(fn);

/** example using the listener */
useEffect(() => {
	const subscription = RNScreenshotPrevent.addListener(() => {
		console.log('Screenshot taken');
		showAlert({
			title: 'Warning',
			message: 'You have taken a screenshot of the app. This is prohibited due to security reasons.',
			confirmText: 'I understand'
		});
	})

	return () => {
		subscription.remove();
	}
}, []);

```

  
[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/killeserver)

---
_Source: https://npm.io/package/react-native-screenshot-prevent · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
