how to keep scroll position when append new item in chatting list after searching?
Hello
I'm developing messenger app using React Native.
I used FlatList to show the chatting list in Chat room, there's a problem.
When I append new Item after scroll down to bottom of the list, the last message of the new item is shown if I don't scrollIndex.
But in discord, the scroll is kept and the new messages are added below the scroll.
Is there any tip? or other library?
related question: https://github.com/facebook/react-native/issues/25239
-
There are a few ways to do this:
1. Use a variable to track the scroll position. When new items are added to the list, add them at the correct position in the list based on the scroll position.
2. Use a container element with a fixed height. When new items are added to the list, they will be added to the bottom of the container and the scroll position will not change.
3. Use a scrollable container element with a overflow:auto style. When new items are added to the list, they will be added to the bottom of the container and the scroll position will automatically adjust.
0
サインインしてコメントを残してください。
コメント
1件のコメント