From e81facc325d275e57d09eee96a5151cd62829fe3 Mon Sep 17 00:00:00 2001 From: Li-2199 <1269001954@qq.com> Date: Thu, 11 Jul 2024 17:28:32 +0800 Subject: [PATCH 1/2] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0react-native-geol?= =?UTF-8?q?ocation=E6=96=87=E6=A1=A3=E6=A8=A1=E6=9D=BF=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E4=B8=BA0.2.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zh-cn/react-native-geolocation.md | 108 +++++++++++++++++++----------- 1 file changed, 68 insertions(+), 40 deletions(-) diff --git a/zh-cn/react-native-geolocation.md b/zh-cn/react-native-geolocation.md index 5fd52977..adf76c97 100644 --- a/zh-cn/react-native-geolocation.md +++ b/zh-cn/react-native-geolocation.md @@ -1,23 +1,24 @@ -> 模板版本:v0.1.2 + +> 模板版本:v0.2.2

-

react-native-geolocation

+

@react-native-community/geolocation

Supported platforms - + License

-> [!tip] [Github 地址](https://github.com/react-native-oh-library/react-native-geolocation/tree/sig) +> [!TIP] [Github 地址](https://github.com/react-native-oh-library/react-native-geolocation/tree/sig) ## 安装与使用 -请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-geolocation Releases](https://github.com/react-native-oh-library/react-native-geolocation/releases),并下载适用版本的 tgz 包。 +请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/geolocation Releases](https://github.com/react-native-oh-library/react-native-geolocation/releases),并下载适用版本的 tgz 包。 进入到工程目录并输入以下命令: @@ -28,13 +29,13 @@ #### **npm** ```bash -npm install @react-native-oh-tpl/react-native-geolocation@file:# +npm install @react-native-oh-tpl/geolocation@file:# ``` #### **yarn** ```bash -yarn add @react-native-oh-tpl/react-native-geolocation@file:# +yarn add @react-native-oh-tpl/geolocation@file:# ``` @@ -44,15 +45,22 @@ yarn add @react-native-oh-tpl/react-native-geolocation@file:# > [!WARNING] 使用时 import 的库名不变。 ```js -// setRNConfiguration 为例 -Geolocation.setRNConfiguration( - config: { - skipPermissionRequests: boolean; - authorizationLevel?: 'always' | 'whenInUse' | 'auto'; - enableBackgroundLocationUpdates?: boolean; - locationProvider?: 'playServices' | 'android' | 'auto'; - } -) => void +import Geolocation from "@react-native-community/geolocation"; +import { Button } from "react-native"; + +export function GeolocationDemo(): JSX.Element { + const tap = () => { + Geolocation.setRNConfiguration({ + skipPermissionRequests: true, + authorizationLevel: "auto", + enableBackgroundLocationUpdates: true, + locationProvider: "auto", + }); + console.log("tap"); + }; + + return