How to load messages on scroll?
See original GitHub issueI tried out the “Load earlier messages” button and it works great, but I am wondering how you would check for when the user scrolls to the top so it can be ran without pressing the button.
Also, is there a way to get the number of messages that GiftedChat currently has without relying on my own state changes e.g. GiftedChat.messages.length
? Would also be useful for pagination.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:9 (1 by maintainers)
Top Results From Across the Web
How to load messages on mouse scroll? - Stack Overflow
Here is a quick sample code to test $(window).on("scroll", function() { var scrollHeight = $(document).height(); var scrollPosition ...
Read more >How to Find (and Scroll to) Old Messages on Your iPhone
How to See Old Messages on an iPhone With the Hidden Scroll · Open the Messages app in iOS and select the conversation...
Read more >How to Find Old Messages on iPhone Without Scrolling
As you tap, the message thread should be quickly scrolled to the very first dialogue of the conversation. For lengthy conversations, a progress ......
Read more >Infinite Chat Scrollbar. Load messages dynamically and…
//This function helps you scroll to the correct position once a new batch of messages are loaded. var page = 1
Read more >Load content on page scroll with jQuery and AJAX - Makitweb -
It will automatically load up content whenever the user reaches the bottom of the web page while the page scroll. You can also...
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
Hi, this plugin should implement a
loadEarlierMessagesOnScroll
, that seems to me a classical function in any chat for loading messages when scrolling top… (can you imagine whatsapp, fb messenger or any other chat only with a click-to-load-earlier-messages button ?)However, if someone wonders how I achieved it:
@drpiou’s solution didn’t work for me, so I made some modifications, and here they are: How to check if scroll
is close to top
:contentTopOffset
= how far is the oldest chat message from the top edge: positive number means above, negative number means below.contentOffset.y
= the number showing how much content is below the bottom edge of the visible chat area.