0.1.0 • Published 1 year ago

react-native-wechat-5e v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

react-native-wechat-5e

React Native 微信登录插件api

Installation

npm install react-native-wechat-5e
yarn add react-native-wechat-5e

Usage

import {wxApi} from 'react-native-wechat-5e'

// ...
useEffect(async () => {
  // 注册
  wxApi.registerApp('wx_app_id')

  // 判断微信app是否安装
  const isInstall = await wxApi?.isWXAppInstalled()

  // 唤醒登录页面
  const userInfo = await wxApi?.sendAuthRequest('snsapi_userinfo', 'wechat_sdk_demo_test')
}, [])

同时android/app/src/.../AndroidManifest.xml 需要进行修改

<manifest ...>

  <!-- 微信 -->
  <queries>
    <package android:name="com.tencent.mm" />
  </queries>

  ...

  <activity
      android:name=".wxapi.WXEntryActivity"
      android:label="@string/app_name"
      android:exported="true"
      android:launchMode="singleTask"
      android:taskAffinity="com.wechat5eexample" // 替换成你的包名
  />
</manifest>

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library