about summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
authorHailey <me@haileyok.com>2024-10-06 12:03:06 -0700
committerGitHub <noreply@github.com>2024-10-06 12:03:06 -0700
commit686dfa5f782ba66796175c428c8a906fa3a4350a (patch)
tree0ce8a10f3aec8f57d8c0736604cf406a28da414c /modules
parent0ebf6366523c2edb1ca2a2ca6a2a610ec135371e (diff)
downloadvoidsky-686dfa5f782ba66796175c428c8a906fa3a4350a.tar.zst
Fix bounce when expanding sheet on ios (#5627)
Diffstat (limited to 'modules')
-rw-r--r--modules/bottom-sheet/ios/SheetView.swift7
-rw-r--r--modules/bottom-sheet/ios/SheetViewController.swift2
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