Skip to content

Commit

Permalink
Remove some code duplication in ConcreteComponentDescriptor::clonePro…
Browse files Browse the repository at this point in the history
…ps (facebook#48938)

Summary:

Simple cleanup. Move the instantiation of shadowNodeProps outside of the IF statement.

Changelog: [Internal]

Differential Revision: D68634269
  • Loading branch information
dmytrorykun authored and facebook-github-bot committed Jan 24, 2025
1 parent 94a35d7 commit b29912c
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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->dynamicProps;
#else
Expand All @@ -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(
Expand Down

0 comments on commit b29912c

Please sign in to comment.