Skip to content

Commit

Permalink
Revert "Calculate Bottom Commanding header height instead of using co…
Browse files Browse the repository at this point in the history
…nstant (microsoft#2041)"

This reverts commit d298dac.
  • Loading branch information
joannaquu committed Jul 17, 2024
1 parent 7d00d6a commit bc9d475
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ class BottomCommandingDemoController: DemoController {

private lazy var heroItems: [CommandingItem] = {
return Array(1...25).map {
let title = ($0 == 4) ? "Two line item" : "Item"
let item = CommandingItem(title: title + String($0), image: homeImage, action: commandAction)
let item = CommandingItem(title: "Item " + String($0), image: homeImage, action: commandAction)
item.selectedImage = homeSelectedImage
item.isOn = ($0 % 3 == 1)
item.isEnabled = ($0 % 2 == 1)
Expand Down
15 changes: 6 additions & 9 deletions ios/FluentUI/Bottom Commanding/BottomCommandingController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ open class BottomCommandingController: UIViewController, TokenizedControlInterna
headerView.addSubview(heroCommandStack)

let sheetController = BottomSheetController(headerContentView: headerView, expandedContentView: makeSheetExpandedContent(with: tableView))
sheetController.headerContentHeight = Constants.BottomSheet.headerHeight
sheetController.hostedScrollView = tableView
sheetController.isHidden = isHidden
sheetController.shouldAlwaysFillWidth = sheetShouldAlwaysFillWidth
Expand Down Expand Up @@ -533,7 +534,6 @@ open class BottomCommandingController: UIViewController, TokenizedControlInterna
} else {
tableView.tableHeaderView = nil
}
calculateHeaderHeight()
}

private func reloadHeroCommandOverflowStack() {
Expand Down Expand Up @@ -563,13 +563,6 @@ open class BottomCommandingController: UIViewController, TokenizedControlInterna
}
}

@discardableResult
private func calculateHeaderHeight() -> CGFloat {
let headerHeight = heroCommandStack.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize).height + BottomSheetController.resizingHandleHeight
bottomSheetController?.headerContentHeight = headerHeight
return headerHeight
}

private func updateAppearance() {
guard isViewLoaded else {
return
Expand Down Expand Up @@ -930,7 +923,7 @@ open class BottomCommandingController: UIViewController, TokenizedControlInterna
let headerHeightWithoutBottomWhitespace = BottomCommandingTokenSet.handleHeaderHeight + maxHeroItemHeight

// How much more whitespace is required at the bottom of the sheet header
let requiredBottomWhitespace = max(0, calculateHeaderHeight() - headerHeightWithoutBottomWhitespace)
let requiredBottomWhitespace = max(0, Constants.BottomSheet.headerHeight - headerHeightWithoutBottomWhitespace)

// The safe area inset can fulfill some or all of our bottom whitespace requirement.
// This is how much more we need, taking the inset into account.
Expand Down Expand Up @@ -1125,6 +1118,10 @@ open class BottomCommandingController: UIViewController, TokenizedControlInterna
static let moreButtonIcon: UIImage? = UIImage.staticImageNamed("more-24x24")
static let moreButtonTitle: String = "CommandingBottomBar.More".localized
}

struct BottomSheet {
static let headerHeight: CGFloat = 66
}
}
}

Expand Down

0 comments on commit bc9d475

Please sign in to comment.