Update when receiving new messages
See original GitHub issueI’m running the chat using two simulators (Android and IOS) where each have different users chatting between. Using loadEarlier, isLoadingEarlier and onLoadEarlier
I’m trying to update the chat as I receive new messages.
I thought that when using onLoadEarlier I would be able to get notice about the new messages, but it’s clearly that I’m missing something.
I also thought about use some Interval
to check for new data, but I don’t see this as a good option.
constructor (props) {
super(props)
this.state = {
loadEarlier: true,
isLoadingEarlier: false,
messages: []
}
this.onLoadEarlier = this.onLoadEarlier.bind(this)
}
_load () {
api.getMessages().then((response) => {
this.setState((previousState) => {
return { messages: response, isLoadingEarlier: false }
})
})
}
onLoadEarlier () {
this.setState((previousState) => {
return { isLoadingEarlier: true }
})
this._load()
}
<GiftedChat
messages={this.state.messages}
loadEarlier={this.state.loadEarlier}
onLoadEarlier={this.onLoadEarlier}
isLoadingEarlier={this.state.isLoadingEarlier}
Additional Information
- React Native version: 0.47.2
- react-native-gifted-chat version: 0.2.7
- Platform(s) (iOS, Android, or both?): both
Issue Analytics
- State:
- Created 6 years ago
- Comments:6
Top Results From Across the Web
If you can't send or receive messages on your iPhone or iPad
In the Settings app, tap Messages. Turn iMessage off and then back on. Tap Send & Receive. Tap the phone number that you...
Read more >How to Fix Not Receiving Text Messages on Android
How to Fix Not Receiving Text Messages on Android · Turn Off iMessage on Your iPhone · Toggle the Airplane Mode on Your...
Read more >Messages Still Delivered to Old Phone After Activating New ...
Messages may not be immediately delivered to the new phone after disabling the chat service on the old one. Google must sever the...
Read more >Google Messages Just Received a New Update With Heap of ...
You can read more about Google Messages and all the changes that you have received here.
Read more >Messages app not receiving text messages after Android 11 ...
Update 2:- As of today May 25 2021, the default SMS app is working as well. It started working suddenly, a day ago....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
So, How can I update UI when new message received ?
the same questions