ReactNative with application development, if within the application, want to call the applet sharing, it is also possible.
First you have to have a formal release of the micro-channel applet.
1.app and the associated applets
app call sharing applet, you need to WeChat open platform ( https://open.weixin.qq.com/ ), the applet App and associate
2. Use the react-native-wechat-lib library
react-native-wechat app library does not call the applet share related functions, the use of react-native-wechat-lib library
2.1 react-native-wechat-lib
npm following address
https://www.npmjs.com/package/react-native-wechat-lib
Configuration is very simple to install and nothing more than a link, you can refer to the official documentation.
I am here only to realize android terminal
2.2 on androidx question:
If your project does not support androidx, when installing run the following class will complain.
node_modules\react-native-wechat-lib\android\src\main\java\com\theweflex\react\WeChatModule
The error is the following sentence
import androidx.annotation.Nullable
It replaced the following sentence like
import android.support.annotation.Nullable;
2.3 RN-side implementation of the Share function calls applet
//1. 导入
import * as WeChat from 'react-native-wechat-lib'
//2. 注册
WeChat.registerApp('微信开放平台申请的appId','universalLink');
//3. 调用小程序的分享
WeChat.shareMiniProgram({
title: 'Mini program.', //标题
userName: 'gh_d39d10000000', //小程序的原始ID
webpageUrl: 'https://google.com/show.html', //兼容低版本的网页链接,
thumbImageUrl: 'https://google.com/1.jpg', //缩略图
scene: 0
})
View detailed api official document can be.