From d0ea1874cb4e9c4414f7d2267a1c593200cbb588 Mon Sep 17 00:00:00 2001 From: Lamine Male <106181067+laminesm@users.noreply.github.com> Date: Wed, 20 Nov 2024 09:24:00 -0800 Subject: [PATCH] Don't recreate buttons --- .../Pill Button Bar/PillButtonBar.swift | 29 ------------------- 1 file changed, 29 deletions(-) diff --git a/Sources/FluentUI_iOS/Components/Pill Button Bar/PillButtonBar.swift b/Sources/FluentUI_iOS/Components/Pill Button Bar/PillButtonBar.swift index 2c8e01795a..224ccccc16 100644 --- a/Sources/FluentUI_iOS/Components/Pill Button Bar/PillButtonBar.swift +++ b/Sources/FluentUI_iOS/Components/Pill Button Bar/PillButtonBar.swift @@ -81,20 +81,6 @@ open class PillButtonBar: UIScrollView { } } - public override var bounds: CGRect { - didSet { - if bounds.width > 0, lastKnownScrollFrameWidth > 0, bounds.width != lastKnownScrollFrameWidth { - // Frame changes can happen because of rotation, split view or adding the view for the first - // time into a superview. First time layout already has buttons in default sizes, recreate - // them so that the next time we layout subviews we'll recalculate their optimal sizes. - recreateButtons() - stackView.spacing = Constants.minButtonsSpacing - } - - lastKnownScrollFrameWidth = bounds.width - } - } - /// Initializes the PillButtonBar using the provided style. /// /// - Parameters: @@ -207,8 +193,6 @@ open class PillButtonBar: UIScrollView { private var buttons = [PillButton]() - private var lastKnownScrollFrameWidth: CGFloat = 0.0 - private var needsButtonSizeReconfiguration: Bool = false private var selectedButton: PillButton? { @@ -394,19 +378,6 @@ open class PillButtonBar: UIScrollView { return nil } - private func recreateButtons() { - let selectedItem = selectedButton?.pillBarItem - selectedButton = nil - - let currentItems = items - items = nil - items = currentItems - - if let selectedItem = selectedItem { - selectItem(selectedItem) - } - } - private func setupScrollView() { if effectiveUserInterfaceLayoutDirection == .rightToLeft { transform = CGAffineTransform(rotationAngle: CGFloat(Double.pi))