From 41cb92b3454246ca5ee6b1313c4ffe815810750a Mon Sep 17 00:00:00 2001 From: Wendy Date: Wed, 1 Oct 2025 09:29:35 +0200 Subject: [PATCH] bugfix(openmodal) fix building issue by adding if statements in mounting and unmounting children --- ios/Fabric/RNTModalViewComponentView.mm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ios/Fabric/RNTModalViewComponentView.mm b/ios/Fabric/RNTModalViewComponentView.mm index 8db6182..14e9b3e 100644 --- a/ios/Fabric/RNTModalViewComponentView.mm +++ b/ios/Fabric/RNTModalViewComponentView.mm @@ -52,7 +52,9 @@ - (instancetype)initWithFrame:(CGRect)frame - (void)mountChildComponentView:(UIView *)childComponentView index:(NSInteger)index { - [self.touchHandler attachToView:childComponentView]; + if (self.touchHandler.view != nil && self.touchHandler.view != childComponentView) { + [self.touchHandler attachToView:childComponentView]; + } [self.mountingHelper updateChildrenTransaction:^{ [self.modalViewController addReactSubview:childComponentView]; }]; @@ -60,7 +62,9 @@ - (void)mountChildComponentView:(UIView *)childCompone - (void)unmountChildComponentView:(UIView *)childComponentView index:(NSInteger)index { - [self.touchHandler detachFromView:childComponentView]; + if (self.touchHandler.view == childComponentView) { + [self.touchHandler detachFromView:childComponentView]; + } [self.mountingHelper unmountIfNeeded]; [childComponentView removeFromSuperview]; }