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
This commit is contained in:
Dmitry Rykun
2025-01-27 16:24:27 -08:00
committed by Facebook GitHub Bot
parent f8d5e3b3f0
commit 409047bb6d
@@ -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(