Web Analytics
Skip to main content

register

Activate the screenguard with your custom background color layout.

Parameters

Accepted a JS object with following parameters:

NameRequiredTypeDefault valueDescription
backgroundColorNostring'#000000'(BLACK)The background color you want to display
timeAfterResumeNonumber1000 (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+, except registerScreenshotEventListener and registerScreenRecordingEventListener, 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