register
Activate the screenguard with your custom background color layout.
Parameters
Accepted a JS object with following parameters:
Name | Required | Type | Default value | Description |
---|---|---|---|---|
backgroundColor | No | string | '#000000'(BLACK) | The background color you want to display |
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. |
Example code
import ScreenGuardModule from 'react-native-screenguard';
ScreenGuardModule.register(
{
backgroundColor: '#0F9D58',
timeAfterResume: 2000,
},
);
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.register(data).then((_) => {console.log()})
or
await ScreenGuardModule.register(data);
Demo
iOS
Android