From baada4e29905ba576c553d2ed5c8cb4e214d2b0a Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Thu, 19 May 2022 11:48:02 -0700 Subject: [PATCH] Remove shadowview copy in setIsJSResponder Summary: Noticed we were copying ShadowView, where a reference should suffice. Changelog: [Internal] Reviewed By: appden Differential Revision: D36455200 fbshipit-source-id: 2cd3cf66b9e5ec05bce9ce1d739fbed66f3a6d89 --- React/Fabric/Mounting/RCTMountingManager.h | 2 +- React/Fabric/Mounting/RCTMountingManager.mm | 6 +++--- React/Fabric/RCTSurfacePresenter.mm | 8 +++----- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/React/Fabric/Mounting/RCTMountingManager.h b/React/Fabric/Mounting/RCTMountingManager.h index 7f91164376d..d30d297e366 100644 --- a/React/Fabric/Mounting/RCTMountingManager.h +++ b/React/Fabric/Mounting/RCTMountingManager.h @@ -63,7 +63,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)setIsJSResponder:(BOOL)isJSResponder blockNativeResponder:(BOOL)blockNativeResponder - forShadowView:(facebook::react::ShadowView)shadowView; + forShadowView:(facebook::react::ShadowView const &)shadowView; - (void)synchronouslyUpdateViewOnUIThread:(ReactTag)reactTag changedProps:(NSDictionary *)props diff --git a/React/Fabric/Mounting/RCTMountingManager.mm b/React/Fabric/Mounting/RCTMountingManager.mm index 23d57bc42fe..7acc436ec88 100644 --- a/React/Fabric/Mounting/RCTMountingManager.mm +++ b/React/Fabric/Mounting/RCTMountingManager.mm @@ -282,11 +282,11 @@ static void RCTPerformMountInstructions( - (void)setIsJSResponder:(BOOL)isJSResponder blockNativeResponder:(BOOL)blockNativeResponder - forShadowView:(facebook::react::ShadowView)shadowView + forShadowView:(facebook::react::ShadowView const &)shadowView { + ReactTag reactTag = shadowView.tag; RCTExecuteOnMainQueue(^{ - UIView *componentView = - [self->_componentViewRegistry findComponentViewWithTag:shadowView.tag]; + UIView *componentView = [self->_componentViewRegistry findComponentViewWithTag:reactTag]; [componentView setIsJSResponder:isJSResponder]; }); } diff --git a/React/Fabric/RCTSurfacePresenter.mm b/React/Fabric/RCTSurfacePresenter.mm index 75e6b2c9833..65e4c0095e6 100644 --- a/React/Fabric/RCTSurfacePresenter.mm +++ b/React/Fabric/RCTSurfacePresenter.mm @@ -364,7 +364,7 @@ static BackgroundExecutor RCTGetBackgroundExecutor() NSString *commandStr = [[NSString alloc] initWithUTF8String:commandName.c_str()]; NSArray *argsArray = convertFollyDynamicToId(args); - [self->_mountingManager dispatchCommand:tag commandName:commandStr args:argsArray]; + [_mountingManager dispatchCommand:tag commandName:commandStr args:argsArray]; } - (void)schedulerDidSendAccessibilityEvent:(const facebook::react::ShadowView &)shadowView @@ -373,16 +373,14 @@ static BackgroundExecutor RCTGetBackgroundExecutor() ReactTag tag = shadowView.tag; NSString *eventTypeStr = [[NSString alloc] initWithUTF8String:eventType.c_str()]; - [self->_mountingManager sendAccessibilityEvent:tag eventType:eventTypeStr]; + [_mountingManager sendAccessibilityEvent:tag eventType:eventTypeStr]; } - (void)schedulerDidSetIsJSResponder:(BOOL)isJSResponder blockNativeResponder:(BOOL)blockNativeResponder forShadowView:(facebook::react::ShadowView const &)shadowView; { - [self->_mountingManager setIsJSResponder:isJSResponder - blockNativeResponder:blockNativeResponder - forShadowView:shadowView]; + [_mountingManager setIsJSResponder:isJSResponder blockNativeResponder:blockNativeResponder forShadowView:shadowView]; } - (void)addObserver:(id)observer