From 8661442f69038f7169a3fa6dbbaa80ce561300a3 Mon Sep 17 00:00:00 2001 From: Carter Date: Fri, 22 Nov 2024 13:25:55 -0800 Subject: [PATCH] Fixed crash where minWidth in greater than available width while sheet is animating --- .../Components/Bottom Sheet/BottomSheetController.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sources/FluentUI_iOS/Components/Bottom Sheet/BottomSheetController.swift b/Sources/FluentUI_iOS/Components/Bottom Sheet/BottomSheetController.swift index a0161c5e0..a8049ef27 100644 --- a/Sources/FluentUI_iOS/Components/Bottom Sheet/BottomSheetController.swift +++ b/Sources/FluentUI_iOS/Components/Bottom Sheet/BottomSheetController.swift @@ -871,13 +871,15 @@ public class BottomSheetController: UIViewController, Shadowable, TokenizedContr let availableWidth: CGFloat = view.bounds.width let maxWidth = min(Constants.maxSheetWidth, availableWidth) let determinedWidth: CGFloat + if shouldAlwaysFillWidth { determinedWidth = availableWidth - } else if Constants.minSheetWidth...maxWidth ~= preferredWidth { - determinedWidth = preferredWidth + } else if maxWidth > Constants.minSheetWidth { + determinedWidth = Constants.minSheetWidth...maxWidth ~= preferredWidth ? preferredWidth : maxWidth } else { determinedWidth = maxWidth } + return determinedWidth }