gy-chen / react_native_vertical_view_pager

10 stars 8 forks source link

animation with quick swipe #1

Open dennisbejencev-an opened 6 years ago

dennisbejencev-an commented 6 years ago

I have modified code: https://pastebin.com/shktNXHk and the wrong behavior you can look on video https://drive.google.com/open?id=17dzSensT9ccLpvevfIxe9wShZQ-_jjnt

it scrolls to wrong place and then come back - it is problem

gy-chen commented 6 years ago

OK, I will try to solve this issue.

dennisbejencev-an commented 6 years ago

@gy-chen Did something figure out? why it so happening? do you have any idea how to fix it?

gy-chen commented 6 years ago

I modified code that try to scroll to correct place according to the distance user scrolled, but I haven't test it yet. https://github.com/gy-chen/react_native_vertical_view_pager/blob/develop/src/component/VerticalViewPager.js

dennisbejencev-an commented 6 years ago

I mean the problem is not in offset, seems that it is in event queue that looks like [userScroll, userScroll, userScroll, userScroll, ourScrollTo], when user make quick scroll very fast was added some scroll events, and pending to our custom scroll to here observing the best. tell me which you have scroll behavior when making quick swipe. When I make quick swipe it fastly scrolling somewhere long away and then come back.

dennisbejencev-an commented 6 years ago

@gy-chen can be this video will explain better that I meant, useless scroll events execute on quick scroll(swipe) https://drive.google.com/open?id=1iWiQWCbjzXRtyI8D0ubvGt3rSfdJ1CjD Do you have an idea how we can prevent them?

gy-chen commented 6 years ago

OnScroll events are received from ScrollView. I think it's not a problem since our component only use it to trigger timer that not related to our custom scrolling behavior. Mainly our custom scrolling behavior occurs in onScrollEndDrag event, the component will try to scroll to the place it calculated when onScrollEndDrag event occurs. Maybe try to use other event to trigger custom scrolling will help.

rizky commented 6 years ago

I encountered this problem as well, but it seems that it only happens on development, once you deploy it, the scroll works as expected.