Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ react-native link
```

#### 手动link~(如果不能够自动link)
#####ios
##### ios
a.打开XCode's工程中, 右键点击Libraries文件夹 ➜ Add Files to <...>
b.去node_modules ➜ react-native-weibo ➜ ios ➜ 选择 RCTWeiboAPI.xcodeproj
c.在工程Build Phases ➜ Link Binary With Libraries中添加libRCTWeiboAPI.a

#####Android
##### Android

```
// file: android/settings.gradle
Expand Down Expand Up @@ -76,11 +76,14 @@ public class MainApplication extends Application implements ReactApplication {
#### ios配置
将`node_modules/react-native-weibo/ios/libWeiboSDK/WeiboSDK.bundle`加入到工程中(必须,很重要,不然登录的时候会crash)

在Build Phases ➜ Copy Bundle Resources ➜ Add Other... libWeiboSDK/WeiboSDK.bundle

在工程target的`Build Phases->Link Binary with Libraries`中加入`libRCTWeiboAPI.a、libsqlite3.tbd、libz.tbd、ImageIO.framework、SystemConfiguration.framework、Security.framework、CoreTelephony.framework、CoreText.framework`


在`Info->URL Types` 中增加QQ的scheme: `Identifier` 设置为`sina`, `URL Schemes` 设置为你注册的微博开发者账号中的APPID,需要加前缀`wb`,例如`wb1915346979`


在你工程的`AppDelegate.m`文件中添加如下代码:

```
Expand Down
9 changes: 8 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/

import {NativeModules, NativeAppEventEmitter} from 'react-native';
import promisify from 'es6-promisify';

const {WeiboAPI} = NativeModules;

Expand Down Expand Up @@ -33,6 +32,14 @@ function wrapApi(nativeFunc) {
};
}

function promisify(fn, handler) {
return function (...args) {
return new Promise(function (resolve, reject) {
fn(...args, handler.bind({ resolve, reject }))
})
}
}

// Save callback and wait for future event.
let savedCallback = undefined;
function waitForResponse(type) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
},
"homepage": "https://github.com/reactnativecn/react-native-weibo#readme",
"dependencies": {
"es6-promisify": "^3.0.0"

}
}