Closed stackcookie1 closed 7 months ago
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.
Facing the same issue. My workaround is to disable scrolling on onPanResponderGrant, and restore it on onPanResponderRelease.
This is true also on any view, I tried every combination here and nothing can prevent scrolling:
const prevent = (val) => (event) => {
event.stopPropagation()
event.preventDefault()
return val
}
<View
onMoveShouldSetResponderCapture={prevent(true)}
onScrollShouldSetResponder={prevent(true)}
onScrollShouldSetResponderCapture={prevent(true)}
onMoveShouldSetResponder={prevent(true)}
onStartShouldSetResponder={prevent(true)}
onStartShouldSetResponderCapture={prevent(true)}
onResponderTerminationRequest={prevent(false)}
style={{
width: 100,
height: 100,
backgroundColor: 'red',
}}
/>
I'm running into this issue as well.
My workaround is to disable scrolling on onPanResponderGrant, and restore it on onPanResponderRelease.
This is the workaround I've been using, but PanResponder will still terminate if I call scrollTo
on the ScrollView.
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue was closed because it has been stalled for 7 days with no activity.
Description
The PanResponder does not block the ScrollView on iOS. Android works as it should. No matter with which ShouldSet function you want to prevent the responder from being rejected, the ScrollView above the element scrolls anyway.
React Native version:
Steps To Reproduce
1) Create a view in a ScrollView as a child. 2) Now try to move the finger in the view.
Expected Results
Since the PanResponder has control, the ScrollView must not scroll. The event seems to be bubbled.
Snack, code example, screenshot, or link to a repository:
https://snack.expo.dev/fKP048VbJ