Skip to content

Commit a7a234b

Browse files
Material Design Teamleticiarossi
authored andcommitted
[Bottom Sheet] Prevents nested scroll from occurring in a scroll session when the bottom sheet is already being resized.
Previously, the bottom sheet could be fixed at any height while resizing it by triggering a fling in the opposite direction. PiperOrigin-RevId: 628170687
1 parent 373008a commit a7a234b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/java/com/google/android/material/bottomsheet/BottomSheetBehavior.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,10 @@ public void onNestedPreScroll(
748748
int currentTop = child.getTop();
749749
int newTop = currentTop - dy;
750750
if (dy > 0) { // Upward swipe
751-
if (!draggableOnNestedScroll && target == scrollingChild && target.canScrollVertically(1)) {
751+
if (!nestedScrolled
752+
&& !draggableOnNestedScroll
753+
&& target == scrollingChild
754+
&& target.canScrollVertically(1)) {
752755
// Prevent dragging if draggableOnNestedScroll=false and we can scroll the scrolling child.
753756
draggableOnNestedScrollLastDragIgnored = true;
754757
return;
@@ -769,7 +772,7 @@ public void onNestedPreScroll(
769772
}
770773
} else if (dy < 0) { // Downward swipe
771774
boolean canScrollUp = target.canScrollVertically(-1);
772-
if (!draggableOnNestedScroll && target == scrollingChild && canScrollUp) {
775+
if (!nestedScrolled && !draggableOnNestedScroll && target == scrollingChild && canScrollUp) {
773776
// Prevent dragging if draggableOnNestedScroll=false and we can scroll the scrolling child.
774777
draggableOnNestedScrollLastDragIgnored = true;
775778
return;

0 commit comments

Comments
 (0)