You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For append/update/insert message to MessageList, you will use `MsgListModule`(Native Module) to send event to native.
143
-
144
-
- appendMessages([message])
145
-
146
-
example:
147
-
148
-
```
149
-
var messages = [{
150
-
msgId: "1",
151
-
status: "send_going",
152
-
msgType: "text",
153
-
text: "Hello world",
154
-
isOutgoing: true,
155
-
fromUser: {
156
-
userId: "1",
157
-
displayName: "Ken",
158
-
avatarPath: "ironman"
159
-
},
160
-
timeString: "10:00",
161
-
}];
162
-
AuroraIMUIModule.appendMessages(messages);
163
-
```
164
-
165
-
- updateMessage(message)
166
-
167
-
example:
168
-
169
-
```
170
-
var message = {
171
-
msgId: "1",
172
-
status: "send_going",
173
-
msgType: "text",
174
-
text: text,
175
-
isOutgoing: true,
176
-
fromUser: {
177
-
userId: "1",
178
-
displayName: "Ken",
179
-
avatarPath: "ironman"
180
-
},
181
-
timeString: "10:00",
182
-
};
183
-
AuroraIMUIModule.updateMessage(message);
184
-
```
185
-
186
-
- insertMessagesToTop([message])
187
-
188
-
**Notice that the order of message array must be sorted in chronological order**
189
-
190
-
example:
191
-
192
-
```
193
-
var messages = [{
194
-
msgId: "1",
195
-
status: "send_succeed",
196
-
msgType: "text",
197
-
text: "This",
198
-
isOutgoing: true,
199
-
fromUser: {
200
-
userId: "1",
201
-
displayName: "Ken",
202
-
avatarPath: "ironman"
203
-
},
204
-
timeString: "10:00",
205
-
},{
206
-
msgId: "2",
207
-
status: "send_succeed",
208
-
msgType: "text",
209
-
text: "is",
210
-
isOutgoing: true,
211
-
fromUser: {
212
-
userId: "1",
213
-
displayName: "Ken",
214
-
avatarPath: "ironman"
215
-
},
216
-
timeString: "10:10",
217
-
},{
218
-
msgId: "3",
219
-
status: "send_succeed",
220
-
msgType: "text",
221
-
text: "example",
222
-
isOutgoing: true,
223
-
fromUser: {
224
-
userId: "1",
225
-
displayName: "Ken",
226
-
avatarPath: "ironman"
227
-
},
228
-
timeString: "10:20",
229
-
}];
230
-
AuroraIMUIModule.insertMessagesToTop(messages);
231
-
```
232
-
233
-
## Style
234
-
235
-
### MessageList custom style
236
-
237
-
**In android, if your want to define your chatting bubble, you need to put a drawable file in drawable folder, and that image file must be [nine patch drawable file](https://developer.android.com/reference/android/graphics/drawable/NinePatchDrawable.html), see our example for detail.**
238
-
239
-
240
-
241
-
**In iOS, if your want to define your chatting bubble,you need to put a image file to you xcode,and specifies ` sendBubble.imageName` or `receiveBubble.imageName` to image name. if you need to set the default avatar, you need put you default avatar image to you xcode,and adjust the image name to `defoult_header`,see our example for detail.**
242
-
243
-
- sendBubble: PropTypes.object :
244
-
```
245
-
// eg:
246
-
{
247
-
imageName:"inComing_bubble",
248
-
padding:{left:10,top:10,right:15,bottom:10}
249
-
}
250
-
```
251
-
252
-
- receiveBubble: PropTypes.object,
253
-
254
-
- sendBubbleTextColor: PropTypes.string,
255
-
256
-
- receiveBubbleTextColor: PropTypes.string,
257
-
258
-
- sendBubbleTextSize: PropTypes.number,
259
-
260
-
- receiveBubbleTextSize: PropTypes.number,
261
-
262
-
263
-
This Padding object includes four properties: left, top, right, bottom.
264
-
```
265
-
// eg:
266
-
{
267
-
left: 5,
268
-
top: 5,
269
-
right: 15,
270
-
bottom: 5
271
-
}
272
-
```
273
-
- sendBubblePadding: PropTypes.object
274
-
275
-
- receiveBubblePadding: PropTypes.object
276
-
277
-
- dateTextSize: PropTypes.number,
278
-
279
-
- dateTextColor: PropTypes.string,
280
-
281
-
- datePadding: PropTypes.number -- This is a number property, means padding left/top/right/bottom value is same.
0 commit comments