Gathering detailed insights and metrics for yl-rn-screenguard
Gathering detailed insights and metrics for yl-rn-screenguard
Gathering detailed insights and metrics for yl-rn-screenguard
Gathering detailed insights and metrics for yl-rn-screenguard
A Native screenshot blocking library for React-Native developer, with background customizable after captured. Screenshot detector are also supported.
npm install yl-rn-screenguard
Typescript
Module System
Min. Node Version
Node Version
NPM Version
Java (33.3%)
Objective-C++ (24.41%)
TypeScript (24.22%)
JavaScript (13.82%)
Objective-C (2.96%)
Ruby (1.29%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
284 Stars
297 Commits
31 Forks
3 Watchers
23 Branches
6 Contributors
Updated on Jul 10, 2025
Latest Version
0.5.0
Package Id
yl-rn-screenguard@0.5.0
Unpacked Size
157.83 kB
Size
82.98 kB
File Count
41
NPM Version
9.5.1
Node Version
18.16.0
Published on
Feb 28, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
A Native library for blocking screenshot for react-native developer, with background color screenshot customizable.
This library is separated into 2 version: stable
and beta
versions for different purpose.
1$ npm install react-native-screenguard --save
1$ yarn add react-native-screenguard
Source code on master
branch.
registerWithBlurView
and registerWithImage
, install this version.1$ npm install react-native-screenguard@beta --save 2
1$ yarn add react-native-screenguard@beta
Note
: Remember to pod install
on ios and gradle build
on Android again to take effect.
Source code on beta
branch.
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
Open up 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
android/settings.gradle
:include ':react-native-screenguard'
project(':react-native-screenguard').projectDir = new File(rootProject.projectDir,'../node_modules/react-native-screenguard/android')
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/
(iOS + Android) : Activate the screenguard with your custom background color layout.
Android will receive the background color when app in background or inactive state.
1import ScreenGuardModule from 'react-native-screenguard'; 2 3ScreenGuardModule.register( 4 //insert any hex color you want here, default black if null or empty 5 '#0F9D58', 6);
iOS
Android
(iOS + Android) Activate without screenguard, if you just want to detect and receive event callback only.
Note:
This function is deprecated and will be removed from ver 0.4.0+
, consider using registerScreenshotEventListener or registerScreenRecordingEventListener instead.
1import ScreenGuardModule from 'react-native-screenguard'; 2 3ScreenGuardModule.registerWithoutScreenguard( 4 (_) => { 5 .....do anything you want after the screenshot 6});
1import ScreenGuardModule from 'react-native-screenguard'; 2 3ScreenGuardModule.registerScreenshotEventListener( 4 (_) => { 5 .....do anything you want after the screenshot 6});
1import ScreenGuardModule from 'react-native-screenguard'; 2 3ScreenGuardModule.registerScreenRecordingEventListener( 4 (_) => { 5 .....do anything you want after the screen record 6});
Beta version only. See how to install here
Activate screenguard with a blurred effect view after captured.
Blurview on Android using Blurry.
Accepted a JS object with following parameters:
radius
(required): blur radius value number in between [15, 50]
(Explain below) , throws warning if smaller than 15 or bigger than 50, exception if smaller than 1 or not a number.
timeAfterResume
(Android only): A small amount of time (in milliseconds) for the blur view to disappear before jumping back to the main application view, default 1000ms
1import ScreenGuardModule from 'react-native-screenguard'; 2 3const data = { 4 radius: 35, 5 timeAfterResume: 2000, 6}; 7 8//register with a blur radius of 35 9ScreenGuardModule.registerWithBlurView(data);
Explain
: Set blur radius smaller than 15 won't help much, as content still look very clear and easy to read. Same with bigger than 50 but content will be shrinked and vanished inside the view, blurring is meaningless. So, between 15 and 50 is enough.
iOS
Beta version only. See how to install here
Activate screenguard with a custom image view and background color.
ImageView using SDWebImage on iOS and Glide on Android for faster loading and caching.
Accepted a JS object with following parameters:
width
: width of the image
height
: height of the image
source
(required): uri from network image or from local project require
, accept all kinds of images (jpg|jpeg|png|gif|bmp|webp|svg), throws warning if uri is not an image uri;
defaultSource
: default source if network image uri failed to load, from local project require
, accept all kinds of images;
backgroundColor
: background color behind the image, just like register
.
timeAfterResume
(Android only): A small amount of time (in milliseconds) for the blur view to disappear before jumping back to the main view, default 1000ms
1import ScreenGuardModule from 'react-native-screenguard'; 2 3const data = { 4 height: 150, 5 width: 200, 6 source: { 7 uri: 'https://www.icegif.com/wp-content/uploads/2022/09/icegif-386.gif', 8 }, 9 defaultSource: require('./images/test.png'), 10 backgroundColor: color, 11 alignment: 5 // Alignment.centerRight 12}, 13//register with an image 14ScreenGuardModule.registerWithImage(data);
1import ScreenGuardModule from 'react-native-screenguard'; 2 3const dataRequire = { 4 height: 150, 5 width: 200, 6 source: require('./images/test.png'), 7 backgroundColor: color, 8}, 9ScreenGuardModule.registerWithImage(dataRequire);
Warning
: This feature is still in experimental on Android, so please use with caution as some unexpected behaviour might occurs.
iOS
Android
1ScreenGuardModule.unregister();
From v0.3.6
and above, callbacks will not be activated on all register functions. You may have to activate it yourself by using registerScreenshotEventListener or registerScreenRecordingEventListener instead.
This library support blocking screenshot for iOS 13+, Android 5+ only.
The protection filter is already activated until you call unregister
. So remember to call a function only ONCE for limitting errors and unexpected problems might happened during testing.
Lib does not support combine feature together. (For example you want to use registerWithBlurView
combine with register
to have a blur view with color behind,.....)
On Android, if you want to use callback, consider using registerScreenShotEventListener
instead, as you may 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
No vulnerabilities found.
No security vulnerabilities found.