ScrollableList: update Virtuoso component types for v4
This commit is contained in:
parent
f5c6ea8fab
commit
14299ce62a
1 changed files with 2 additions and 2 deletions
|
@ -24,13 +24,13 @@ type SavedScrollPosition = {
|
||||||
// NOTE: It's crucial to space lists with **padding** instead of margin!
|
// NOTE: It's crucial to space lists with **padding** instead of margin!
|
||||||
// Pass an `itemClassName` like `pb-3`, NOT a `space-y-3` className
|
// Pass an `itemClassName` like `pb-3`, NOT a `space-y-3` className
|
||||||
// https://virtuoso.dev/troubleshooting#list-does-not-scroll-to-the-bottom--items-jump-around
|
// https://virtuoso.dev/troubleshooting#list-does-not-scroll-to-the-bottom--items-jump-around
|
||||||
const Item: Components<Context>['Item'] = ({ context, ...rest }) => (
|
const Item: Components<JSX.Element, Context>['Item'] = ({ context, ...rest }) => (
|
||||||
<div className={context?.itemClassName} {...rest} />
|
<div className={context?.itemClassName} {...rest} />
|
||||||
);
|
);
|
||||||
|
|
||||||
/** Custom Virtuoso List component for the outer container. */
|
/** Custom Virtuoso List component for the outer container. */
|
||||||
// Ensure the className winds up here
|
// Ensure the className winds up here
|
||||||
const List: Components<Context>['List'] = React.forwardRef((props, ref) => {
|
const List: Components<JSX.Element, Context>['List'] = React.forwardRef((props, ref) => {
|
||||||
const { context, ...rest } = props;
|
const { context, ...rest } = props;
|
||||||
return <div ref={ref} className={context?.listClassName} {...rest} />;
|
return <div ref={ref} className={context?.listClassName} {...rest} />;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue