From 9b82c7ceb3f6e05e9437d51d01f11c6c5dcba9b1 Mon Sep 17 00:00:00 2001 From: zourenjie Date: Fri, 23 Feb 2024 11:11:08 +0800 Subject: [PATCH] =?UTF-8?q?[Issues:=20#I92TUK]=20=E6=B7=BB=E5=8A=A0permiss?= =?UTF-8?q?ions=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 --- 1224/react-native-permissions.md | 319 +++++++++++++++++++++++++++++++ 1 file changed, 319 insertions(+) create mode 100644 1224/react-native-permissions.md diff --git a/1224/react-native-permissions.md b/1224/react-native-permissions.md new file mode 100644 index 00000000..33a0aae2 --- /dev/null +++ b/1224/react-native-permissions.md @@ -0,0 +1,319 @@ +> 模板版本:v0.1.3 + +

+

react-native-permissions

+

+

+ + Supported platforms + + + License + +

+ + +> [!tip] [Github 地址](https://github.com/react-native-oh-library/react-native-permissions) + +## 安装与使用 + +请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-permissions Releases](https://github.com/react-native-oh-library/react-native-permissions/releases),并下载适用版本的 tgz 包。 + +进入到工程目录并输入以下命令: + + + +#### **npm** + +```bash +npm install @react-native-oh-tpl/react-native-permissions@file:# +``` + +#### **yarn** + +```bash +yarn add @react-native-oh-tpl/react-native-permissions@file:# +``` + + + +下面的代码展示了这个库的基本使用场景: + +>[!WARNING] 使用时 import 的库名不变。 + +```js +import { ScrollView, StyleSheet, View, Text, Button } from 'react-native'; +import React from 'react'; +import RTNPermissions, { Permission } from 'react-native-permissions'; + +const permissionNormal: Permission[] = [ + 'ohos.permission.APPROXIMATELY_LOCATION', + 'ohos.permission.CAMERA', + 'ohos.permission.MICROPHONE', + 'ohos.permission.READ_CALENDAR', + 'ohos.permission.WRITE_CALENDAR', + 'ohos.permission.ACTIVITY_MOTION', + 'ohos.permission.READ_HEALTH_DATA', + 'ohos.permission.DISTRIBUTED_DATASYNC', + 'ohos.permission.READ_MEDIA', + 'ohos.permission.MEDIA_LOCATION', + 'ohos.permission.ACCESS_BLUETOOTH', +] + +export function PermissionsExample() { + return ( + +