Skip to content

How to preventing scrolling to the bottom after new elements are inserting inside a list? #403

@ntovr

Description

@ntovr

Hi everyone! In my case, I use onScrollFrame and wait until the user will scroll to the top of the list and after that, I make an async request to load more messages from the server (kinda lazy loading for supporting a massive amount of messages) but when I add new messages to the list (they are added to the top of the list), it scrolls to the bottom. How can I prevent it? I have an idea to calculate the difference between scroll heights using getScrollHeight before and after each loading but I hardly know where to begin. Do you have any ideas or is there any other way to go? Maybe some ready cases? I don't think I'm the first guy who is trying to do something like that. Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions