Skip to content

Commit 2818b70

Browse files
committed
fix(bottomsheet): ios fix for peekHeight + doc
1 parent 6982500 commit 2818b70

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

packages/bottomsheet/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export interface BottomSheetOptions {
6969
skipCollapsedState?: boolean;
7070
// optional Android parameter to skip midway state when view is greater than 50%. Default is false
7171
peekHeight?: number;
72-
// optional parameter to set the collapsed sheet height. To work on iOS you need to set trackingScrollView.
72+
// optional parameter to set the collapsed sheet height. To work on iOS you need to set trackingScrollView. Also ensure the scrollView is taking the full height of the bottomsheet content. Otherwise the "full" height wont be computed correctly
7373
ignoreKeyboardHeight?: boolean;
7474
//(iOS only) A Boolean value that controls whether the height of the keyboard should affect the bottom sheet's frame when the keyboard shows on the screen. (Default: true)
7575
onChangeState?: onChangeStateBottomSheet;

src/bottomsheet/bottomsheet.ios.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,16 +393,18 @@ export class ViewWithBottomSheet extends ViewWithBottomSheetBase {
393393
bottomSheet.dismissOnBackgroundTap = options.dismissOnBackgroundTap !== false;
394394
bottomSheet.dismissOnDraggingDownSheet = options.dismissOnDraggingDownSheet !== false;
395395

396+
const presentationController = bottomSheet.presentationController as MDCBottomSheetPresentationController;
396397
const peekHeight = options.peekHeight;
397398
if (peekHeight) {
398-
(bottomSheet.presentationController as MDCBottomSheetPresentationController).preferredSheetHeight = peekHeight;
399+
presentationController.preferredSheetHeight = peekHeight;
399400
}
400-
(bottomSheet.presentationController as MDCBottomSheetPresentationController).ignoreKeyboardHeight = options.ignoreKeyboardHeight !== false;
401+
presentationController.ignoreKeyboardHeight = options.ignoreKeyboardHeight !== false;
402+
const skipCollapsedState = options?.skipCollapsedState === true;
401403

402404
if (options.trackingScrollView) {
403405
const scrollView = this.getViewById(options.trackingScrollView);
404406
if (scrollView && scrollView.nativeViewProtected instanceof UIScrollView) {
405-
bottomSheet.trackingScrollView = scrollView.nativeViewProtected;
407+
presentationController.trackingScrollView = scrollView.nativeViewProtected;
406408
}
407409
}
408410
controller.nsAnimated = true;

src/typings/MaterialComponents.ios.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,6 +1217,8 @@ declare class MDCButton extends UIButton implements MDCElevatable, MDCElevationO
12171217

12181218
static appearanceWhenContainedInInstancesOfClasses(containerTypes: NSArray<typeof NSObject> | typeof NSObject[]): MDCButton; // inherited from UIAppearance
12191219

1220+
static buttonWithConfigurationPrimaryAction(configuration: UIButtonConfiguration, primaryAction: UIAction): MDCButton; // inherited from UIButton
1221+
12201222
static buttonWithType(buttonType: UIButtonType): MDCButton; // inherited from UIButton
12211223

12221224
static buttonWithTypePrimaryAction(buttonType: UIButtonType, primaryAction: UIAction): MDCButton; // inherited from UIButton
@@ -2033,6 +2035,8 @@ declare class MDCFlatButton extends MDCButton {
20332035

20342036
static appearanceWhenContainedInInstancesOfClasses(containerTypes: NSArray<typeof NSObject> | typeof NSObject[]): MDCFlatButton; // inherited from UIAppearance
20352037

2038+
static buttonWithConfigurationPrimaryAction(configuration: UIButtonConfiguration, primaryAction: UIAction): MDCFlatButton; // inherited from UIButton
2039+
20362040
static buttonWithType(buttonType: UIButtonType): MDCFlatButton; // inherited from UIButton
20372041

20382042
static buttonWithTypePrimaryAction(buttonType: UIButtonType, primaryAction: UIAction): MDCFlatButton; // inherited from UIButton
@@ -2062,6 +2066,8 @@ declare class MDCFloatingButton extends MDCButton {
20622066

20632067
static appearanceWhenContainedInInstancesOfClasses(containerTypes: NSArray<typeof NSObject> | typeof NSObject[]): MDCFloatingButton; // inherited from UIAppearance
20642068

2069+
static buttonWithConfigurationPrimaryAction(configuration: UIButtonConfiguration, primaryAction: UIAction): MDCFloatingButton; // inherited from UIButton
2070+
20652071
static buttonWithType(buttonType: UIButtonType): MDCFloatingButton; // inherited from UIButton
20662072

20672073
static buttonWithTypePrimaryAction(buttonType: UIButtonType, primaryAction: UIAction): MDCFloatingButton; // inherited from UIButton
@@ -3038,6 +3044,8 @@ declare class MDCRaisedButton extends MDCButton {
30383044

30393045
static appearanceWhenContainedInInstancesOfClasses(containerTypes: NSArray<typeof NSObject> | typeof NSObject[]): MDCRaisedButton; // inherited from UIAppearance
30403046

3047+
static buttonWithConfigurationPrimaryAction(configuration: UIButtonConfiguration, primaryAction: UIAction): MDCRaisedButton; // inherited from UIButton
3048+
30413049
static buttonWithType(buttonType: UIButtonType): MDCRaisedButton; // inherited from UIButton
30423050

30433051
static buttonWithTypePrimaryAction(buttonType: UIButtonType, primaryAction: UIAction): MDCRaisedButton; // inherited from UIButton

0 commit comments

Comments
 (0)