Fix indicator on web

This commit is contained in:
Dan Abramov
2023-10-17 20:25:05 +01:00
parent 05d92799ff
commit 3bc9a0120a
+6 -1
View File
@@ -21,6 +21,7 @@ export const Pager = React.forwardRef(function PagerImpl(
initialPage = 0, initialPage = 0,
renderTabBar, renderTabBar,
onPageSelected, onPageSelected,
onPageScroll,
}: React.PropsWithChildren<Props>, }: React.PropsWithChildren<Props>,
ref, ref,
) { ) {
@@ -34,8 +35,12 @@ export const Pager = React.forwardRef(function PagerImpl(
(index: number) => { (index: number) => {
setSelectedPage(index) setSelectedPage(index)
onPageSelected?.(index) onPageSelected?.(index)
onPageScroll?.({
position: index,
offset: 0
})
}, },
[setSelectedPage, onPageSelected], [setSelectedPage, onPageSelected, onPageScroll],
) )
return ( return (