🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

react-native-capture-protection

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-capture-protection

🛡️ A React Native library to prevent and detect for screen capture, screenshots and app switcher for enhanced security. Fully compatible with both Expo and CLI.

2.0.7
Source
npm
Version published
Weekly downloads
1.8K
1.76%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-capture-protection

🛡️ A React Native library to prevent screen capture, screenshots and app switcher for enhanced security. Fully compatible with both Expo and CLI.

screenshotapp switcher
Simulator Screen RecordingSimulator Screen Recording - iPhone 15 Pro - 2024-07-02 at 21 19 17

Features

  • iOS Capture Protection (Screenshot, Screen Recording, App Switcher)
  • Android Capture Protection (Screenshot, Screen Recording)
  • Event Listener for Capture Events
  • Provider and Hooks Support
  • Android 14 Support

Installation

Use npm

npm install react-native-capture-protection

Use yarn

yarn add react-native-capture-protection

use Expo

Only Expo Dev client compatible This library has native code, so it's not work for Expo Go but it's compatible with custom dev client.

npx expo install react-native-capture-protection

How to Use

import {
  CaptureProtection,
  useCaptureProtection,
  CaptureEventType
} from 'react-native-capture-protection';

const Component = () => {
  const { protectionStatus, status } = useCaptureProtection();

  React.useEffect(() => {
    // Prevent all capture events
    CaptureProtection.prevent();

    // Or prevent specific events
    CaptureProtection.prevent({
      screenshot: true,
      record: true,
      appSwitcher: true
    });
  }, []);

  React.useEffect(() => {
    // Check if any capture is prevented
    console.log('Prevent Status:', protectionStatus);

    // Check current protection status
    console.log('Protection Status:', status);
  }, [protectionStatus, status]);

  // Allow all capture events
  const onAllow = async () => {
    await CaptureProtection.allow();
  };

  // Allow specific events
  const onAllowSpecific = async () => {
    await CaptureProtection.allow({
      screenshot: true,
      record: false,
      appSwitcher: true
    });
  };

  // Check if screen is being recorded
  const checkRecording = async () => {
    const isRecording = await CaptureProtection.isScreenRecording();
    console.log('Is Recording:', isRecording);
  };

  return (
    // Your component JSX
  );
};

Documentation

  • Methods - Detailed documentation of all available methods
  • Types - Type definitions and interfaces
  • Migration Guide - Guide for migrating from v1.x to v2.x

Contributing

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

License

MIT

Made with create-react-native-library

Keywords

react-native

FAQs

Package last updated on 13 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts