Expose a Function Outside of Component
I'm working on improvements to
@solid-primitives/virtual
, namely support for dynamic item sizes and fixes to broken reactivity.
I implemented a scrollToItem
utility function that is now returned from createVirtualList
. This works perfectly fine if you are just using the headless virtual list.
However, there is a VirtualList
component that abstracts away the HTML boilerplate required for createVirtualList
to function. For convenience, I would like to expose the scrollToItem
function for use outside of VirtualList
. Problem is, I have yet to find an idiomatic way to accomplish this after searching around for a bit.
Here's an extremely hacky solution I came up with that I'm not so proud of and would like to replace before I submit the PR for review:
Internals:
In Use:
I would really appreciate if anyone could help me replace this with something idiomatic, thanks!GitHub
virtual
Improvements (Dynamic Item Sizes, Fix Broken Reactivity) ...This adds support for dynamic item sizes in the virtual package.
This is accomplished by adding | (row: T[number], index: number) => number) to the rowHeight parameter, and type-checking for...
2 Replies