@@ -123,9 +123,8 @@ export default class ConversationList extends React.Component {
123123 this . reloadConversationList ( )
124124 }
125125
126- getListItem ( conversation , id ) {
127- var item = this . state . data [ id ]
128- let newItem = { ...item }
126+ getListItem ( conversation ) {
127+ var newItem = { }
129128 newItem . conversation = conversation
130129 newItem . type = conversation . conversationType
131130 if ( conversation . conversationType === "single" ) {
@@ -204,7 +203,7 @@ export default class ConversationList extends React.Component {
204203 reloadConversationList ( ) {
205204 JMessage . getConversations ( ( result ) => {
206205 var data = result . map ( ( conversation , index ) => {
207- return this . getListItem ( conversation , index )
206+ return this . getListItem ( conversation )
208207 } )
209208 data . sort ( ( a , b ) => {
210209 return b . latestMessage . createTime - a . latestMessage . createTime
@@ -225,19 +224,19 @@ export default class ConversationList extends React.Component {
225224 } )
226225 }
227226
228- createConversation ( params , id ) {
227+ createConversation ( params ) {
229228 JMessage . createConversation ( params , ( conv ) => {
230- var item = this . getListItem ( conv , id )
229+ var item = this . getListItem ( conv )
231230 this . enterConversation ( item )
232231 } , ( error ) => {
233232 Alert . alert ( 'create conversation error !' , JSON . stringify ( error ) )
234233 } )
235234 }
236235
237- enterChatRoom ( item , id ) {
236+ enterChatRoom ( item ) {
238237 JMessage . enterChatRoom ( item , ( conversation ) => {
239238 this . props . navigation . navigate ( 'Chat' , {
240- conversation : this . getListItem ( conversation , id )
239+ conversation : this . getListItem ( conversation )
241240 } )
242241 } , ( error ) => {
243242 console . alert ( "error, code: " + error . code + ", description: " + error . description )
@@ -302,7 +301,7 @@ export default class ConversationList extends React.Component {
302301 params . type = 'single'
303302 params . username = this . state . modalText
304303 this . setState ( { isShowModal : false } )
305- this . createConversation ( params , item . id )
304+ this . createConversation ( params )
306305 } }
307306 style = { styles . modalButton }
308307 title = '创建单聊' />
@@ -314,7 +313,7 @@ export default class ConversationList extends React.Component {
314313 params . type = 'group'
315314 params . groupId = group . id
316315 this . setState ( { isShowModal : false } )
317- this . createConversation ( params , item . id )
316+ this . createConversation ( params )
318317 } , ( error ) => {
319318 Alert . alert ( 'create group error !' , JSON . stringify ( error ) )
320319 } )
@@ -333,7 +332,7 @@ export default class ConversationList extends React.Component {
333332 owner : conversation . owner ,
334333 }
335334 this . setState ( { isShowModal : false } )
336- this . enterChatRoom ( params , item . id )
335+ this . enterChatRoom ( params )
337336 } )
338337 } }
339338 style = { styles . modalButton }
0 commit comments