diff --git a/ios/RNIModalSheetView/RNIModalSheetViewDelegate.swift b/ios/RNIModalSheetView/RNIModalSheetViewDelegate.swift index 8637b148..3a0a23e2 100644 --- a/ios/RNIModalSheetView/RNIModalSheetViewDelegate.swift +++ b/ios/RNIModalSheetView/RNIModalSheetViewDelegate.swift @@ -35,7 +35,9 @@ public final class RNIModalSheetViewDelegate: UIView, RNIContentView { }; public static var propKeyPathMap: PropKeyPathMap { - return [:]; + return [ + "shouldAllowDismissalViaGesture": \.shouldAllowDismissalViaGesture, + ]; }; // MARK: Properties @@ -55,7 +57,13 @@ public final class RNIModalSheetViewDelegate: UIView, RNIContentView { // ------------------------ public var reactProps: NSDictionary = [:]; - + + public var shouldAllowDismissalViaGesture: Bool = true { + willSet { + self.modalSheetController?.shouldAllowDismissal = newValue; + } + }; + // MARK: Init // ---------- @@ -80,6 +88,7 @@ public final class RNIModalSheetViewDelegate: UIView, RNIContentView { modalVC.mainSheetContentParent = mainSheetContentParent; modalVC.view.backgroundColor = .systemBackground; + modalVC.shouldAllowDismissal = self.shouldAllowDismissalViaGesture; modalVC.lifecycleEventDelegates.add(self); modalVC.modalLifecycleEventDelegates.add(self); diff --git a/ios/RNIModalSheetView/RNIModalSheetViewManager.mm b/ios/RNIModalSheetView/RNIModalSheetViewManager.mm index 0a1459ed..86488a77 100644 --- a/ios/RNIModalSheetView/RNIModalSheetViewManager.mm +++ b/ios/RNIModalSheetView/RNIModalSheetViewManager.mm @@ -28,6 +28,8 @@ - (UIView *)view return [[RNIModalSheetView new] initWithBridge:self.bridge]; } +RNI_EXPORT_VIEW_PROPERTY(shouldAllowDismissalViaGesture, BOOL); + RNI_EXPORT_VIEW_EVENT(onDidSetViewID, RCTBubblingEventBlock) RNI_EXPORT_VIEW_EVENT(onModalWillPresent, RCTBubblingEventBlock); diff --git a/src/components/ModalSheetView/ModalSheetViewTypes.tsx b/src/components/ModalSheetView/ModalSheetViewTypes.tsx index f40a6b71..0a275d4a 100644 --- a/src/components/ModalSheetView/ModalSheetViewTypes.tsx +++ b/src/components/ModalSheetView/ModalSheetViewTypes.tsx @@ -31,6 +31,7 @@ export type ModalSheetViewRef = & ModalSheetViewRefInheritedRemapped; export type ModalSheetViewInheritedProps = Pick; diff --git a/src/native_components/RNIModalSheetVIew/RNIModalSheetViewTypes.ts b/src/native_components/RNIModalSheetVIew/RNIModalSheetViewTypes.ts index 47c68cd6..364b1e36 100644 --- a/src/native_components/RNIModalSheetVIew/RNIModalSheetViewTypes.ts +++ b/src/native_components/RNIModalSheetVIew/RNIModalSheetViewTypes.ts @@ -27,6 +27,9 @@ export type RNIModalSheetViewRef = { }; export type RNIModalSheetViewInheritedOptionalProps = Partial