diff --git a/ios/RNIModalSheetView/RNIModalSheetViewDelegate.swift b/ios/RNIModalSheetView/RNIModalSheetViewDelegate.swift index 3a0a23e..9523646 100644 --- a/ios/RNIModalSheetView/RNIModalSheetViewDelegate.swift +++ b/ios/RNIModalSheetView/RNIModalSheetViewDelegate.swift @@ -36,6 +36,7 @@ public final class RNIModalSheetViewDelegate: UIView, RNIContentView { public static var propKeyPathMap: PropKeyPathMap { return [ + "reactChildrenCount": \.reactChildrenCountProp, "shouldAllowDismissalViaGesture": \.shouldAllowDismissalViaGesture, ]; }; @@ -58,6 +59,21 @@ public final class RNIModalSheetViewDelegate: UIView, RNIContentView { public var reactProps: NSDictionary = [:]; + public var reactChildrenCount: Int = 0; + var reactChildrenCountProp: NSNumber = 0 { + willSet { + let oldCount = self.reactChildrenCount; + let newCount = newValue.intValue; + + guard oldCount != newCount else { + return; + }; + + self.reactChildrenCount = newCount; + // TODO: Add code for verifying child count before presenting + } + }; + public var shouldAllowDismissalViaGesture: Bool = true { willSet { self.modalSheetController?.shouldAllowDismissal = newValue; diff --git a/ios/RNIModalSheetView/RNIModalSheetViewManager.mm b/ios/RNIModalSheetView/RNIModalSheetViewManager.mm index 86488a7..dd1928c 100644 --- a/ios/RNIModalSheetView/RNIModalSheetViewManager.mm +++ b/ios/RNIModalSheetView/RNIModalSheetViewManager.mm @@ -28,6 +28,7 @@ - (UIView *)view return [[RNIModalSheetView new] initWithBridge:self.bridge]; } +RNI_EXPORT_VIEW_PROPERTY(reactChildrenCount, NSNumber); RNI_EXPORT_VIEW_PROPERTY(shouldAllowDismissalViaGesture, BOOL); RNI_EXPORT_VIEW_EVENT(onDidSetViewID, RCTBubblingEventBlock) diff --git a/src/native_components/RNIModalSheetVIew/RNIModalSheetViewNativeComponent.ts b/src/native_components/RNIModalSheetVIew/RNIModalSheetViewNativeComponent.ts index eb5f135..1017141 100644 --- a/src/native_components/RNIModalSheetVIew/RNIModalSheetViewNativeComponent.ts +++ b/src/native_components/RNIModalSheetVIew/RNIModalSheetViewNativeComponent.ts @@ -6,10 +6,13 @@ import type { HostComponent, ViewProps } from 'react-native'; // stubs export interface NativeProps extends ViewProps { // props + reactChildrenCount: Int32; shouldAllowDismissalViaGesture?: boolean; + // common/shared events onDidSetViewID?: BubblingEventHandler<{}>; + // common modal events onModalWillPresent?: BubblingEventHandler<{}>; onModalDidPresent?: BubblingEventHandler<{}>; @@ -18,14 +21,13 @@ export interface NativeProps extends ViewProps { onModalWillShow?: BubblingEventHandler<{}>; onModalDidShow?: BubblingEventHandler<{}>; + onModalWillHide?: BubblingEventHandler<{}>; onModalDidHide?: BubblingEventHandler<{}>; + // events onModalSheetStateWillChange?: BubblingEventHandler<{}>; onModalSheetStateDidChange?: BubblingEventHandler<{}>; - - // value prop stubs - reactChildrenCount: Int32; }; // stubs