From 5f656314d0046ee3bc2c0ba13eb0020ba60b900f Mon Sep 17 00:00:00 2001 From: cbowdoin <81586105+cbowdoin@users.noreply.github.com> Date: Mon, 16 Dec 2024 16:06:49 -0800 Subject: [PATCH] Fixed crash where minWidth in greater than available width while sheet is animating (#2110) --- .../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 }