Add index types

This commit is contained in:
Johannes Klein
2026-06-12 15:26:11 +02:00
parent 5a4bf1e328
commit 76fd37fb05

View File

@@ -163,18 +163,18 @@ const MainMediaDisplay = ( {
] );
// need getItemLayout for setting initial scroll index
const getItemLayout = useCallback( ( data, idx ) => ( {
const getItemLayout = useCallback( ( data, idx: number ) => ( {
length: screenWidth,
offset: screenWidth * idx,
index: idx,
} ), [screenWidth] );
const handleScrollLeft = useCallback( index => {
const handleScrollLeft = useCallback( ( index: number ) => {
if ( atFirstItem ) { return; }
setSelectedMediaIndex( index );
}, [atFirstItem, setSelectedMediaIndex] );
const handleScrollRight = useCallback( index => {
const handleScrollRight = useCallback( ( index: number ) => {
if ( atLastItem ) { return; }
setSelectedMediaIndex( index );
}, [atLastItem, setSelectedMediaIndex] );