Skip to content

Commit 67db57d

Browse files
dmytrorykunfacebook-github-bot
authored andcommitted
Remove some code duplication in ConcreteComponentDescriptor::cloneProps (facebook#48938)
Summary: Simple cleanup. Move the instantiation of shadowNodeProps outside of the IF statement. Changelog: [Internal] Reviewed By: philIip Differential Revision: D68634269
1 parent e05a273 commit 67db57d

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

packages/react-native/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@ class ConcreteComponentDescriptor : public ComponentDescriptor {
114114

115115
rawProps.parse(rawPropsParser_);
116116

117+
auto shadowNodeProps = ShadowNodeT::Props(context, rawProps, props);
117118
// Use the new-style iterator
118119
// Note that we just check if `Props` has this flag set, no matter
119120
// the type of ShadowNode; it acts as the single global flag.
120121
if (ReactNativeFeatureFlags::enableCppPropsIteratorSetter()) {
121-
auto shadowNodeProps = ShadowNodeT::Props(context, rawProps, props);
122122
#ifdef ANDROID
123123
const auto& dynamic = shadowNodeProps->rawProps;
124124
#else
@@ -132,11 +132,8 @@ class ConcreteComponentDescriptor : public ComponentDescriptor {
132132
name.c_str(),
133133
RawValue(pair.second));
134134
}
135-
return shadowNodeProps;
136-
} else {
137-
// Call old-style constructor
138-
return ShadowNodeT::Props(context, rawProps, props);
139135
}
136+
return shadowNodeProps;
140137
};
141138

142139
virtual State::Shared createInitialState(

0 commit comments

Comments
 (0)