diff options
author | Hailey <me@haileyok.com> | 2024-10-06 12:03:06 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-06 12:03:06 -0700 |
commit | 686dfa5f782ba66796175c428c8a906fa3a4350a (patch) | |
tree | 0ce8a10f3aec8f57d8c0736604cf406a28da414c /modules | |
parent | 0ebf6366523c2edb1ca2a2ca6a2a610ec135371e (diff) | |
download | voidsky-686dfa5f782ba66796175c428c8a906fa3a4350a.tar.zst |
Fix bounce when expanding sheet on ios (#5627)
Diffstat (limited to 'modules')
-rw-r--r-- | modules/bottom-sheet/ios/SheetView.swift | 7 | ||||
-rw-r--r-- | modules/bottom-sheet/ios/SheetViewController.swift | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/modules/bottom-sheet/ios/SheetView.swift b/modules/bottom-sheet/ios/SheetView.swift index cf2019c6a..2223a5a8c 100644 --- a/modules/bottom-sheet/ios/SheetView.swift +++ b/modules/bottom-sheet/ios/SheetView.swift @@ -66,6 +66,7 @@ class SheetView: ExpoView, UISheetPresentationControllerDelegate { } } } + private var prevLayoutDetentIdentifier: UISheetPresentationController.Detent.Identifier? // MARK: - Lifecycle @@ -143,11 +144,13 @@ class SheetView: ExpoView, UISheetPresentationControllerDelegate { } func updateLayout() { - if let contentHeight = self.innerView?.subviews.first?.frame.size.height { + if self.prevLayoutDetentIdentifier == self.selectedDetentIdentifier, + let contentHeight = self.innerView?.subviews.first?.frame.size.height { self.sheetVc?.updateDetents(contentHeight: self.clampHeight(contentHeight), - preventExpansion: self.preventExpansion) + preventExpansion: self.preventExpansion) self.selectedDetentIdentifier = self.sheetVc?.getCurrentDetentIdentifier() } + self.prevLayoutDetentIdentifier = self.selectedDetentIdentifier } func dismiss() { diff --git a/modules/bottom-sheet/ios/SheetViewController.swift b/modules/bottom-sheet/ios/SheetViewController.swift index 56473b21c..7b6606980 100644 --- a/modules/bottom-sheet/ios/SheetViewController.swift +++ b/modules/bottom-sheet/ios/SheetViewController.swift @@ -62,7 +62,7 @@ class SheetViewController: UIViewController { } } } - + func getCurrentDetentIdentifier() -> UISheetPresentationController.Detent.Identifier? { guard let sheet = self.sheetPresentationController else { return nil |