Skip to content

Commit 97aa7ae

Browse files
modified: README.md
1 parent e3bd00c commit 97aa7ae

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

README.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# react-native-network-info
2+
3+
React Native library for getting information about the devices network
4+
5+
## Requirements
6+
7+
Version 3+ requires RN 0.47 or higher
8+
Version 2+ requires RN 0.40 - RN 0.46
9+
10+
## Installation
11+
12+
```javascript
13+
npm install react-native-easemob --save
14+
```
15+
or
16+
17+
```javascript
18+
yarn add react-native-easemob
19+
```
20+
21+
### Automatic Install
22+
23+
`react-native link react-native-easemob`
24+
25+
## Usage
26+
27+
```javascript
28+
29+
import {login,sendText,sendVoice,sendVideo,sendImage,sendLocation,getAllContacts,getConversation,download,deleteMsg,forwarding} from 'react-native-easemob'
30+
import {DeviceEventEmitter, NativeEventEmitter, NativeModules} from 'react-native';
31+
const {RNReactNativeEasemob} = NativeModules;
32+
const iosChatEmitter = new NativeEventEmitter(RNReactNativeEasemob);
33+
//监听ios获取消息
34+
iosChatEmitter.addListener( 'message',async(e) => {})
35+
36+
//监听ios对方收到消息
37+
iosChatEmitter.addListener( "deliver",async(e) => {})
38+
39+
//监听android获取消息
40+
DeviceEventEmitter.addListener('message', async(e) => {});
41+
42+
//监听android对方获取消息
43+
DeviceEventEmitter.addListener('deliver', async(e) => {});
44+
45+
//登录
46+
Promise login(userId:string,pwd:string)
47+
48+
//发送文本
49+
Promise sendText(content:string,userId:string)
50+
51+
//发送语音
52+
Promise sendVoice(path:string,length:number,userId:string)
53+
54+
//发送视频
55+
Promise sendVideo(path:string,thumbPath:string,length:number,userId:string)
56+
57+
//发送图片
58+
Promise sendImage(path:string,userId:string)
59+
60+
//发送位置
61+
Promise sendLocation(latitude:number,longitude:number,address:string,userId:string)
62+
63+
//获取当前用户的所有联系人
64+
Promise getAllContacts()
65+
66+
//下载当前消息下的附件
67+
Promise download(userId:string,msgId:string)
68+
69+
//获取回话列表包含最近一条的对话
70+
Promise getAllConversations()
71+
72+
//获取当前用户的聊天记录
73+
Promise getConversation(userId:string,msgId:string)
74+
75+
//删除消息
76+
Promise deleteMsg(userId:string,msgId:string)
77+
78+
//转发消息
79+
Promise forwarding(userId:string,msgId:string,toUserId:string)
80+
```
81+

0 commit comments

Comments
 (0)