Skip to content

Commit

Permalink
[NavigationDrawer] Fix #9410 (#9411)
Browse files Browse the repository at this point in the history
Fix bug where scrim color is set to `nil` by the presentation controller if it has not been explicitly set on the `MDCBottomDrawerViewController`.

Testing steps:
1) Present a `MDCBottomDrawerViewController` that has not had it's `scrimColor` explicitly set.
2) Drag `MDCBottomDrawerViewController` fully open or past full screen.
3) Drag `MDCBottomDrawerViewController` back down to partial-screen.
4) Observe that `scrimColor` is preserved at default `[UIColor colorWithWhite:0 alpha:(CGFloat)0.32]`
  • Loading branch information
jakerockland authored and yarneo committed Jan 14, 2020
1 parent d7c2865 commit bcaf187
Showing 1 changed file with 8 additions and 3 deletions.
Expand Up @@ -59,7 +59,9 @@ @interface MDCBottomDrawerPresentationController () <UIGestureRecognizerDelegate

@end

@implementation MDCBottomDrawerPresentationController
@implementation MDCBottomDrawerPresentationController {
UIColor *_scrimColor;
}

@synthesize delegate;

Expand Down Expand Up @@ -123,8 +125,7 @@ - (void)presentationTransitionWillBegin {
self.bottomDrawerContainerViewController.delegate = self;

self.scrimView = [[MDCBottomDrawerScrimView alloc] initWithFrame:self.containerView.bounds];
self.scrimView.backgroundColor =
self.scrimColor ?: [UIColor colorWithWhite:0 alpha:(CGFloat)0.32];
self.scrimView.backgroundColor = self.scrimColor;
self.scrimView.autoresizingMask =
UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.scrimView.accessibilityIdentifier = @"Close drawer";
Expand Down Expand Up @@ -297,6 +298,10 @@ - (void)setScrimColor:(UIColor *)scrimColor {
self.scrimView.backgroundColor = scrimColor;
}

- (UIColor *)scrimColor {
return _scrimColor ?: [UIColor colorWithWhite:0 alpha:(CGFloat)0.32];
}

- (void)setTopHandleHidden:(BOOL)topHandleHidden {
_topHandleHidden = topHandleHidden;
self.topHandle.hidden = topHandleHidden;
Expand Down

0 comments on commit bcaf187

Please sign in to comment.