Open Vadko opened 2 years ago
Confirm
The same issue, any updates?
Need to find a way to disable user interaction, during animation of setPage
method
same issue on iPhone 13 iOS 15.4
this works for me initialPage from react-navigation params
const [isInitialized, setIsInitialized] = useState<boolean>(false);
const pageScrollHandler = usePagerScrollHandler({
onPageScroll: (e: { offset: number; position: number }) => {
'worklet';
if (!isInitialized) {
if (e.position === initialPage) runOnJS(setIsInitialized)(true);
return;
}
console.log(e.offset, e.position)
},
});
// ...
return (
<AnimatedPager
initialPage={initialPage}
onPageScroll={pageScrollHandler}
/>
)
No updates on this issue?
Environment
iOS 15.2
Description
onPageSelected and onScroll handlers giving wrong index on iPhone 12 simulator (as well as on real device too), but works on iPhone 11 (and older devices) correct. See video below (demonstrates apps on iPhone 11 and iPhone 12)
Reproducible Demo
Video 1 (correct behaviour, iPhone 11 iOS 15.2, after animation is not finished onPageSelected provides correct page after gesture completed) https://user-images.githubusercontent.com/9297785/149826584-b309417c-252e-4c55-b2c5-302dc1bb90f2.mp4
Video 2 (incorrect behaviour, iPhone 12 iOS 15.2, after animation is not finished onPageSelected provides previous page number after gesture completed) https://user-images.githubusercontent.com/9297785/149826806-cbab3e2d-93f5-4ebf-a919-8e4b8d75f471.mp4