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(useVirtualList): horizontal list #2310
Conversation
The only question is maybe we don't should set display: flex on the container, but then the developer needs to manually create horizontal scrolling. |
@antfu Hello, sorry for the link, can you tell me if this PR can be expected to be verified, or is something else needed? |
calculateRange, | ||
scrollTo, | ||
containerProps: { | ||
ref: containerRef, | ||
onScroll: () => { | ||
calculateRange() | ||
}, | ||
style: containerStyle, | ||
}, | ||
containerStyle, | ||
wrapperProps, | ||
currentList, | ||
containerRef, |
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.
The return types seems introduce a breaking change, is it intentional?
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.
If you look at this feature, you will notice that there are no breaking changes.
export function useVirtualList <T = any>(list: MaybeRef<T[]>, options: UseVirtualListOptions): UseVirtualListReturn<T> {
const { containerStyle, wrapperProps, scrollTo, calculateRange, currentList, containerRef } = 'itemHeight' in options
? useVerticalVirtualList(options, list)
: useHorizontalVirtualList(options, list)
return {
list: currentList,
scrollTo,
containerProps: {
ref: containerRef,
onScroll: () => {
calculateRange()
},
style: containerStyle,
},
wrapperProps,
}
}
The original function still returns the same object as before.
It's just that the object has different values depending on the direction of the list passed, but nothing has changed for the vertical sheet.
Description
add horizontal scroll to useVirtualList, fixes #2285
Additional context
I would like to know if I was moving in the right direction for a solution. Thanks
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).