react-native-screenshot-lock

1.0.3 • Public • Published

react-native-screenshot-lock

Getting started

$ npm install react-native-screenshot-lock --save

ReactNative >= 0.60.0 $ pod install

Android Manual

  1. 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')
  1. Insert the following lines inside the dependencies block in andorid/app/build.gradle
implementation project(':react-native-screenshot-lock')

Ios Manual

  1. 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>
    );
}

Readme

Keywords

Package Sidebar

Install

npm i react-native-screenshot-lock

Weekly Downloads

1

Version

1.0.3

License

MIT

Unpacked Size

291 kB

Total Files

80

Last publish

Collaborators

  • devrappers