wn-na/react-native-capture-protection
wn-na/react-native-capture-protection has 322 GitHub stars and 22 forks. Star changes are not measured yet. Last checked 2026-11-14 02:11 UTC. Last push 2026-10-25.
What you can do
- 🔒 iOS: Screenshot, Screen Recording & App Switcher protection
- 🔒 Android: Screenshot & Screen Recording protection
- 📡 Event listeners for capture events
- 🧩 Hooks & Provider support
측정된 스타 증가
- in 24h
- 기록 수집 중
- in 7 days
- 기록 수집 중
- in 15 days
- 기록 수집 중
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
소개
🛡️ A React Native library to prevent and detect for screen capture, screenshots and app switcher for enhanced security. Fully compatible with both Expo and CLI.
보안README.md
Original🛡️ react-native-capture-protection
A React Native library to prevent screen capture, screenshots, and app switcher previews—providing enhanced security for your app.
Fully compatible with React Native CLI and Expo (Dev Client only).
📸 Screenshots
| Screenshot Protection | App Switcher Protection |
|---|---|
![]() |
✨ Features
- 🔒 iOS: Screenshot, Screen Recording & App Switcher protection
- 🔒 Android: Screenshot & Screen Recording protection
- 📡 Event listeners for capture events
- 🧩 Hooks & Provider support
- 📱 Android 14 support
🚀 Installation
⚠️ Using React Native < 0.70?
The latest v2.x version may not be compatible with versions below 0.70.
It is recommended to usev1.9.17for better stability with older React Native projects.
Using npm
npm install react-native-capture-protection
Using yarn
yarn add react-native-capture-protection
Using with Expo
⚠️ Expo Dev Client only This library includes native code, so it does not work with Expo Go. You must use a custom dev client.
npx expo install react-native-capture-protection
🔧 iOS Setup
If you're developing for iOS, don't forget to install CocoaPods dependencies after installing the package.
cd ios && pod install
⚙️ Android Configuration (Required)
By default, it supports capture prevention, capture permission, and capture detection on Android 14 and above. On Android versions below 14 (Android 10-13), capture prevention and capture permission are supported by default; if you want capture detection support too, please refer to the Capture Detection Before Android 14 (Optional) below.
React Native CLI
add to android/app/build.gradle
defaultConfig {
...
missingDimensionStrategy "react-native-capture-protection", "base"
}
Expo (Dev Client only)
add to app.json
{
...
"plugins": [
...,
[
"react-native-capture-protection",
{
"captureType": "base"
}
]
]
}
Capture Detection Before Android 14 (Optional)
On Android versions below 14 (Android 10-13), capture prevention and capture permission are supported by default and require no more steps. However, if you want capture detection to work on Android versions below 14, please configure the settings as follows (it detects screen captures using the sensitive READ_MEDIA_IMAGES permission):
Google Play Store Policy (READ_MEDIA_IMAGES)
If publishing to the Play Store, explain the usage of READ_MEDIA_IMAGES like this:
Used by the application to detect screenshots, by checking for screenshot files in the user’s media storage.
React Native CLI
add to android/app/build.gradle
defaultConfig {
...
missingDimensionStrategy "react-native-capture-protection", "callbackTiramisu"
}
Expo (Dev Client only)
add to app.json
{
...
"plugins": [
...,
[
"react-native-capture-protection",
{
"captureType": "callbackTiramisu"
}
]
]
}
📦 Usage
import {
CaptureProtection,
useCaptureProtection,
CaptureEventType
} from 'react-native-capture-protection';
const Component = () => {
const { protectionStatus, status } = useCaptureProtection();
React.useEffect(() => {
// Prevent all capture events
CaptureProtection.prevent();
// Or prevent specific events
CaptureProtection.prevent({
screenshot: true,
record: true,
appSwitcher: true
});
}, []);
React.useEffect(() => {
// Check if any capture is prevented
console.log('Prevent Status:', protectionStatus);
// Check current protection status
console.log('Protection Status:', status);
}, [protectionStatus, status]);
// Allow all capture events
const onAllow = async () => {
await CaptureProtection.allow();
};
// Allow specific events
const onAllowSpecific = async () => {
await CaptureProtection.allow({
screenshot: true,
record: false,
appSwitcher: true
});
};
// Check if screen is being recorded
const checkRecording = async () => {
const isRecording = await CaptureProtection.isScreenRecording();
console.log('Is Recording:', isRecording);
};
return (
// Your component JSX
);
};
Jest integration
With Jest Setup
- Add to your
jest.config.js:
module.exports = {
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
};
- Create jest.setup.js:
jest.mock('react-native-capture-protection', () =>
require('react-native-capture-protection/jest/capture-protection-mock')
);
Overriding mock
import { CaptureProtection } from "react-native-capture-protection/jest/capture-protection-mock";
...
test("prevent is called", async () => {
await CaptureProtection.prevent();
expect(CaptureProtection.prevent).toHaveBeenCalled();
});
📚 Documentation
🧪 Methods – All available API methods
📘 Types – Type definitions and interfaces
🛠 Migration Guide – From v1.x to v2.x
🤝 Contributing
See CONTRIBUTING.md for details on contributing to this project.
📄 License
MIT
Made with create-react-native-library
관련 프로젝트 살펴보기
trimstray/the-book-of-secret-knowledge
영감을 주는 목록, 매뉴얼, 치트시트, 블로그, 팁, 원라이너, CLI/웹 도구 등을 모은 컬렉션.
258,324 스타Hack-with-Github/Awesome-Hacking
해커, 펜테스터, 보안 연구자를 위한 다양한 Awesome 목록 모음.
125,467 스타swisskyrepo/PayloadsAllTheThings
웹 애플리케이션 보안과 모의 침투 테스트/CTF에 유용한 페이로드 및 우회 방법 목록.
82,662 스타caddyserver/caddy
빠르고 확장 가능한 멀티플랫폼 HTTP/1-2-3 웹 서버이며, 자동 HTTPS를 지원합니다
79,026 스타