
Product
A Fresh Look for the Socket Dashboard
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
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,336 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.
Product
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
Industry Insights
Terry O’Daniel, Head of Security at Amplitude, shares insights on building high-impact security teams, aligning with engineering, and why AI gives defenders a fighting chance.
Security News
MCP spec updated with structured tool output, stronger OAuth 2.1 security, resource indicators, and protocol cleanups for safer, more reliable AI workflows.