From cb8d8970a2d4dbcfc35d24e76e2a3bd3dcaa4590 Mon Sep 17 00:00:00 2001 From: Rishi Balakrishnan Date: Mon, 5 Oct 2026 14:33:07 -0400 Subject: [PATCH] fix(bottom-sheet): avoid nil maxHeight crash when no window scene is found Util.getScreenHeight() can return nil, which was stored in an implicitly unwrapped maxHeight during init and trapped in clampHeight. Fall back to the main screen bounds instead. --- modules/bottom-sheet/ios/SheetView.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/bottom-sheet/ios/SheetView.swift b/modules/bottom-sheet/ios/SheetView.swift index 346fe3f41..b403f692b 100644 --- a/modules/bottom-sheet/ios/SheetView.swift +++ b/modules/bottom-sheet/ios/SheetView.swift @@ -32,9 +32,9 @@ class SheetView: ExpoView, UISheetPresentationControllerDelegate { var cornerRadius: CGFloat? var sourceViewTag: Int? var minHeight = 0.0 - var maxHeight: CGFloat! { + var maxHeight: CGFloat = 0 { didSet { - let screenHeight = Util.getScreenHeight() ?? 0 + let screenHeight = Util.getScreenHeight() ?? UIScreen.main.bounds.height if maxHeight > screenHeight { maxHeight = screenHeight } @@ -77,7 +77,7 @@ class SheetView: ExpoView, UISheetPresentationControllerDelegate { required init (appContext: AppContext? = nil) { super.init(appContext: appContext) - self.maxHeight = Util.getScreenHeight() + self.maxHeight = Util.getScreenHeight() ?? UIScreen.main.bounds.height self.touchHandler = RCTTouchHandler(bridge: appContext?.reactBridge) SheetManager.shared.add(self) } -- knotmirror 0.0.1