Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
react-native-screenguard
Advanced tools
A Native library for blocking screenshot for react-native developer, with background color screenshot customizable
A Native library for blocking screenshot for react-native developer, with background color screenshot customizable.
$ npm install react-native-screenguard --save
$ yarn add react-native-screenguard
React-native 0.60 and higher: just cd ios && pod install
, no additional requirements.
React-native 0.59 and lower: Please do manual installation as follow
In XCode, in the project navigator, right click Libraries
➜ Add Files to [your project's name]
Go to node_modules
➜ react-native-screenguard
and add ScreenGuard.xcodeproj
In XCode, in the project navigator, select your project. Add libScreenguard.a
to your project's Build Phases
➜ Link Binary With Libraries
android/app/src/main/java/[...]/MainActivity.java
Add import com.screenguard.ScreenGuardPackage;
to the imports at the top of the file
Add new ScreenGuardPackage()
to the list returned by the getPackages()
method
Append the following lines to android/settings.gradle
:
include ':react-native-screenguard'
project(':react-native-screenguard').projectDir = new File(rootProject.projectDir,'../node_modules/react-native-screenguard/android')
Insert the following lines inside the dependencies block in android/app/build.gradle
:
compile project(':react-native-screenguard')
For Expo user: First, you need to eject Expo or npx expo prebuild
in order to use this library, check Expo docs below:
https://docs.expo.dev/workflow/prebuild/
import ScreenGuardModule from 'react-native-screenguard';
ScreenGuardModule.register('', (_) => {
.....do anything you want after the screenshot
});
import ScreenGuardModule from 'react-native-screenguard';
ScreenGuardModule.register(
//insert any hex color you want here, default black if null or empty
'#0F9D58',
(_) => {
.....do anything you want after the screenshot
});
import ScreenGuardModule from 'react-native-screenguard';
ScreenGuardModule.registerWithoutScreenguard(
(_) => {
.....do anything you want after the screenshot
});
ScreenGuardModule.unregister();
This library support blocking view from being screenshoted for iOS 13+ only.
register
supports Background color for the layout received after screenshoted and event callback after screenshot for iOS only.
On Android, if you want to use callback after a screenshot, consider using registerWithoutScreenguard
instead, as you might not receive any event after a screenshot has been triggered if using with register
.
All contributions are welcome! Please open an issue if you get stuck and bugs, or a PR if you have any feature idea, improvements and bug fixing. I'm very appreciate !
MIT
FAQs
A Native screenshot blocking library for React-Native developer, with background customizable after captured. Screenshot detector are also supported.
The npm package react-native-screenguard receives a total of 2,539 weekly downloads. As such, react-native-screenguard popularity was classified as popular.
We found that react-native-screenguard demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.