
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
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 previewsโproviding enhanced security for your app.
Fully compatible with React Native CLI and Expo (Dev Client only).
Screenshot Protection | App Switcher Protection |
---|---|
![]() |
โ ๏ธ 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.17
for better stability with older React Native projects.
npm install react-native-capture-protection
yarn add react-native-capture-protection
โ ๏ธ 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
Android 13 and Below: Enable Storage Permissions To detect screenshots on Android versions below 14, add the following
If you're developing for iOS, don't forget to install CocoaPods dependencies after installing the package.
cd ios && pod install
add to android/app/build.gradle
defaultConfig {
...
missingDimensionStrategy "react-native-capture-protection", "fullMediaCapture"
}
add to app.json
{
...
"plugins": [
...,
[
"react-native-capture-protection",
{
"captureType": "fullMediaCapture"
}
]
]
}
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.
If you want to disable screenshot detection and only block recording/switcher:
add to android/app/build.gradle
defaultConfig {
...
missingDimensionStrategy "react-native-capture-protection", "restrictedCapture"
}
add to app.json
{
...
"plugins": [
...,
[
"react-native-capture-protection",
{
"captureType": "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
);
};
๐งช Methods โ All available API methods
๐ Types โ Type definitions and interfaces
๐ Migration Guide โ From v1.x to v2.x
See CONTRIBUTING.md for details on contributing to this project.
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 6,075 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last weekโs supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.