-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal to migrate to the new react-native component Flatlist component. #411
Comments
@Kabangi we don't really need to invert the list, it is only used to keep the list scrolled to the bottom. Want to create a PR for this? :) |
@kfiroo Definitely I will give it a shot. Thanks |
I'm in the middle of migrating gifted chat to FlatList. As Invertible Scroll View is not compatible, I tried onScrollToEnd. But invoking it on every |
@radko93 That's awesome! |
The problem with the lack of |
Struggling with the same problem right now for my chat. |
Ok I'm close to getting this to work by using onViewableItemsChanged={({viewableItems}) => {
if (viewableItems.length > 0 && viewableItems[0].index === 0) {
// Has scrolled to top
// Load next 20 items from the end of the list
}
}} Now all that's left is to figure out how to keep the scroll position at the item that is I propably have to point out that I'm using the underlying |
Any progress on this? |
I am applying the
In my own project now, which works. |
Kind of made it work but this stops me from pushing a PR facebook/react-native#13727. If manually scroll to top and then send a message there's a blank space at the bottom of the list |
FlatList supports inversion now, through the |
@bartolkaruza Really sweet thanks for the heads up, I do not think it's released yet. Seems like it was committed 3 days ago. |
It will be there in around 1-2 months. But it's not different than the solution already posted in this issue #411 (comment) so it does not really change anything. |
If you are using #411 (comment) , you have to add the following to make it work on Android 7
Otherwise, it will not render at all on Android 7 devices. This same issue is also there with the current ListView implementation; #486 |
Hello, any progress on this? |
FlatList does now have an "inverted" property: Was finally able to throw out all the scoll and content size magic. It works as simple as this:
It is also available in |
@DavidKuennen : FlatList inverted use transform scaleY:-1 to render item from bottom, so when we have data updated, FlatList auto display new item without animation scroll. Did you have any trick to make it keep last scroll position, then animation scroll to bottom when new item render ? |
@redwind I add new messages to the bottom of my list of messages and not to the top. That way, FlatList renders new messages at the bottom. There is one drawback doing it this way tho and that is, that FlatList always rerenders all items upon receiving a new message, since that message is bumped to the bottom of the list. The other advantage over doing it the other way is, that as I scroll top and trigger the The performance impact it would have to rerender the whole FlatList for every number of reloaded messages would be far greater than rerendering only once upon receiving a new message. Interestingly enough it works as I expect a chat to work also for the scroll position this way. Every time I bump a new message to the bottom of my list, the scroll view is being pushed top the exact same height that new message has. Means, if I'm at the bottom of my list (seeing the newest message) and receive a message, I stay at the bottom without doing anything. If I'm not scrolled to the botton but for example half way through my chat, I keep the scroll position, as I expect it to be. Since if I manually scrolled top, I have a reason to do that and therefore would not want to have my scroll position being dragged to the bottom again, every time I receive a new message (that's also how WhatsApp works btw.). Of course if you want to have your scroll position always at the bottom for each new message, a simple This is from my implementation: |
I do the same thing as @DavidKuennen. It's my understanding that FlatList is able to prevent rerenders in response to prepends as long as the keys extracted by the |
@Ashoat Thanks, didn't know it works like that and prevents rerender even when prepending messages. 👍 |
I forgot to the mention that it only works if your items are rendered as Oh, and you'll also need to make sure that the individual objects contained in your As long as the individual data objects don't change, the |
This guy forked this repo and use flatlist (https://github.com/ptmt/react-native-gifted-chat-flat), but it only works on RN < 49, so I made fork (https://github.com/pewh/react-native-gifted-chat-flat) that work on RN 49 (didn't test on RN < 49). The performance is very good. But unfortunately it has bugs on send button on both mine and ptmt version, where FaridSafi version has no issue about it. |
Is this still a thing? Is this going to be implemented? I might be able to help out if needed. |
+1 please |
+1 😇 |
PR would be nice! Keep in mind: retrocompatibility. |
IMHO retrocompatibility should not be the major goal. This is an update to THE central component in this repo. If we continue to use old components no longer supported by RN, this project will age quickly! |
@brunocascio , created PR #629 For review and comments if any |
@redwind @DavidKuennen @Ashoat Did this issue "when we have data updated, FlatList auto display new item without animation scroll. Did you have any trick to make it keep last scroll position" solved ? |
@DavidKuennen can you share how did you manage to add three icons in the text input if the text is empty. Thanks. |
merge #705 by @xcarpentier please tests on master we can close this |
What else needs to be done to have a new release on |
npm installation still comes with ListView, any update coming soon to the package manager? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I feel this module will heavily benefit from the new flatlist component because of the large dataset that is involved with it.
Am not sure though how we will go about inverting the component so that data get added at the bottom rather than at the top.
The text was updated successfully, but these errors were encountered: