Skip to content

detect system screenshot events and get the image uri by react native

Notifications You must be signed in to change notification settings

krmao/react-native-screenshot-url

 
 

Repository files navigation

react-native-screenshot-url

npm version

Install

yarn add react-native-screenshot-url

Usage

import ScreenShotUtil, { CallbackInfo } from 'react-native-screenshot-url';

useEffect(() => {
    ScreenShotUtil.startListener((res: CallbackInfo) => {
        // android 权限请求后置 & 内置
        // ios 无需权限
        console.log('- startScreenShot uri=' + res.uri);
    }, '截屏,screen');

    return () => {
        ScreenShotUtil.stopListener();
    };
});

Features

  • support 22 - 32 permissions about images READ_EXTERNAL_STORAGE
  • support Android API level 33 permissions about images READ_MEDIA_IMAGES
  • startListener without permission
  • permission request is built-in before callback

Reference

About

detect system screenshot events and get the image uri by react native

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 54.8%
  • Objective-C 35.4%
  • JavaScript 8.8%
  • Ruby 1.0%