From 8e0e70d5c2b94eec8e35305f507727fdf1178419 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E5=BF=97=E9=B9=8F?= <10284872+wedatahub@user.noreply.gitee.com> Date: Wed, 30 Oct 2024 10:43:21 +0800 Subject: [PATCH 1/2] =?UTF-8?q?docs:=20[#IB0PYZ]=20react-native-svg=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BB=84=E4=BB=B6=E7=99=BD=E5=90=8D=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- en/react-native-svg.md | 11 +++++++++++ zh-cn/react-native-svg.md | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/en/react-native-svg.md b/en/react-native-svg.md index 0db05f3f..06ff47ea 100644 --- a/en/react-native-svg.md +++ b/en/react-native-svg.md @@ -194,6 +194,17 @@ function buildCustomComponent(ctx: ComponentBuilderContext) { ... ``` +> [!TIP] 本库使用了混合方案,需要添加组件名。 + +在`entry/src/main/ets/pages/index.ets` 或 `entry/src/main/ets/rn/LoadBundle.ets` 找到常量 `arkTsComponentNames` 在其数组里添加组件名 + +```diff +const arkTsComponentNames: Array = [ + ... ++ SVG_VIEW_TYPE_NAME + ]; +``` + ### 5.运行 点击右上角的 `sync` 按钮 diff --git a/zh-cn/react-native-svg.md b/zh-cn/react-native-svg.md index 0db05f3f..06ff47ea 100644 --- a/zh-cn/react-native-svg.md +++ b/zh-cn/react-native-svg.md @@ -194,6 +194,17 @@ function buildCustomComponent(ctx: ComponentBuilderContext) { ... ``` +> [!TIP] 本库使用了混合方案,需要添加组件名。 + +在`entry/src/main/ets/pages/index.ets` 或 `entry/src/main/ets/rn/LoadBundle.ets` 找到常量 `arkTsComponentNames` 在其数组里添加组件名 + +```diff +const arkTsComponentNames: Array = [ + ... ++ SVG_VIEW_TYPE_NAME + ]; +``` + ### 5.运行 点击右上角的 `sync` 按钮 -- Gitee From e85fcd71d931d49c4a940a70dde64ba1fcc588d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E5=BF=97=E9=B9=8F?= <10284872+wedatahub@user.noreply.gitee.com> Date: Wed, 30 Oct 2024 12:09:52 +0800 Subject: [PATCH 2/2] =?UTF-8?q?docs:=20[#IAZZF9]=20=E6=B7=BB=E5=8A=A0=20re?= =?UTF-8?q?act-native-wechat-lib=20=E4=BD=BF=E7=94=A8=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- en/react-native-wechat-lib.md | 360 +++++++++++++++++++++++++++++++ zh-cn/react-native-wechat-lib.md | 360 +++++++++++++++++++++++++++++++ 2 files changed, 720 insertions(+) create mode 100644 en/react-native-wechat-lib.md create mode 100644 zh-cn/react-native-wechat-lib.md diff --git a/en/react-native-wechat-lib.md b/en/react-native-wechat-lib.md new file mode 100644 index 00000000..bdbad312 --- /dev/null +++ b/en/react-native-wechat-lib.md @@ -0,0 +1,360 @@ +> 模板版本:v0.2.2 + +

+

react-native-wechat-lib

+

+

+ + Supported platforms + + + License + + +

+ +> [!TIP] [Github 地址](https://github.com/react-native-oh-library/react-native-wechat-lib) + +## 安装与使用 + +请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-wechat-lib Releases](https://github.com/react-native-oh-library/react-native-wechat-lib/releases)。 + +进入到工程目录并输入以下命令: + + + +#### **npm** + +```bash +npm install @react-native-oh-tpl/react-native-wechat-lib +``` + +#### **yarn** + +```bash +yarn add @react-native-oh-tpl/react-native-wechat-lib +``` + + + +下面的代码展示了这个库的基本使用场景: + +> [!WARNING] 使用时 import 的库名不变。 + +> [tips] 下面 demo 在使用的过程中,请将 AppID 改为在[微信开放平台申请鸿蒙应用]([接入指南 / 鸿蒙接入指南 (qq.com)](https://developers.weixin.qq.com/doc/oplatform/Mobile_App/Access_Guide/ohos.html))的 AppID + +```js +import * as React from 'react'; + +import { StyleSheet, View, Text, Button, Alert } from 'react-native'; +import { getApiVersion, registerApp, openWXApp, sendAuthRequest, shareText } from 'react-native-wechat-lib'; + +export default function App() { + const [versionNumber, setVersionNumber] = React.useState(); + + React.useEffect(() => { + registerApp('AppID', 'universalLink').then((res) => { + console.log("registerApp: " + res) + getApiVersion().then((num) => { + console.log("test: " + num) + setVersionNumber(num) + // openWXApp().then() + }) + }); + + }, []); + + function onLogin() { + sendAuthRequest('snsapi_userinfo', '') + .then((response: any) => { + // todo 登录 response.code + Alert.alert('登录成功,code: ' + response.code) + }) + .catch(error => { + console.log(error) + let errorCode = Number(error.code); + if (errorCode === -2) { + Alert.alert('已取消授权登录') + } else { + Alert.alert('微信授权登录失败') + } + }); + + } + + function onShareText() { + shareText({ + text: 'test content.', + scene: 0 + }).then() + } + + return ( + + Call wechat SDK demo + + Version: {versionNumber} + + + +