react-native-pager-view icon indicating copy to clipboard operation
react-native-pager-view copied to clipboard

fix: adjust `canChildScroll` based on `scrollEnabled`

Open lanpai opened this issue 2 years ago • 2 comments

Summary

Currently when disabling scroll using the scrollEnabled prop, the pager still consumes user inputs on Android. This adjusts NestedScrollableHost such that that it no longer consumes touch events when isUserInputEnabled is disabled on the child pager by the scrollEnabled prop.

Test Plan

What's required for testing (prerequisites)?

A set up with two nested pagers aligned in the same direction on an Android device.

On iOS, expected behavior works correctly.

What are the steps to reproduce (after prerequisites)?

Attempt to scroll a multi-page pager via touch when it's nested inside of another pager on the same axis in a direction where there's an available page. Previously, this would prevent both pagers from scrolling when the parent pager has scrollEnabled=true and the child pager has scrollEnabled=false. Now, it disables event handling on the child pager allowing the parent pager to scroll.

Compatibility

OS Implemented
iOS N/A
Android

Checklist

  • [x] I have tested this on a device and a simulator
  • [ ] I added the documentation in README.md
  • [ ] I updated the typed files (TS and Flow)

lanpai avatar Mar 16 '23 23:03 lanpai

Hey @lanpai Thank you for submitting a PR. Could you provide a simple code snippet, which I will be able to reproduce it?

troZee avatar Mar 24 '23 12:03 troZee

I've experienced the same problem and workarounded by the exact same change using patch-package. This should definitely be merged to match behavior between iOS and Android.

yuhr avatar Oct 12 '23 10:10 yuhr