react-virtuoso
Advanced tools
Comparing version 4.0.9 to 4.1.0
import { default as React_2 } from 'react'; | ||
export declare type CalculateViewLocation = (params: CalculateViewLocationParams) => IndexLocationWithAlign | number | null; | ||
export declare interface CalculateViewLocationParams { | ||
itemTop: number; | ||
itemBottom: number; | ||
viewportTop: number; | ||
viewportBottom: number; | ||
locationParams: { | ||
align?: 'start' | 'center' | 'end'; | ||
behavior?: 'auto' | 'smooth'; | ||
} & ({ | ||
index: number; | ||
} | { | ||
groupIndex: number; | ||
}); | ||
} | ||
/** | ||
@@ -321,3 +338,30 @@ * Customize the Virtuoso rendering by passing a set of custom components. | ||
behavior?: 'auto' | 'smooth'; | ||
/** | ||
* Will be called when the scroll is done, or immediately if no scroll is needed. | ||
*/ | ||
done?: () => void; | ||
/** | ||
* Use this function to fine-tune the scrollIntoView behavior. | ||
* The function receives the item's top and bottom position in the viewport, and the viewport top/bottom. | ||
* Return an location object to scroll, or null to prevent scrolling. | ||
* Here's the default implementation: | ||
* ```ts | ||
const defaultCalculateViewLocation: CalculateViewLocation = ({ | ||
itemTop, | ||
itemBottom, | ||
viewportTop, | ||
viewportBottom, | ||
locationParams: { behavior, align, ...rest }, | ||
}) => { | ||
if (itemTop < viewportTop) { | ||
return { ...rest, behavior, align: align ?? 'start' } | ||
} | ||
if (itemBottom > viewportBottom) { | ||
return { ...rest, behavior, align: align ?? 'end' } | ||
} | ||
return null | ||
} | ||
*``` | ||
*/ | ||
calculateViewLocation?: CalculateViewLocation; | ||
} | ||
@@ -324,0 +368,0 @@ |
@@ -6,3 +6,3 @@ { | ||
"sideEffects": false, | ||
"version": "4.0.9", | ||
"version": "4.1.0", | ||
"homepage": "https://virtuoso.dev/", | ||
@@ -9,0 +9,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
230409
5090