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

feat: shared view pools [wip] #68

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

rigor789
Copy link
Member

@rigor789 rigor789 commented Aug 6, 2023

This is a draft/wip branch of implementing shared view pools.

Shared pools will allow defining the item templates in a separate view/element, and reuse them for multiple CollectionViews. This is especially useful for nested CollectionViews, where we may have multiple CollectionViews rendering the same templates.

For simplicity, pool related logic has been moved to a new SharedCollectionViewPool class, so even if the view doesn't share the pool, it will still create one automatically and use that (rather than duplicating the logic in both classes).

todos:

  • handle unloading/re-loading the view
  • thoroughly test to make sure recycling behaves correctly
  • implement iOS (at least supporting using templates from the SharedCollectionViewPool
  • refine api, property naming
  • add demos
  • add framework wrappers
  • document usage

}
const isNonSync = holder['defaultItemView'] === true;
const view = isNonSync ? (holder.view as ContentView).content : holder.view;
this.notifyForItemAtIndex(CollectionViewBase.itemDisposingEvent, view, holder.getAdapterPosition(), view.bindingContext, holder);
Copy link
Member Author

Choose a reason for hiding this comment

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

This should likely be fired on the CollectionView instances as well?

}
const isNonSync = holder['defaultItemView'] === true;
const view = isNonSync ? (holder.view as ContentView).content : holder.view;
this.notifyForItemAtIndex(CollectionViewBase.itemRecyclingEvent, view, holder.getAdapterPosition(), view.bindingContext, holder);
Copy link
Member Author

Choose a reason for hiding this comment

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

This should also likely be fired for all CollectionView instances as well (perhaps this.notifyForItemAtIndex would just notify self + all attached collectionView instances.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant