-
Notifications
You must be signed in to change notification settings - Fork 54
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
Use FlatList instead of our custom recycler view list on Android #256
Conversation
I suggest we remove the whole Imo, it will be simpler to find a proper solution starting from scratch if we switch back Edit: I added a commit to do just that, feel free to remove it if you don't want it here! |
I just tested this PR and I think inserting and reordering in FlatList seems more natural than with the previous animations, so if that's the only thing keeping us on the recyclerview one, I'm happy to drop it |
Regarding using FlatList or RecyclerView on Android, we've been chatting with @daniloercoli about it. As we approach the alpha release date, I think it's good to have this FlatList PR ready to merge if we see we are out of time by the date Alpha needs to be sent out. It's good to have alternatives. Clearly, the focus problems make Gutenberg currently hardly usable on Android, and we need to fix them, but just testing this PR on a real device shows me the focus problems are still there for Aztec (RichText). So, it doesn't look like it's the RecyclerView's fault.
Regarding the choice itself, I'm not super clear about history but leaving what I recall and my thoughts here to document from this point on. I think we were concerned about these things when the initial decision was made:
I think it'd be good to make a list/matrix with pros and cons for each. I can see code using Pros of using FlatList:
Cons of FlatList:
Pros of using RecyclerViewList:
Cons of using RecyclerViewList:
Interested in knowing your thoughts cc @hypest @koke @daniloercoli and everyone |
Wow, thanks @mzorz for all the context and the thorough comparison ❤️ Some comments on the main issues:
To add to the list, I'm not 100% sure about the details, but I feel we've had to spend a good amount of effort adapting to the recyclerview list, and fixing issues with how the dataSource works, and I'm under the impression that working with FlatList would have been more straightforward. With all this information, I'm strongly in favor of switching to FlatList. |
Thanks for putting our brainstorming in a complete form. 🥇
I agree with @koke on this specific point above, and also on the others points. We should also think that RN isn't a new framework in 2018, there should be reasons behind their choices of using what it seems a pure JS approach for Virtual Lists. I would be surprised that RN doesn't handle virtual lists in a reasonable way, since it's one of the most used component out there in apps. |
f63e50a
to
ea6cfd8
Compare
ea6cfd8
to
6562e23
Compare
Rebased ( |
Tested this again and it seems to work as expected. |
Agreed - and we should be able to use any other RN lib to add animations and drag and drop to both platforms this way. To me the strongest point is cleaner code and maintainability. I'm leaning towards FlatList as well 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can re-introduce recycler view in 3-4 months if required.
As discussed elsewhere, concerns for people against this PR are that FlatList won't be able to give us what we need for a good, "native feel" UX.
However, and in lieu of keeping things simple for development to hit our goals for Alpha, the team has the feeling FlatList will help have things out of the way and focus on isolating the problems ahead.
Approving this PR to get things going, knowing we'll need to come back to RecyclerViewList
later.
This PR switches the main blocks list to ReactNative
FlatList
component on Android.TextInput
.I've spent some time trying to fix the issue in our recycler view list repo, with no luck.
It's not clear to me why we've selected this custom list component (beside animations), since
FlatList renders items lazily, just when they are about to appear, and removes items that scroll way off screen to save memory and processing time.
If we all agree on removing the Recycler list only temporary, hoping to find the time to fix the issue later, I can open a new ticket to remind us to remove all the
Datasource
refs required by this component, if the fix on the list doesn't' happen in say 2 weeks, or a month.Otherwise I can remove all refs in this PR.