Skip to content

Commit 31f215a

Browse files
coadometa-codesync[bot]
authored andcommitted
Fix blocking animating non-layout props through commitUpdates after the View was synchronously animated (#55340)
Summary: Pull Request resolved: #55340 This diff fixes edge-case with animating non-layout props through `commitUpdates` path. The non-layout props are animated through the synchronous short-path, skipping yoga layout calculations. In `RCTMountingManager` the `propKeysManagerByAnimated` were set on updated props which are then checked for and blocked in the RCTViewComponentView's `updateProps` method (non-layout props might be applied through the layout path as we animate props in batch that may consists of both types of props). ## Changelog: [iOS][Fixed] - Fixed edge-case with animating non-layout props through the `commitUpdates` path. Reviewed By: zeyap, javache Differential Revision: D91677971 fbshipit-source-id: 75bfc39190d4296ed57d8bbf9970e391461419d0
1 parent dd56bb0 commit 31f215a

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

packages/react-native/React/Fabric/Mounting/RCTMountingManager.mm

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#import <React/RCTLog.h>
1515
#import <React/RCTUtils.h>
1616
#import <cxxreact/TraceSection.h>
17+
#import <react/featureflags/ReactNativeFeatureFlags.h>
1718
#import <react/renderer/components/root/RootShadowNode.h>
1819
#import <react/renderer/core/LayoutableShadowNode.h>
1920
#import <react/renderer/core/RawProps.h>
@@ -286,7 +287,6 @@ - (void)synchronouslyUpdateViewOnUIThread:(ReactTag)reactTag
286287
componentDescriptor:(const ComponentDescriptor &)componentDescriptor
287288
{
288289
RCTAssertMainQueue();
289-
NSArray<NSString *> *propsKeysToBeUpdated = extractKeysFromFollyDynamic(props);
290290
bool updatesTransform = props.find("transform") != props.items().end();
291291
bool updatesOpacity = props.find("opacity") != props.items().end();
292292

@@ -296,13 +296,18 @@ - (void)synchronouslyUpdateViewOnUIThread:(ReactTag)reactTag
296296
return;
297297
}
298298

299+
NSSet<NSString *> *propKeys = componentView.propKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN ?: [NSSet new];
300+
301+
if (!ReactNativeFeatureFlags::useSharedAnimatedBackend()) {
302+
NSArray<NSString *> *propsKeysToBeUpdated = extractKeysFromFollyDynamic(props);
303+
propKeys = [propKeys setByAddingObjectsFromArray:propsKeysToBeUpdated];
304+
}
305+
299306
SurfaceId surfaceId = RCTSurfaceIdForView(componentView);
300307
Props::Shared oldProps = [componentView props];
301308
Props::Shared newProps = componentDescriptor.cloneProps(
302309
PropsParserContext{surfaceId, *_contextContainer}, oldProps, RawProps(std::move(props)));
303310

304-
NSSet<NSString *> *propKeys = componentView.propKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN ?: [NSSet new];
305-
propKeys = [propKeys setByAddingObjectsFromArray:propsKeysToBeUpdated];
306311
componentView.propKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN = nil;
307312
[componentView updateProps:newProps oldProps:oldProps];
308313
componentView.propKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN = propKeys;

0 commit comments

Comments
 (0)