registerWithBlurView
Activate screenguard with a blurred effect view after captured.
Blurview on Android using Blurry.
Parameters
Accepted a JS object with following parameters:
Name | Required | Type | Default value | Description |
---|---|---|---|---|
radius | Yes | number | blur radius value number in between [15, 50] , throws warning if smaller than 15 or bigger than 50, exception if smaller than 1 or not a number. | |
timeAfterResume | No | number | 1000 (in millis) | (Android only) A small amount of time (in milliseconds) for the view to disappear before jumping back to the main application view. |
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.
Example code
import ScreenGuardModule from 'react-native-screenguard';
const data = {
radius: 35,
timeAfterResume: 2000,
};
ScreenGuardModule.registerWithBlurView(data);
New architecture (v1.0.8+)
- Starting from
v1.0.8+
, exceptregisterScreenshotEventListener
andregisterScreenRecordingEventListener
, all APIs have been upgraded to Promise. So you must use it asynchronously in your project.
ScreenGuardModule.registerWithBlurView(data).then((_) => {console.log()})
or
await ScreenGuardModule.registerWithBlurView(data);
Demo
iOS
Android