Skip to content
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

Fix iOS ListView cell gone hidden (#11287) #13669

Closed

Conversation

ooikengsiang
Copy link
Contributor

Description of Change

Workaround iOS / MacOS ListView cell disappear when user scroll back and DequeueReusableCell return a hidden cell.
Force any hidden cell return by DequeueReusableCell which are hidden to create a new cell instead (set hidden to false doesn't work).

Issues Fixed

Fixes #11287

Workaround iOS ListView cell disappear when user scroll back and DequeueReusableCell return a hidden cell
@ghost ghost added the community ✨ Community Contribution label Mar 3, 2023
@ghost
Copy link

ghost commented Mar 3, 2023

Hey there @ooikengsiang! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@ooikengsiang
Copy link
Contributor Author

@dotnet-policy-service agree

@ooikengsiang
Copy link
Contributor Author

@ooikengsiang please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@dotnet-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@dotnet-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@dotnet-policy-service agree company="Microsoft"

Contributor License Agreement

@dotnet-policy-service agree

@jfversluis
Copy link
Member

jfversluis commented Mar 3, 2023

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

Copy link
Member

@mandel-macaque mandel-macaque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit, we are trying to move away from '== null' and '!= null'. Thanks for the fix!

…TableViewCell.cs

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
{
// set hidden to false doesn't work
// force recreate of the whole cell instead
reusableCell = null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

won't this break all cell reuse?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because those cell return that are not hidden are perfectly fine to reuse. Only those hidden are not. Also, I point out that setting hidden to false doesn't fix it. This may not be a perfect fix, but currently this fix at least make the ListView work correctly.

@PureWeen PureWeen self-assigned this Mar 6, 2023
@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

Copy link
Member

@PureWeen PureWeen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ooikengsiang Not sure if I'm missing something but I think the wrong reproduction was uploaded to the original issue? https://github.com/ooikengsiang/ListViewProblem ?

Can you point me to a reproduction of the issue so that I can test your fix?

@Symbai
Copy link
Contributor

Symbai commented Mar 10, 2023

@PureWeen I have a repro here: #13633 which might be the same issue, it was also linked with the original issue. The only difference is that in my issue cells become hidden when app goes into background and come back while in the original issue its when scrolling through the list. But the result is the same, cells become hidden.

@ooikengsiang
Copy link
Contributor Author

@ooikengsiang Not sure if I'm missing something but I think the wrong reproduction was uploaded to the original issue? https://github.com/ooikengsiang/ListViewProblem ?

Can you point me to a reproduction of the issue so that I can test your fix?

Fixed, sorry for the mix up.

@matmork
Copy link

matmork commented Apr 8, 2023

👀

Copy link
Member

@PureWeen PureWeen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the main problem here is that the viewhandler on the ViewCellRenderer isn't being completely disconnected.

I've checked in an alternate approach here
https://github.com/dotnet/maui/tree/13669_testing

can you let me know how that works for you? if that seems to address the problem?

@ooikengsiang
Copy link
Contributor Author

I think the main problem here is that the viewhandler on the ViewCellRenderer is being completely disconnected.

I've checked in an alternate approach here https://github.com/dotnet/maui/tree/13669_testing

can you let me know how that works for you? if that seems to address the problem?

Let me check and will get back to you.

@PureWeen
Copy link
Member

I think the main problem here is that the viewhandler on the ViewCellRenderer isn't being completely disconnected.

FYI, I meant to say isn't being disconnected.

I think the main problem here is that the viewhandler on the ViewCellRenderer isn't being completely disconnected.

@ooikengsiang
Copy link
Contributor Author

ooikengsiang commented May 11, 2023

I think the main problem here is that the viewhandler on the ViewCellRenderer isn't being completely disconnected.

FYI, I meant to say isn't being disconnected.

I think the main problem here is that the viewhandler on the ViewCellRenderer isn't being completely disconnected.

Test and it work! Awesome, never know that disconnect is required there.
Thanks for spending extra time looking into this.

@PureWeen
Copy link
Member

Thank you for testing @ooikengsiang and narrowing down to where this was being quirky!

Closing this PR in favor of #15036

@PureWeen PureWeen closed this May 11, 2023
@PureWeen
Copy link
Member

Thank you for testing @ooikengsiang and narrowing down to where this was being quirky!

Closing this PR in favor of #15036

@ooikengsiang if you have time can you test my updates here?

#15036

I think I was also breaking recycling with my changes :-)

I tried your repro and a few of our samples and they seemed to work fine.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-listview ListView and TableView community ✨ Community Contribution platform/iOS 🍎
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ListView in MacCatalyst is slow and render incorrectly when scroll back / up
8 participants