question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Messages are completely disorganized | Not ordered.

See original GitHub issue

Issue 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.

gifted-confusion

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:closed
  • Created 7 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

15reactions
dcurletticommented, Sep 23, 2016

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.

9reactions
kfiroocommented, Sep 19, 2016

@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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found