add event to ios

This commit is contained in:
Hailey
2024-10-02 18:05:57 -07:00
parent 7ee865f75d
commit 7489a70735
2 changed files with 18 additions and 2 deletions
@@ -10,8 +10,9 @@ public class BottomSheetModule: Module {
View(SheetView.self) {
Events([
"onAttemptDismiss",
"onSnapPointChange",
"onStateChange",
"onAttemptDismiss"
])
AsyncFunction("dismiss") { (view: SheetView) in
+16 -1
View File
@@ -7,8 +7,9 @@ class SheetView: ExpoView, UISheetPresentationControllerDelegate {
private var innerView: UIView?
// Events
private let onStateChange = EventDispatcher()
private let onAttemptDismiss = EventDispatcher()
private let onSnapPointChange = EventDispatcher()
private let onStateChange = EventDispatcher()
// Open event firing
private var isOpen: Bool = false {
@@ -158,4 +159,18 @@ class SheetView: ExpoView, UISheetPresentationControllerDelegate {
func presentationControllerDidDismiss(_ presentationController: UIPresentationController) {
self.destroy()
}
func sheetPresentationControllerDidChangeSelectedDetentIdentifier(_ sheetPresentationController: UISheetPresentationController) {
let identifier = sheetPresentationController.selectedDetentIdentifier
if identifier == .large {
onSnapPointChange([
"snapPoint": 2,
])
} else {
onSnapPointChange([
"snapPoint": 1,
])
}
}
}