@@ -282,25 +282,34 @@ - (void)setIsJSResponder:(BOOL)isJSResponder
282
282
}
283
283
284
284
- (void )synchronouslyUpdateViewOnUIThread : (ReactTag)reactTag
285
- changedProps : (NSDictionary * )props
285
+ changedProps : (folly::dynamic )props
286
286
componentDescriptor : (const ComponentDescriptor &)componentDescriptor
287
287
{
288
288
RCTAssertMainQueue ();
289
+ NSArray <NSString *> *propsKeysToBeUpdated = extractKeysFromFollyDynamic (props);
290
+ bool updatesTransform = props.find (" transform" ) != props.items ().end ();
291
+ bool updatesOpacity = props.find (" opacity" ) != props.items ().end ();
292
+
289
293
UIView<RCTComponentViewProtocol> *componentView = [_componentViewRegistry findComponentViewWithTag: reactTag];
294
+ if (!componentView) {
295
+ RCTLogWarn (@" Attempted to update view with tag %ld , but it no longer exists" , (long )reactTag);
296
+ return ;
297
+ }
298
+
290
299
SurfaceId surfaceId = RCTSurfaceIdForView (componentView);
291
300
Props::Shared oldProps = [componentView props ];
292
301
Props::Shared newProps = componentDescriptor.cloneProps (
293
- PropsParserContext{surfaceId, *_contextContainer.get ()}, oldProps, RawProps (convertIdToFollyDynamic (props)));
302
+ PropsParserContext{surfaceId, *_contextContainer.get ()}, oldProps, RawProps (std::move (props)));
294
303
295
304
NSSet <NSString *> *propKeys = componentView.propKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN ?: [NSSet new ];
296
- propKeys = [propKeys setByAddingObjectsFromArray: props.allKeys ];
305
+ propKeys = [propKeys setByAddingObjectsFromArray: propsKeysToBeUpdated ];
297
306
componentView.propKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN = nil ;
298
307
[componentView updateProps: newProps oldProps: oldProps];
299
308
componentView.propKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN = propKeys;
300
309
301
310
const auto &newViewProps = static_cast <const ViewProps &>(*newProps);
302
311
303
- if (props[ @" transform " ] ) {
312
+ if (updatesTransform ) {
304
313
auto layoutMetrics = LayoutMetrics ();
305
314
layoutMetrics.frame .size .width = componentView.layer .bounds .size .width ;
306
315
layoutMetrics.frame .size .height = componentView.layer .bounds .size .height ;
@@ -309,7 +318,7 @@ - (void)synchronouslyUpdateViewOnUIThread:(ReactTag)reactTag
309
318
componentView.layer .transform = newTransform;
310
319
}
311
320
}
312
- if (props[ @" opacity " ] && componentView.layer .opacity != (float )newViewProps.opacity ) {
321
+ if (updatesOpacity && componentView.layer .opacity != (float )newViewProps.opacity ) {
313
322
componentView.layer .opacity = newViewProps.opacity ;
314
323
}
315
324
0 commit comments