mirror of
https://github.com/little-snow-fox/react-native-wechat-lib.git
synced 2025-12-06 15:26:49 +08:00
fix:android/ios registerApp of null & update README.md
This commit is contained in:
parent
629cb18cbd
commit
84000a32b6
@ -1,7 +1,7 @@
|
|||||||
<img height="200" src="./image/weixin.png?raw=true">
|
<img height="200" src="./image/weixin.png?raw=true">
|
||||||
|
|
||||||
# React-Native-Wechat-Lib
|
# React-Native-Wechat-Lib
|
||||||

|

|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
目前最新代码版本为 3.0.x,但 NPM Last 版本暂时只到 1.1.26,因为 **3.0.x 暂时还处于开发阶段**,有小部分功能**未经过测试**。
|
目前最新代码版本为 3.0.x,但 NPM Last 版本暂时只到 1.1.26,因为 **3.0.x 暂时还处于开发阶段**,有小部分功能**未经过测试**。
|
||||||
|
|
||||||
如果你需要使用 3.0.x 版本,请在 package.json 中加上版本号 react-native-wechat-lib@3.0.4,切换前请你清楚了解该版本的风险,该版本为开发版。
|
如果你需要使用 3.0.x 版本,请在 package.json 中加上版本号 **react-native-wechat-lib@3.0.4**,切换前请你清楚了解该版本的风险,该版本为开发版。
|
||||||
|
|
||||||
我会尽快推出 3.0.x 发行版。
|
我会尽快推出 3.0.x 发行版。
|
||||||
|
|
||||||
@ -62,6 +62,9 @@
|
|||||||
NPM 安装
|
NPM 安装
|
||||||
```sh
|
```sh
|
||||||
npm install react-native-wechat-lib --save
|
npm install react-native-wechat-lib --save
|
||||||
|
# 3.0.x 使用3.0.4
|
||||||
|
npm install react-native-wechat-lib@3.0.4 --save
|
||||||
|
|
||||||
# 3.0.0 开始弃用
|
# 3.0.0 开始弃用
|
||||||
react-native link react-native-wechat-lib
|
react-native link react-native-wechat-lib
|
||||||
```
|
```
|
||||||
|
|||||||
@ -120,7 +120,7 @@ public class WeChatLibModule extends ReactContextBaseJavaModule implements IWXAP
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "RCTWeChat";
|
return "WeChat";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
#define RCTWXEventName @"WeChat_Resp"
|
#define RCTWXEventName @"WeChat_Resp"
|
||||||
#define RCTWXEventNameWeChatReq @"WeChat_Req"
|
#define RCTWXEventNameWeChatReq @"WeChat_Req"
|
||||||
|
|
||||||
@interface WechatLib : NSObject <RCTBridgeModule, WXApiDelegate>
|
@interface WeChat : NSObject <RCTBridgeModule, WXApiDelegate>
|
||||||
|
|
||||||
@property NSString* appId;
|
@property NSString* appId;
|
||||||
|
|
||||||
|
|||||||
@ -8,12 +8,12 @@
|
|||||||
#import "WechatAuthSDK.h"
|
#import "WechatAuthSDK.h"
|
||||||
|
|
||||||
|
|
||||||
@interface WechatLib () <WechatAuthAPIDelegate>
|
@interface WeChat () <WechatAuthAPIDelegate>
|
||||||
@property (nonatomic, strong) WechatAuthSDK *authSDK;
|
@property (nonatomic, strong) WechatAuthSDK *authSDK;
|
||||||
@property (nonatomic, strong) RCTResponseSenderBlock scanCallback;
|
@property (nonatomic, strong) RCTResponseSenderBlock scanCallback;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation WechatLib
|
@implementation WeChat
|
||||||
|
|
||||||
// Define error messages
|
// Define error messages
|
||||||
#define NOT_REGISTERED (@"registerApp required.")
|
#define NOT_REGISTERED (@"registerApp required.")
|
||||||
|
|||||||
@ -5,11 +5,7 @@ import { sha1 } from 'js-sha1';
|
|||||||
import { DeviceEventEmitter, NativeEventEmitter, NativeModules, Platform } from 'react-native';
|
import { DeviceEventEmitter, NativeEventEmitter, NativeModules, Platform } from 'react-native';
|
||||||
|
|
||||||
let isAppRegistered = false;
|
let isAppRegistered = false;
|
||||||
let { WeChat, WechatLib } = NativeModules;
|
let { WeChat } = NativeModules;
|
||||||
|
|
||||||
if (WeChat == null) {
|
|
||||||
WeChat = WechatLib;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Event emitter to dispatch request and response from WeChat.
|
// Event emitter to dispatch request and response from WeChat.
|
||||||
const emitter = new EventEmitter();
|
const emitter = new EventEmitter();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user