Skip to content

Commit

Permalink
No third_party test failures/diff. Internal change.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 592315194
  • Loading branch information
Nobody authored and material-automation committed Dec 19, 2023
1 parent c4c73b5 commit 9d7f56c
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions components/BottomNavigation/src/MDCBottomNavigationBar.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#import <CoreGraphics/CoreGraphics.h>
#import <Foundation/Foundation.h>

#import "MDCBottomNavigationBar.h"
#import "MDCAvailability.h"
#import "MDCBottomNavigationBar.h"
#import "UIView+MaterialElevationResponding.h"

#import "private/MDCBottomNavigationBar+Private.h"
Expand Down Expand Up @@ -383,6 +383,11 @@ - (CGFloat)calculateBarHeight {
return height;
}

- (void)recalculateBarHeightAndUpdateLayout {
_itemsLayoutViewHeightConstraint.constant = [self calculateBarHeight];
[self setNeedsLayout];
}

- (void)setEnableVerticalLayout:(BOOL)enableVerticalLayout {
if (_enableVerticalLayout == enableVerticalLayout) {
return;
Expand Down Expand Up @@ -623,6 +628,11 @@ - (void)traitCollectionDidChange:(nullable UITraitCollection *)previousTraitColl
if (self.traitCollectionDidChangeBlock) {
self.traitCollectionDidChangeBlock(self, previousTraitCollection);
}

if (self.traitCollection.verticalSizeClass != previousTraitCollection.verticalSizeClass ||
self.traitCollection.horizontalSizeClass != previousTraitCollection.horizontalSizeClass) {
[self recalculateBarHeightAndUpdateLayout];
}
}

#pragma mark - Touch handlers
Expand Down Expand Up @@ -872,9 +882,7 @@ - (void)setAlignment:(MDCBottomNavigationBarAlignment)alignment {
for (MDCBottomNavigationItemView *itemView in self.itemViews) {
[self configureTitleStateForItemView:itemView];
}
[self invalidateIntrinsicContentSize];
[self setNeedsLayout];
_itemsLayoutViewHeightConstraint.constant = [self calculateBarHeight];
[self recalculateBarHeightAndUpdateLayout];
}

- (void)setShowsSelectionIndicator:(BOOL)showsSelectionIndicator {
Expand Down

0 comments on commit 9d7f56c

Please sign in to comment.