Skip to content

Commit eb71d82

Browse files
reuse parseShadowNodeProps
1 parent 1861965 commit eb71d82

1 file changed

Lines changed: 1 addition & 52 deletions

File tree

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

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -135,58 +135,7 @@ class ConcreteComponentDescriptor : public ComponentDescriptor {
135135
? props->styleConditionData->unpatchedProps
136136
: props;
137137

138-
// Two construction paths:
139-
// - Iterator-setter (only available when `ConcreteProps` satisfies
140-
// `HasIteratorSetterCtor` AND the runtime flag is on): copy-construct
141-
// from sourceProps, then walk rawProps in-place via `forEachItem` and
142-
// route each entry through `setProp`. Skips both
143-
// `RawProps::parse(parser)` and the `folly::dynamic` materialization
144-
// that the legacy path needed.
145-
// - Classic (the fallback for any `ConcreteProps` that doesn't opt in,
146-
// and the only path when the flag is off): parse + per-field
147-
// `convertRawProp` via the 3-arg ctor.
148-
constexpr bool kSupportsIteratorSetter = HasIteratorSetterCtor<ConcreteProps>;
149-
const bool useIteratorSetter = kSupportsIteratorSetter && ReactNativeFeatureFlags::enableCppPropsIteratorSetter();
150-
151-
std::shared_ptr<ConcreteProps> shadowNodeProps;
152-
if constexpr (kSupportsIteratorSetter) {
153-
if (useIteratorSetter) {
154-
shadowNodeProps = ShadowNodeT::Props(sourceProps);
155-
}
156-
}
157-
if (!useIteratorSetter) {
158-
rawProps.parse(rawPropsParser_);
159-
shadowNodeProps = ShadowNodeT::Props(context, rawProps, sourceProps);
160-
}
161-
162-
#ifdef RN_SERIALIZABLE_STATE
163-
bool fallbackToDynamicRawPropsAccumulation = true;
164-
if (ReactNativeFeatureFlags::enableExclusivePropsUpdateAndroid() &&
165-
ReactNativeFeatureFlags::enableAccumulatedUpdatesInRawPropsAndroid()) {
166-
// When exclusive props update is enabled, we only apply Props 1.5 processing
167-
// (raw props merging) when Props 2.0 is not available.
168-
if (ReactNativeFeatureFlags::enablePropsUpdateReconciliationAndroid()) {
169-
// Cast to base Props reference to safely call virtual method
170-
const auto &baseProps = static_cast<const Props &>(*shadowNodeProps);
171-
if (strcmp(ShadowNodeT::Name(), baseProps.getDiffPropsImplementationTarget()) == 0) {
172-
// Props 2.0 supported for this component, Props 1.5 processing can be skipped
173-
fallbackToDynamicRawPropsAccumulation = false;
174-
}
175-
}
176-
}
177-
if (fallbackToDynamicRawPropsAccumulation) {
178-
ShadowNodeT::initializeDynamicProps(shadowNodeProps, rawProps, sourceProps);
179-
}
180-
#endif
181-
182-
if constexpr (kSupportsIteratorSetter) {
183-
if (useIteratorSetter) {
184-
rawProps.forEachItem([&](std::string_view name, const RawValue &value) {
185-
shadowNodeProps->setProp(context, RAW_PROPS_KEY_HASH(name), name.data(), value);
186-
});
187-
}
188-
}
189-
return shadowNodeProps;
138+
return parseShadowNodeProps(context, rawProps, sourceProps);
190139
};
191140

192141
Props::Shared applyStyleConditionResolution(

0 commit comments

Comments
 (0)