
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
react-native-capture-protection
Advanced tools
🛡️ 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.
🛡️ A React Native library to prevent screen capture, screenshots and app switcher for enhanced security. Fully compatible with both Expo and CLI.
screenshot | app switcher |
---|---|
![]() |
npm install react-native-capture-protection
yarn add react-native-capture-protection
Only Expo Dev client compatible This library has native code, so it's not work for Expo Go but it's compatible with custom dev client.
npx expo install react-native-capture-protection
On Android versions below 14, storage permissions are required to determine if a screen capture is enabled.
android/app/build.gradle
defaultConfig {
...
missingDimensionStrategy "react-native-capture-protection", "fullMediaCapture"
}
Details on Google Play's Photo and Video Permissions policy READ_MEDIA_IMAGES
Used by the application to detect screenshots, to detect the presence of screenshot files on the user's media.
android/app/build.gradle
defaultConfig {
...
missingDimensionStrategy "react-native-capture-protection", "restrictedCapture"
}
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
);
};
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
Made with create-react-native-library
FAQs
🛡️ 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.
The npm package react-native-capture-protection receives a total of 2,421 weekly downloads. As such, react-native-capture-protection popularity was classified as popular.
We found that react-native-capture-protection demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.