-
Notifications
You must be signed in to change notification settings - Fork 419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
onPageScroll not update position when handle by two touch (IOS) #832
Comments
What version of library and react native are you using? Can you reproduce the issue in example app? |
react-native-pager-view: 6.3.1 I have expo test, you can check here: https://snack.expo.dev/@jameheller98/test-gesture |
Please reproduce it on example app, as in the snack you provided you used nested TabView component inside another TabView. |
@MrRefactor
NestedScrollableHost.kt private fun handleInterceptTouchEvent(e: MotionEvent) {
val orientation = parentViewPager?.orientation ?: return
if (!canChildScroll(orientation, -1f) && !canChildScroll(orientation, 1f)) {
return
}
if (e.action == MotionEvent.ACTION_DOWN && isPreventScrollGesture) {
initialX = e.x
initialY = e.y
parent.requestDisallowInterceptTouchEvent(true)
} else if (e.action == MotionEvent.ACTION_MOVE && isPreventScrollGesture) {
val dx = e.x - initialX
val dy = e.y - initialY
val isVpHorizontal = orientation == ORIENTATION_HORIZONTAL
val scaledDx = dx.absoluteValue * if (isVpHorizontal) .5f else 1f
val scaledDy = dy.absoluteValue * if (isVpHorizontal) 1f else .5f
if (scaledDx > touchSlop || scaledDy > touchSlop) {
if (isVpHorizontal == (scaledDy > scaledDx)) {
// Here is reason
parent.requestDisallowInterceptTouchEvent(false)
} else {
if (canChildScroll(orientation, if (isVpHorizontal) dx else dy)) {
parent.requestDisallowInterceptTouchEvent(true)
} else {
// Here is reason
parent.requestDisallowInterceptTouchEvent(false)
}
}
}
}
} You can check here why when I nested tabview and tabview nested cannot use react-native-gesture-handler |
Environment
product, develop
Description
When keep scroll by first touch and use another touch to scroll to next page, page is keep position but onPageScroll return props "position" not updated and return to 0
Reproducible Demo
IMG_4125.MP4
The text was updated successfully, but these errors were encountered: