Giter VIP home page Giter VIP logo

react-native-detector's Introduction

react-native-detector

a simply and easy to use screenshot detector for react native

Installation

yarn

yarn add react-native-detector

npm

npm install react-native-detector

iOS

cd ios && pod install

android

for Android you need to have access for READ_EXTERNAL_STORAGE to detect screenshots by user to do that you just need to add this line in AndroidManifest.xml

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

and get user permission

import { PermissionsAndroid } from 'react-native';

//...
const requestPermission = async () => {
  await PermissionsAndroid.request(
    PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE,
    {
      title: 'Get Read External Storage Access',
      message: 'get read external storage access for detecting screenshots',
      buttonNeutral: 'Ask Me Later',
      buttonNegative: 'Cancel',
      buttonPositive: 'OK',
    }
  );
};

Usage

import {
  addScreenshotListener,
  removeScreenshotListener,
} from 'react-native-detector';

// ...
React.useEffect(() => {
  const userDidScreenshot = () => {
    console.log('User took screenshot');
  };
  const unsubscribe = addScreenshotListener(userDidScreenshot);
  return () => {
    unsubscribe();
  };
}, []);

Roadmap

Status Goal
โœ… iOS version of screenshot detector
โœ… (Thanks to @mhssn95) Android version of screenshot detector
๐Ÿšง Screen recording detecting
๐Ÿšง Calls detector

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

react-native-detector's People

Contributors

azizak avatar retyui avatar psbdgr8 avatar sun-woo-kim avatar dependabot[bot] avatar aarontjdev avatar saeedzhiany avatar xavier-villelegier avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.