From 33c9006666d5238bc825b7421b12eebb8b49cf81 Mon Sep 17 00:00:00 2001 From: SzymczakJ Date: Tue, 31 Mar 2026 20:18:57 +0200 Subject: [PATCH] add workaround for modal screens animating their children --- .../ComponentViews/Text/RCTParagraphComponentView.mm | 11 +++++++++++ .../Fabric/Mounting/UIView+ComponentViewProtocol.mm | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm index 9fb3400d90cd..229daf187b73 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm @@ -374,6 +374,17 @@ @implementation RCTParagraphTextView { CAShapeLayer *_highlightLayer; } +// TODO(szymczak): this is temporary fix for +// https://app.asana.com/1/236888843494340/project/1199705967702853/list/1204187545226790, +// we should remove this after we find a better solution +- (id)actionForLayer:(CALayer *)layer forKey:(NSString *)event +{ + // Disable all implicit animations on this layer to prevent unwanted + // scale/position animations when a modal presentation's animation context + // is active (UIKit's presentViewController:animated:YES). + return (id)[NSNull null]; +} + - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { return nil; diff --git a/packages/react-native/React/Fabric/Mounting/UIView+ComponentViewProtocol.mm b/packages/react-native/React/Fabric/Mounting/UIView+ComponentViewProtocol.mm index 9f50554560e5..b69f99af3c80 100644 --- a/packages/react-native/React/Fabric/Mounting/UIView+ComponentViewProtocol.mm +++ b/packages/react-native/React/Fabric/Mounting/UIView+ComponentViewProtocol.mm @@ -11,6 +11,8 @@ #import #import +#import + #import "RCTConversions.h" using namespace facebook::react; @@ -103,8 +105,14 @@ - (void)updateLayoutMetrics:(const LayoutMetrics &)layoutMetrics } else { // Note: Changing `frame` when `layer.transform` is not the `identity transform` is undefined behavior. // Therefore, we must use `center` and `bounds`. + // TODO(szymczak): this is temporary fix for + // https://app.asana.com/1/236888843494340/project/1199705967702853/list/1204187545226790, + // we should remove this after we find a better solution + [CATransaction begin]; + [CATransaction setDisableActions:YES]; self.center = CGPoint{CGRectGetMidX(frame), CGRectGetMidY(frame)}; self.bounds = CGRect{CGPointZero, frame.size}; + [CATransaction commit]; } }