@codeleap/mobile 3.20.1 → 3.20.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -43,7 +43,7 @@ export type PagerProps = React.PropsWithChildren<{
|
|
|
43
43
|
renderPageWrapper?: React.FC<PageProps>
|
|
44
44
|
pageWrapperProps?: any
|
|
45
45
|
width?: number
|
|
46
|
-
onScroll?: (event: ScrollEvent, args: { isLeft
|
|
46
|
+
onScroll?: (event: ScrollEvent, args: { isLeft?: boolean; isRight?: boolean; x?: number }) => void
|
|
47
47
|
/** If TRUE render page, nextPage and prevPage only */
|
|
48
48
|
windowing?: boolean
|
|
49
49
|
scrollRightEnabled?: boolean
|
|
@@ -157,10 +157,13 @@ export const Pager = (pagerProps: PagerProps) => {
|
|
|
157
157
|
}, [childArr, page, setPage, waitEventDispatch.current])
|
|
158
158
|
|
|
159
159
|
const handleScroll = (event: ScrollEvent) => {
|
|
160
|
-
if (!scrollEnabled) return null
|
|
161
|
-
|
|
162
160
|
const scrollX = event?.nativeEvent?.contentOffset?.x
|
|
163
161
|
|
|
162
|
+
if (!scrollEnabled) {
|
|
163
|
+
if (TypeGuards.isFunction(onScroll)) onScroll?.(event, { x: scrollX })
|
|
164
|
+
return null
|
|
165
|
+
}
|
|
166
|
+
|
|
164
167
|
if (!_scrollEnabled) {
|
|
165
168
|
setScrollPositionX(scrollX)
|
|
166
169
|
return null
|