Messages are completely disorganized | Not ordered.
See original GitHub issueIssue Description
I’m attempting to use GiftedChat in the react-native port of our application and we’re running into problems with the order in which messages are displayed, shown in a screenshot below. All of our dates are stored in MIlliseconds since UTC on the Server, porting our messages over looks like so:
var altered = {
_id: message.key,
text: message.data,
createdAt: new Date(message.created_at), // Also tried just message.created_at
user: {
_id: message.sender,
name: match.other_user.first_name,
avatar: match.other_user.photo
}
}
giftedMessages.push(altered)
The result is this jumbled mess, it doesn’t seem to follow any type of organization. This is a real conversation pulled from our database between two users, one being a test account of ours. We use Firebase, so the timestamp is stored in MIlliseconds since epoch.
Steps to Reproduce / Code Snippets
Just use the example and any dates formed using milliseconds. (IE: Date.now())
Expected Results
Proper ordering of messages.
Additional Information
- React Native version: 0.33.0
- react-native-gifted-chat version: 0.0.10
- Platform(s) (iOS, Android, or both?): iOS (Don’t have android)
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (2 by maintainers)
Top Results From Across the Web
My text messages are all out of order ins… - Apple Community
Messages are organized based on the system time. If the time set for the app is incorrect messages will not be organized by...
Read more >Why Are My Text Messages Out of Order Android, How to Fix?
There are many reasons why your messages are not organized and this guide takes a look at how you can resolve that problem....
Read more >Messages Out of Order on iPhone? Try This Solution | OSXDaily
Using Messages in iCloud should completely resolve any iMessages appearing out of order issues if they are lingering or persisting, though it ...
Read more >Top 5 Ways to Fix Wrong Order of Messages in Samsung ...
1. Check Date and Time. The most common reason the Samsung phone shows the wrong order of messages is the incorrect date and...
Read more >iMessage Out Of Order On iPhone? Here's The Real Fix!
The on/off of imessages and restarting phone did NOT fix for me. The turning off the automatic time/date and closing out messages app...
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 FreeTop 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
Top GitHub Comments
I really appreciate this library being open sourced, but the fact that there isn’t some sort of default sorting should be advertised on the readme. That is a crucial and integral part of any messaging template. Again, not saying that there needs to be a PR for this, but for the sake of users it would be nice to specify this lack of functionality more clearly upfront.
@qualifyapp GiftedChat will not sort the message for you, it will preserve the order of message as it was in the
messages
prop Hope that helps