react-native-screenshot-lock
v1.0.3
Published
ReactNative Screenshot Lock/UnLock
Downloads
15
Readme
react-native-screenshot-lock
Getting started
$ npm install react-native-screenshot-lock --save
ReactNative >= 0.60.0
$ pod install
Android Manual
- Append the following lines to
android/settings.gradle
include ':react-native-screenshot-lock'
project(':react-native-screenshot-lock').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-screenshot-lock/android')
- Insert the following lines inside the dependencies block in
andorid/app/build.gradle
implementation project(':react-native-screenshot-lock')
Ios Manual
- Update the AppDelegate.m file to include the following
#import <ScreenshotLock.h>
.....
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
ScreenshotLock* screenshotLock = [[ScreenshotLock alloc] init];
[screenshotLock setupAndListen:rootView.bridge];
}
Usage 1
import { useEffect } from "react";
import {register, unregister} from 'react-native-screenshot-lock';
// ios Callback / android X
export default () => {
useEffect(() => {
// param callback
// register : screenshotLock, unregister: screenshotUnLock
register(() => {});
return () => unregister();
}, []);
}
Usage 2
import React from "react";
import { Text, View } from "react-native";
import useLockScreenShot from 'react-native-screenshot-lock';
import { useEffect } from "react";
export default () => {
useLockScreenShot();
return (
<View>
<Text>React-Native-Screenshot-lock</Text>
</View>
);
}