Skip to content

Commit 963342c

Browse files
authored
解决RN0.42 安卓下报错闪退的问题,将es6-promisify替换为bluebird
1 parent 0e937e8 commit 963342c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { NativeAppEventEmitter, NativeModules } from 'react-native';
2-
import promisify from 'es6-promisify';
2+
// import promisify from 'es6-promisify';
3+
import Promise from 'bluebird'
34

45
const WeChatAPI = NativeModules.WeChatAPI;
56

@@ -57,7 +58,7 @@ function wrapCheckApi(nativeFunc) {
5758
return undefined;
5859
}
5960

60-
const promisified = promisify(nativeFunc, translateError);
61+
const promisified = Promise.promisify(nativeFunc, translateError);
6162
return (...args) => {
6263
return promisified(...args);
6364
};
@@ -71,7 +72,7 @@ function wrapApi(nativeFunc) {
7172
return undefined;
7273
}
7374

74-
const promisified = promisify(nativeFunc, translateError);
75+
const promisified = Promise.promisify(nativeFunc, translateError);
7576
return async function (...args) {
7677
if (!WeChatAPI.isAppRegistered) {
7778
throw new Error('注册应用失败');

0 commit comments

Comments
 (0)