diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.h b/packages/react-native/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.h index 27ee3d6305b..a869b9ad714 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.h +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.h @@ -10,7 +10,7 @@ /** * UIView class for root component. */ -@interface RCTModalHostViewComponentView : RCTViewComponentView +@interface RCTModalHostViewComponentView : RCTViewComponentView /** * Subclasses may override this method and present the modal on different view controller. diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm index 350439a7810..9205fa3d211 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm @@ -149,6 +149,8 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct( { BOOL shouldBePresented = !_isPresented && _shouldPresent && self.window; if (shouldBePresented) { + self.viewController.presentationController.delegate = self; + _isPresented = YES; [self presentViewController:self.viewController animated:_shouldAnimatePresentation @@ -274,6 +276,16 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct( [childComponentView removeFromSuperview]; } +#pragma mark - UIAdaptivePresentationControllerDelegate + +- (void)presentationControllerDidAttemptToDismiss:(UIPresentationController *)controller +{ + auto eventEmitter = [self modalEventEmitter]; + if (eventEmitter) { + eventEmitter->onRequestClose({}); + } +} + @end #ifdef __cplusplus