From 2d340f14f1e6dd7c91466543c19d4ac53ece31d5 Mon Sep 17 00:00:00 2001 From: xinbingchao <10921250+xinbingchao@user.noreply.gitee.com> Date: Wed, 21 Jan 2026 10:44:33 +0800 Subject: [PATCH 01/14] =?UTF-8?q?docs:=20=E6=96=B0=E5=A2=9Elottie-turbo-re?= =?UTF-8?q?act-native=E6=8C=87=E5=AF=BC=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- en/react-native-screen-capture.md | 371 +++++++++++++++++++++++++++ zh-cn/react-native-screen-capture.md | 356 +++++++++++++++++++++++++ 2 files changed, 727 insertions(+) create mode 100644 en/react-native-screen-capture.md create mode 100644 zh-cn/react-native-screen-capture.md diff --git a/en/react-native-screen-capture.md b/en/react-native-screen-capture.md new file mode 100644 index 00000000..f3deae64 --- /dev/null +++ b/en/react-native-screen-capture.md @@ -0,0 +1,371 @@ +> Template version: v0.2.2 + +

+

react-native-screen-capture

+

+

+ + Supported platforms + + + License + +

+ +> [!TIP] [GitHub address](https://github.com/react-native-oh-library/react-native-screen-capture) + +## Installation and Usage + +Please refer to the Releases page of the third-party library for the corresponding version information + +| Version | Release Information |Supported RN Version | +|-----------------------------------|--------------------------------------------| -------------------- | +| <= 4.4.1-0.0.3@deprecated | [@react-native-oh-tpl/react-native-screen-capture Releases(deprecated)](https://github.com/react-native-oh-library/react-native-screen-capture/releases) | 0.72 | +| 4.4.2 | [@react-native-ohos/react-native-screen-capture Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-screen-capture/releases) | 0.72 | +| 4.5.0 | [@react-native-ohos/react-native-screen-capture Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-screen-capture/releases) | 0.77 | + +For older versions not published on npm, please refer to the [Installation Guide](/en/tgz-usage-en.md) to install the tgz package. + +Go to the project directory and execute the following instruction: + + + + +#### **npm** + +```bash +npm install @react-native-ohos/react-native-screen-capture +``` + +#### **yarn** + +```bash +yarn add @react-native-ohos/react-native-screen-capture +``` + + + + +The following code shows the basic use scenario of the repository: + +> [!WARNING] The name of the imported repository remains unchanged. + +```js +import React, { Component, useState } from 'react'; +import { Alert, View, Button, Text } from 'react-native'; +import {disallowScreenshot,keepAwake} from 'react-native-screen-capture'; + +class AppDemo extends React.Component { + state = { + isVisible: true, + screenOn: false, // false 表示允许截屏,true 表示禁止截屏 + }; + + handleDisallowScreenshot = () => { + // 切换状态:如果当前是 false(允许截屏),点击后变为 true(禁止截屏) + const newState = !this.state.screenOn; + this.setState({ screenOn: newState }); + disallowScreenshot(newState); + console.log('Disallow Screenshot state:', newState); + }; + + handleKeepAwake = () => { + const newState = !this.state.isVisible; + this.setState({ isVisible: newState }); + keepAwake(newState); + console.log('Keep Awake state:', newState); + }; + + render() { + return ( + + + 防截屏状态: {this.state.screenOn ? '已禁止' : '已允许'} + +