React-native-gifted-chat: handleSend

Created on 4 Sep 2016  路  4Comments  路  Source: FaridSafi/react-native-gifted-chat

Hello! thanks for your amazing RN component!
I was wondering if there is any way to handle message delivery errors, as it was in react-native-gifted-messenger (I remember there was an example where you could re-send message in a case of error)? why did you remove this functionality?

Most helpful comment

I think this logic should be handled by your app and not the component.
GiftedChat is a _"stupid"_ component that receives a list of messages to display, and should not handle the way you send your message because it is up to the developer.

What I did in my app is:

  1. User send a message
  2. Message object is created and saved in the local store with message.state = temp
  3. When selecting messages from the store, treat temp and "real" messages the same
  4. If the API returned an error, change message state to error
  5. Also, if we don't get success from the API after X seconds you could set the state to error
  6. Finally, override renderMessage and render your message view according to the state, for error you could render an error icon and a button that will try to send the message again

Hope that helps

All 4 comments

I think this should be renamed or tagged as Feature Request. I do like the way that JSQMessagesViewController handled this. It would show the message that was sent and it would have a little indicator and message to say it was not sent. And then upon selecting it, it would try again.

+1

I think this logic should be handled by your app and not the component.
GiftedChat is a _"stupid"_ component that receives a list of messages to display, and should not handle the way you send your message because it is up to the developer.

What I did in my app is:

  1. User send a message
  2. Message object is created and saved in the local store with message.state = temp
  3. When selecting messages from the store, treat temp and "real" messages the same
  4. If the API returned an error, change message state to error
  5. Also, if we don't get success from the API after X seconds you could set the state to error
  6. Finally, override renderMessage and render your message view according to the state, for error you could render an error icon and a button that will try to send the message again

Hope that helps

I close it. I think it's too old to be in issue list again. Please feel free to open a new one if you think it's again the case that you need this feature... :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pentarex picture pentarex  路  3Comments

tafelito picture tafelito  路  3Comments

luisfuertes picture luisfuertes  路  3Comments

cerberusv2px picture cerberusv2px  路  3Comments

inceptivetech picture inceptivetech  路  3Comments