material-components-android icon indicating copy to clipboard operation
material-components-android copied to clipboard

[BottomSheetBehavior] Fix issue with nested scrolling child views

Open UdaraWanasinghe opened this issue 2 years ago • 2 comments
trafficstars

Fixes #3377

Root cause BottomSheetBehavior stores the reference of the nestedScrollingChild view but it only sets this reference during the layout pass. When this nested scrolling child view is inside another scrollable view and the scroll position changes, the BottomSheetBehavior doesn't see this change and it compares if the touched point is inside the nestedScrollingChild with the old view reference. This results in touch events not propagating to the descendent views.

How PR fixes it Instead of setting nested scrolling child reference in the layout pass, I changed to set it during the touch-down event. Additionally, it will be checked if the touch-down point is inside the nested scrolling child view.

UdaraWanasinghe avatar May 05 '23 16:05 UdaraWanasinghe

Would this also resolve #2885? They seem like very similar classes of issues.

OxygenCobalt avatar Sep 10 '23 20:09 OxygenCobalt

@OxygenCobalt This fix does not resolve your issue. You only have to get the coordinator layout of the nested bottom sheet and set isNestedScrollingEnabled to true.

UdaraWanasinghe avatar Sep 11 '23 06:09 UdaraWanasinghe