registerWithBlurView
Activate screenguard with a blurred effect view after captured.
Blurview on Android using Blurry.
You must call initSettings() before using this function.
Parameters
Accepted a JS object with following parameters:
| Name | Required | Type | Default value | Description |
|---|---|---|---|---|
| radius | Yes | number | Blur radius value in range [15, 50]. Throws warning if < 15 or > 50, exception if < 1 or NaN | |
⚠️ Removed in v2.0.0 - Use initSettings() instead |
v2.0.0 Migration: In v1.x,
timeAfterResumewas passed directly toregisterWithBlurView(). Starting from v2.0.0, set it ininitSettings()instead.
Set blur radius smaller than 15 won't help much, as content still looks very clear and easy to read. Same with bigger than 50 but content will be shrunk and vanished inside the view, blurring is meaningless. So, between 15 and 50 is recommended.
Example code
import ScreenGuardModule from 'react-native-screenguard';
// Initialize first (required in v2.0.0+)
await ScreenGuardModule.initSettings({
displayScreenGuardOverlay: true,
timeAfterResume: 2000,
});
// Activate with blur effect
await ScreenGuardModule.registerWithBlurView({
radius: 35,
});
On Android, if displayScreenguardOverlayAndroid is set to false in initSettings(), calling registerWithBlurView() will automatically switch to registerWithoutEffect() and show a warning.