From 409047bb6df3740c968597e31c9253b4c1ef88fa Mon Sep 17 00:00:00 2001 From: Dmitry Rykun Date: Mon, 27 Jan 2025 16:24:27 -0800 Subject: [PATCH] Remove some code duplication in ConcreteComponentDescriptor::cloneProps (#48938) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/48938 Simple cleanup. Move the instantiation of shadowNodeProps outside of the IF statement. Changelog: [Internal] Reviewed By: philIip Differential Revision: D68634269 fbshipit-source-id: 40a103060fc96a5c74c7d81f7d6e8ac0565948c8 --- .../react/renderer/core/ConcreteComponentDescriptor.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/react-native/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h b/packages/react-native/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h index 58fa1978b93..4f61219e542 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h +++ b/packages/react-native/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h @@ -114,11 +114,11 @@ class ConcreteComponentDescriptor : public ComponentDescriptor { rawProps.parse(rawPropsParser_); + auto shadowNodeProps = ShadowNodeT::Props(context, rawProps, props); // Use the new-style iterator // Note that we just check if `Props` has this flag set, no matter // the type of ShadowNode; it acts as the single global flag. if (ReactNativeFeatureFlags::enableCppPropsIteratorSetter()) { - auto shadowNodeProps = ShadowNodeT::Props(context, rawProps, props); #ifdef ANDROID const auto& dynamic = shadowNodeProps->rawProps; #else @@ -132,11 +132,8 @@ class ConcreteComponentDescriptor : public ComponentDescriptor { name.c_str(), RawValue(pair.second)); } - return shadowNodeProps; - } else { - // Call old-style constructor - return ShadowNodeT::Props(context, rawProps, props); } + return shadowNodeProps; }; virtual State::Shared createInitialState(