{"id":15293968,"url":"https://github.com/huextrat/react-native-screenshot-aware","last_synced_at":"2026-02-12T02:22:22.287Z","repository":{"id":257773988,"uuid":"859374687","full_name":"huextrat/react-native-screenshot-aware","owner":"huextrat","description":"React Native module for real-time screenshot detection on Android and iOS","archived":false,"fork":false,"pushed_at":"2025-05-15T07:34:15.000Z","size":6138,"stargazers_count":175,"open_issues_count":4,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-16T08:02:10.804Z","etag":null,"topics":["android","ios","react-native","screenshot"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/react-native-screenshot-aware","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/huextrat.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["huextrat"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":null,"custom":null}},"created_at":"2024-09-18T14:55:44.000Z","updated_at":"2025-05-16T07:11:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"9a732082-0ba6-415f-982f-c6d1288b281c","html_url":"https://github.com/huextrat/react-native-screenshot-aware","commit_stats":{"total_commits":66,"total_committers":3,"mean_commits":22.0,"dds":"0.33333333333333337","last_synced_commit":"f6a52deadddf33ba29753b8b14d0e620277334a5"},"previous_names":["huextrat/react-native-screenshot-aware"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huextrat%2Freact-native-screenshot-aware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huextrat%2Freact-native-screenshot-aware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huextrat%2Freact-native-screenshot-aware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huextrat%2Freact-native-screenshot-aware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/huextrat","download_url":"https://codeload.github.com/huextrat/react-native-screenshot-aware/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254493381,"owners_count":22080126,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","ios","react-native","screenshot"],"created_at":"2024-09-30T16:54:29.906Z","updated_at":"2026-02-12T02:22:22.280Z","avatar_url":"https://github.com/huextrat.png","language":"TypeScript","funding_links":["https://github.com/sponsors/huextrat"],"categories":["Mobile"],"sub_categories":["React Native \u0026 Expo"],"readme":"# React Native Screenshot Aware\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/react-native-screenshot-aware\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/react-native-screenshot-aware.svg?style=flat-square\" alt=\"npm version\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/react-native-screenshot-aware\"\u003e\u003cimg src=\"https://img.shields.io/npm/dm/react-native-screenshot-aware.svg?style=flat-square\" alt=\"npm downloads\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/huextrat/react-native-screenshot-aware/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/npm/l/react-native-screenshot-aware.svg?style=flat-square\" alt=\"license\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch3 align=\"center\"\u003e\n  Real-time screenshot detection for React Native apps\n\u003c/h3\u003e\n\n## Features\n\n- 🚀 Real-time screenshot detection\n- 🔄 Cross-platform support (iOS \u0026 Android)\n- 🎣 Easy-to-use React hooks\n- ⚡ Optimized for performance\n- 📱 Supports Android 14+ (API level 34+) and iOS 14+\n- 🏗️ Supports the new architecture for React Native\n\n\n## Compatibility\n\n- React Native \u003c0.76, use version 1.2.2 or below 1.2.0 of this package (1.2.1 is buggy)\n- React Native \u003e=0.76, use version 1.3.0 or later\n- React Native \u003e=0.79, use version 1.3.10 or later\n\n## Installation\n\n```sh\nyarn add react-native-screenshot-aware\n```\nor\n```sh\nnpm install react-native-screenshot-aware\n```\n\n## Important Notes\n\n### Android\n- Supports Android 14+ (API level 34 and above)\n- Utilizes the latest Android API for efficient screenshot detection\n- Leverages the new `DETECT_SCREEN_CAPTURE` permission introduced in Android 14\n- Provides a more privacy-friendly and performant approach to screenshot detection\n\n## Expo\n\nFor Expo projects, you can use the Expo plugin in `app.json`\n\n```json\n\"plugins\": [\n  \"react-native-screenshot-aware\"\n],\n```\n\nor add the permission manually to your `app.json`:\n\n```json\n\"android\": {\n  \"permissions\": [\"android.permission.DETECT_SCREEN_CAPTURE\"]\n}\n```\n\n## Bare RN\n\n### Permissions\n\nTo use the screenshot detection feature on Android, you need to add the following permission to your `AndroidManifest.xml` file:\n\n```xml\n\u003cuses-permission android:name=\"android.permission.DETECT_SCREEN_CAPTURE\" /\u003e\n```\n\n\u003e **Note**: Callbacks will never be triggered on devices running Android versions below 14. This is due to the reliance on the new `DETECT_SCREEN_CAPTURE` permission and APIs introduced in Android 14, which are not available in earlier versions.\n\n\u003e **Note**: The decision to support only Android 14+ is based on the introduction of new, dedicated screenshot detection APIs. These APIs offer improved performance and respect user privacy better than previous methods. For more details, see the [Android 14 screenshot detection documentation](https://developer.android.com/about/versions/14/features/screenshot-detection).\n\n## API Reference\n\n### `useScreenshotAware(callback)`\n\nThis hook allows you to detect when a screenshot is taken on the device. It takes a callback function as an argument, which will be executed whenever a screenshot event is detected.\n\n#### Parameters\n\n- `callback` (function): A function to be called when a screenshot is detected. This function does not take any arguments.\n\n#### Example\n\n```javascript\nimport { useScreenshotAware } from 'react-native-screenshot-aware';\n\nuseScreenshotAware(() =\u003e {\n  console.log('A screenshot was taken!');\n});\n```\n\n### `addListener(callback)`\n\nThis function allows you to add a listener for the screenshot event. It takes a callback function as an argument, which will be executed whenever a screenshot event is detected.\n\n#### Parameters\n\n- `callback` (function): A function to be called when a screenshot is detected. This function does not take any arguments.\n\n#### Example\n\n```javascript\nimport ScreenshotAware from 'react-native-screenshot-aware';\n\nuseEffect(() =\u003e {\n  const listener = ScreenshotAware.addListener(() =\u003e {\n    console.log('A screenshot was taken!');\n  });\n  return () =\u003e {\n    listener.remove();\n  }\n}, [])\n```\n\n### `removeAllListeners()`\n\nThis function allows you to remove all listeners for the screenshot event.\n\n#### Example\n\n```javascript\nimport ScreenshotAware from 'react-native-screenshot-aware';\n\nfunction removeScreenshotListeners() {\n  ScreenshotAware.removeAllListeners();\n}\n```\n\n## Jest Mocks\n\n```javascript\njest.mock('react-native-screenshot-aware', () =\u003e ({\n  useScreenshotAware: jest.fn(),\n  addListener: jest.fn().mockReturnValue({\n    remove: jest.fn(),\n  }),\n  removeAllListeners: jest.fn(),\n}));\n```\n\n## Contributing\n\nWe welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for more details.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Support\n\nIf you like this project, please consider supporting it by giving it a ⭐️ on GitHub!\n\n## Acknowledgements\n\n- [create-react-native-library](https://github.com/callstack/react-native-builder-bob) for the initial project setup","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuextrat%2Freact-native-screenshot-aware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhuextrat%2Freact-native-screenshot-aware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuextrat%2Freact-native-screenshot-aware/lists"}