Skip to content

Commit 9076a8d

Browse files
committed
fix(bottomsheet): android ensure props are set in the right order
1 parent 5eb4efe commit 9076a8d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/bottomsheet/bottomsheet.android.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,12 @@ export class ViewWithBottomSheet extends ViewWithBottomSheetBase {
166166
// prevent hiding the bottom sheet by
167167
const dismissOnDraggingDownSheet = bottomSheetOptions.options?.dismissOnDraggingDownSheet !== false;
168168
behavior.setHideable(dismissOnDraggingDownSheet);
169+
170+
const peekHeight = bottomSheetOptions.options?.peekHeight;
171+
if (peekHeight) {
172+
behavior.setState(com.google.android.material.bottomsheet.BottomSheetBehavior.STATE_COLLAPSED);
173+
behavior.setPeekHeight(Utils.layout.toDevicePixels(peekHeight));
174+
}
169175
if (!dismissOnDraggingDownSheet) {
170176
// directly expand the bottom sheet after start
171177
behavior.setState(com.google.android.material.bottomsheet.BottomSheetBehavior.STATE_EXPANDED);
@@ -179,11 +185,6 @@ export class ViewWithBottomSheet extends ViewWithBottomSheetBase {
179185
// disable peek/collapsed state
180186
behavior.setSkipCollapsed(true);
181187
}
182-
const peekHeight = bottomSheetOptions.options?.peekHeight;
183-
if (peekHeight) {
184-
behavior.setState(com.google.android.material.bottomsheet.BottomSheetBehavior.STATE_COLLAPSED);
185-
behavior.setPeekHeight(Utils.layout.toDevicePixels(peekHeight));
186-
}
187188

188189
const onChangeState = bottomSheetOptions.options?.onChangeState;
189190
if (onChangeState) {

0 commit comments

Comments
 (0)