diff --git a/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputProps.cpp b/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputProps.cpp index 5b88b938f899..31d5e598a697 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputProps.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputProps.cpp @@ -17,7 +17,7 @@ namespace facebook::react { static bool hasValue(const RawProps& rawProps, bool defaultValue, const char* name) { - auto rawValue = rawProps.at(name, nullptr, nullptr); + auto rawValue = rawProps.at(name); // No change to prop - use default if (rawValue == nullptr) { diff --git a/packages/react-native/ReactCommon/react/renderer/components/view/AccessibilityProps.cpp b/packages/react-native/ReactCommon/react/renderer/components/view/AccessibilityProps.cpp index f21c86773726..f94ac81e59f3 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/view/AccessibilityProps.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/view/AccessibilityProps.cpp @@ -229,9 +229,8 @@ AccessibilityProps::AccessibilityProps( role = sourceProps.role; accessibilityTraits = sourceProps.accessibilityTraits; } else { - auto* accessibilityRoleValue = - rawProps.at("accessibilityRole", nullptr, nullptr); - auto* roleValue = rawProps.at("role", nullptr, nullptr); + auto* accessibilityRoleValue = rawProps.at("accessibilityRole"); + auto* roleValue = rawProps.at("role"); auto* precedentRoleValue = roleValue != nullptr ? roleValue : accessibilityRoleValue; diff --git a/packages/react-native/ReactCommon/react/renderer/components/view/BaseViewProps.cpp b/packages/react-native/ReactCommon/react/renderer/components/view/BaseViewProps.cpp index 83d9e5eb5663..d3bae3163c09 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/view/BaseViewProps.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/view/BaseViewProps.cpp @@ -84,8 +84,20 @@ BaseViewProps::BaseViewProps( : convertRawProp( context, rawProps, - "border", - "Radius", + CascadedRectangleCornersNames{ + .topLeft = "borderTopLeftRadius", + .topRight = "borderTopRightRadius", + .bottomLeft = "borderBottomLeftRadius", + .bottomRight = "borderBottomRightRadius", + .topStart = "borderTopStartRadius", + .topEnd = "borderTopEndRadius", + .bottomStart = "borderBottomStartRadius", + .bottomEnd = "borderBottomEndRadius", + .endEnd = "borderEndEndRadius", + .endStart = "borderEndStartRadius", + .startEnd = "borderStartEndRadius", + .startStart = "borderStartStartRadius", + .all = "borderRadius"}, sourceProps.borderRadii, {})), borderColors( @@ -94,8 +106,19 @@ BaseViewProps::BaseViewProps( : convertRawProp( context, rawProps, - "border", - "Color", + CascadedRectangleEdgesNames{ + .left = "borderLeftColor", + .right = "borderRightColor", + .top = "borderTopColor", + .bottom = "borderBottomColor", + .start = "borderStartColor", + .end = "borderEndColor", + .horizontal = "borderHorizontalColor", + .vertical = "borderVerticalColor", + .block = "borderBlockColor", + .blockEnd = "borderBlockEndColor", + .blockStart = "borderBlockStartColor", + .all = "borderColor"}, sourceProps.borderColors, {})), borderCurves( @@ -104,8 +127,20 @@ BaseViewProps::BaseViewProps( : convertRawProp( context, rawProps, - "border", - "Curve", + CascadedRectangleCornersNames{ + .topLeft = "borderTopLeftCurve", + .topRight = "borderTopRightCurve", + .bottomLeft = "borderBottomLeftCurve", + .bottomRight = "borderBottomRightCurve", + .topStart = "borderTopStartCurve", + .topEnd = "borderTopEndCurve", + .bottomStart = "borderBottomStartCurve", + .bottomEnd = "borderBottomEndCurve", + .endEnd = "borderEndEndCurve", + .endStart = "borderEndStartCurve", + .startEnd = "borderStartEndCurve", + .startStart = "borderStartStartCurve", + .all = "borderCurve"}, sourceProps.borderCurves, {})), borderStyles( @@ -114,8 +149,19 @@ BaseViewProps::BaseViewProps( : convertRawProp( context, rawProps, - "border", - "Style", + CascadedRectangleEdgesNames{ + .left = "borderLeftStyle", + .right = "borderRightStyle", + .top = "borderTopStyle", + .bottom = "borderBottomStyle", + .start = "borderStartStyle", + .end = "borderEndStyle", + .horizontal = "borderHorizontalStyle", + .vertical = "borderVerticalStyle", + .block = "borderBlockStyle", + .blockEnd = "borderBlockEndStyle", + .blockStart = "borderBlockStartStyle", + .all = "borderStyle"}, sourceProps.borderStyles, {})), outlineColor( diff --git a/packages/react-native/ReactCommon/react/renderer/components/view/propsConversions.h b/packages/react-native/ReactCommon/react/renderer/components/view/propsConversions.h index 985a3bbffb8c..54602ebaf2f1 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/view/propsConversions.h +++ b/packages/react-native/ReactCommon/react/renderer/components/view/propsConversions.h @@ -357,7 +357,7 @@ convertRawProp(const PropsParserContext &context, const RawProps &rawProps, cons convertRawProp(context, rawProps, "maxHeight", sourceValue.maxDimension(yoga::Dimension::Height), {})); { - const auto *rawValue = rawProps.at("aspectRatio", nullptr, nullptr); + const auto *rawValue = rawProps.at("aspectRatio"); if (rawValue != nullptr) { yogaStyle.setAspectRatio(rawValue->hasValue() ? convertAspectRatio(context, *rawValue) : yogaStyle.aspectRatio()); } else { @@ -371,43 +371,67 @@ convertRawProp(const PropsParserContext &context, const RawProps &rawProps, cons return yogaStyle; } +struct CascadedRectangleCornersNames { + const char *topLeft; + const char *topRight; + const char *bottomLeft; + const char *bottomRight; + const char *topStart; + const char *topEnd; + const char *bottomStart; + const char *bottomEnd; + const char *endEnd; + const char *endStart; + const char *startEnd; + const char *startStart; + const char *all; +}; + +struct CascadedRectangleEdgesNames { + const char *left; + const char *right; + const char *top; + const char *bottom; + const char *start; + const char *end; + const char *horizontal; + const char *vertical; + const char *block; + const char *blockEnd; + const char *blockStart; + const char *all; +}; + // This can be deleted when non-iterator ViewProp parsing is deleted template static inline CascadedRectangleCorners convertRawProp( const PropsParserContext &context, const RawProps &rawProps, - const char *prefix, - const char *suffix, + const CascadedRectangleCornersNames &names, const CascadedRectangleCorners &sourceValue, const CascadedRectangleCorners &defaultValue) { CascadedRectangleCorners result; - result.topLeft = - convertRawProp(context, rawProps, "TopLeft", sourceValue.topLeft, defaultValue.topLeft, prefix, suffix); - result.topRight = - convertRawProp(context, rawProps, "TopRight", sourceValue.topRight, defaultValue.topRight, prefix, suffix); + result.topLeft = convertRawProp(context, rawProps, names.topLeft, sourceValue.topLeft, defaultValue.topLeft); + result.topRight = convertRawProp(context, rawProps, names.topRight, sourceValue.topRight, defaultValue.topRight); result.bottomLeft = - convertRawProp(context, rawProps, "BottomLeft", sourceValue.bottomLeft, defaultValue.bottomLeft, prefix, suffix); - result.bottomRight = convertRawProp( - context, rawProps, "BottomRight", sourceValue.bottomRight, defaultValue.bottomRight, prefix, suffix); - - result.topStart = - convertRawProp(context, rawProps, "TopStart", sourceValue.topStart, defaultValue.topStart, prefix, suffix); - result.topEnd = convertRawProp(context, rawProps, "TopEnd", sourceValue.topEnd, defaultValue.topEnd, prefix, suffix); - result.bottomStart = convertRawProp( - context, rawProps, "BottomStart", sourceValue.bottomStart, defaultValue.bottomStart, prefix, suffix); - result.bottomEnd = - convertRawProp(context, rawProps, "BottomEnd", sourceValue.bottomEnd, defaultValue.bottomEnd, prefix, suffix); - result.endEnd = convertRawProp(context, rawProps, "EndEnd", sourceValue.endEnd, defaultValue.endEnd, prefix, suffix); - result.endStart = - convertRawProp(context, rawProps, "EndStart", sourceValue.endStart, defaultValue.endStart, prefix, suffix); - result.startEnd = - convertRawProp(context, rawProps, "StartEnd", sourceValue.startEnd, defaultValue.startEnd, prefix, suffix); + convertRawProp(context, rawProps, names.bottomLeft, sourceValue.bottomLeft, defaultValue.bottomLeft); + result.bottomRight = + convertRawProp(context, rawProps, names.bottomRight, sourceValue.bottomRight, defaultValue.bottomRight); + + result.topStart = convertRawProp(context, rawProps, names.topStart, sourceValue.topStart, defaultValue.topStart); + result.topEnd = convertRawProp(context, rawProps, names.topEnd, sourceValue.topEnd, defaultValue.topEnd); + result.bottomStart = + convertRawProp(context, rawProps, names.bottomStart, sourceValue.bottomStart, defaultValue.bottomStart); + result.bottomEnd = convertRawProp(context, rawProps, names.bottomEnd, sourceValue.bottomEnd, defaultValue.bottomEnd); + result.endEnd = convertRawProp(context, rawProps, names.endEnd, sourceValue.endEnd, defaultValue.endEnd); + result.endStart = convertRawProp(context, rawProps, names.endStart, sourceValue.endStart, defaultValue.endStart); + result.startEnd = convertRawProp(context, rawProps, names.startEnd, sourceValue.startEnd, defaultValue.startEnd); result.startStart = - convertRawProp(context, rawProps, "StartStart", sourceValue.startStart, defaultValue.startStart, prefix, suffix); + convertRawProp(context, rawProps, names.startStart, sourceValue.startStart, defaultValue.startStart); - result.all = convertRawProp(context, rawProps, "", sourceValue.all, defaultValue.all, prefix, suffix); + result.all = convertRawProp(context, rawProps, names.all, sourceValue.all, defaultValue.all); return result; } @@ -416,31 +440,28 @@ template static inline CascadedRectangleEdges convertRawProp( const PropsParserContext &context, const RawProps &rawProps, - const char *prefix, - const char *suffix, + const CascadedRectangleEdgesNames &names, const CascadedRectangleEdges &sourceValue, const CascadedRectangleEdges &defaultValue) { CascadedRectangleEdges result; - result.left = convertRawProp(context, rawProps, "Left", sourceValue.left, defaultValue.left, prefix, suffix); - result.right = convertRawProp(context, rawProps, "Right", sourceValue.right, defaultValue.right, prefix, suffix); - result.top = convertRawProp(context, rawProps, "Top", sourceValue.top, defaultValue.top, prefix, suffix); - result.bottom = convertRawProp(context, rawProps, "Bottom", sourceValue.bottom, defaultValue.bottom, prefix, suffix); + result.left = convertRawProp(context, rawProps, names.left, sourceValue.left, defaultValue.left); + result.right = convertRawProp(context, rawProps, names.right, sourceValue.right, defaultValue.right); + result.top = convertRawProp(context, rawProps, names.top, sourceValue.top, defaultValue.top); + result.bottom = convertRawProp(context, rawProps, names.bottom, sourceValue.bottom, defaultValue.bottom); - result.start = convertRawProp(context, rawProps, "Start", sourceValue.start, defaultValue.start, prefix, suffix); - result.end = convertRawProp(context, rawProps, "End", sourceValue.end, defaultValue.end, prefix, suffix); + result.start = convertRawProp(context, rawProps, names.start, sourceValue.start, defaultValue.start); + result.end = convertRawProp(context, rawProps, names.end, sourceValue.end, defaultValue.end); result.horizontal = - convertRawProp(context, rawProps, "Horizontal", sourceValue.horizontal, defaultValue.horizontal, prefix, suffix); - result.vertical = - convertRawProp(context, rawProps, "Vertical", sourceValue.vertical, defaultValue.vertical, prefix, suffix); - result.block = convertRawProp(context, rawProps, "Block", sourceValue.block, defaultValue.block, prefix, suffix); - result.blockEnd = - convertRawProp(context, rawProps, "BlockEnd", sourceValue.blockEnd, defaultValue.blockEnd, prefix, suffix); + convertRawProp(context, rawProps, names.horizontal, sourceValue.horizontal, defaultValue.horizontal); + result.vertical = convertRawProp(context, rawProps, names.vertical, sourceValue.vertical, defaultValue.vertical); + result.block = convertRawProp(context, rawProps, names.block, sourceValue.block, defaultValue.block); + result.blockEnd = convertRawProp(context, rawProps, names.blockEnd, sourceValue.blockEnd, defaultValue.blockEnd); result.blockStart = - convertRawProp(context, rawProps, "BlockStart", sourceValue.blockStart, defaultValue.blockStart, prefix, suffix); + convertRawProp(context, rawProps, names.blockStart, sourceValue.blockStart, defaultValue.blockStart); - result.all = convertRawProp(context, rawProps, "", sourceValue.all, defaultValue.all, prefix, suffix); + result.all = convertRawProp(context, rawProps, names.all, sourceValue.all, defaultValue.all); return result; } diff --git a/packages/react-native/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h b/packages/react-native/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h index 495702a08b8d..7a2eb0773b91 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h +++ b/packages/react-native/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h @@ -112,9 +112,30 @@ class ConcreteComponentDescriptor : public ComponentDescriptor { ShadowNodeT::filterRawProps(rawProps); } - rawProps.parse(rawPropsParser_); + // Two construction paths: + // - Iterator-setter (only available when `ConcreteProps` satisfies + // `HasIteratorSetterCtor` AND the runtime flag is on): copy-construct + // from sourceProps, then walk rawProps in-place via `forEachItem` and + // route each entry through `setProp`. Skips both + // `RawProps::parse(parser)` and the `folly::dynamic` materialization + // that the legacy path needed. + // - Classic (the fallback for any `ConcreteProps` that doesn't opt in, + // and the only path when the flag is off): parse + per-field + // `convertRawProp` via the 3-arg ctor. + constexpr bool kSupportsIteratorSetter = HasIteratorSetterCtor; + const bool useIteratorSetter = kSupportsIteratorSetter && ReactNativeFeatureFlags::enableCppPropsIteratorSetter(); + + std::shared_ptr shadowNodeProps; + if constexpr (kSupportsIteratorSetter) { + if (useIteratorSetter) { + shadowNodeProps = ShadowNodeT::Props(props); + } + } + if (!useIteratorSetter) { + rawProps.parse(rawPropsParser_); + shadowNodeProps = ShadowNodeT::Props(context, rawProps, props); + } - auto shadowNodeProps = ShadowNodeT::Props(context, rawProps, props); #ifdef RN_SERIALIZABLE_STATE bool fallbackToDynamicRawPropsAccumulation = true; if (ReactNativeFeatureFlags::enableExclusivePropsUpdateAndroid() && @@ -134,19 +155,23 @@ class ConcreteComponentDescriptor : public ComponentDescriptor { ShadowNodeT::initializeDynamicProps(shadowNodeProps, rawProps, props); } #endif - // 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()) { + + if constexpr (kSupportsIteratorSetter) { + if (useIteratorSetter) { #ifdef RN_SERIALIZABLE_STATE - const auto &dynamic = - fallbackToDynamicRawPropsAccumulation ? shadowNodeProps->rawProps : static_cast(rawProps); -#else - const auto &dynamic = static_cast(rawProps); + if (fallbackToDynamicRawPropsAccumulation) { + // Accumulation already merged the source's rawProps with the input; + // iterate the merged dynamic so setProp sees the unioned set. + for (const auto &pair : shadowNodeProps->rawProps.items()) { + const auto &name = pair.first.getString(); + shadowNodeProps->setProp(context, RAW_PROPS_KEY_HASH(name), name.c_str(), RawValue(pair.second)); + } + return shadowNodeProps; + } #endif - for (const auto &pair : dynamic.items()) { - const auto &name = pair.first.getString(); - shadowNodeProps->setProp(context, RAW_PROPS_KEY_HASH(name), name.c_str(), RawValue(pair.second)); + rawProps.forEachItem([&](const char *name, const RawValue &value) { + shadowNodeProps->setProp(context, RAW_PROPS_KEY_HASH(name), name, value); + }); } } return shadowNodeProps; diff --git a/packages/react-native/ReactCommon/react/renderer/core/ConcreteShadowNode.h b/packages/react-native/ReactCommon/react/renderer/core/ConcreteShadowNode.h index cbddd0d8b446..ac069108548c 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/ConcreteShadowNode.h +++ b/packages/react-native/ReactCommon/react/renderer/core/ConcreteShadowNode.h @@ -71,6 +71,13 @@ class ConcreteShadowNode : public BaseShadowNodeT { return BaseShadowNodeT::BaseTraits(); } + /* + * Classic / parse path: construct `PropsT` by parsing `rawProps` field-by- + * field via the 3-arg `(context, sourceProps, rawProps)` constructor. + * `ConcreteComponentDescriptor::cloneProps` calls this when the + * iterator-setter path is disabled (per-class via the + * `HasIteratorSetterCtor` concept, or globally via the runtime flag). + */ static UnsharedConcreteProps Props(const PropsParserContext &context, const RawProps &rawProps, const Props::Shared &baseProps = nullptr) { @@ -78,6 +85,18 @@ class ConcreteShadowNode : public BaseShadowNodeT { context, baseProps ? static_cast(*baseProps) : *defaultSharedProps(), rawProps); } + /* + * Iterator-setter path: copy-construct `PropsT` from `baseProps` only. + * `ConcreteComponentDescriptor::cloneProps` then walks `rawProps` via + * `RawProps::forEachItem` and overwrites individual fields through + * `PropsT::setProp`. Available when `PropsT` satisfies + * `HasIteratorSetterCtor`. + */ + static UnsharedConcreteProps Props(const Props::Shared &baseProps) + { + return std::make_shared(baseProps ? static_cast(*baseProps) : *defaultSharedProps()); + } + #ifdef RN_SERIALIZABLE_STATE static void initializeDynamicProps( UnsharedConcreteProps props, diff --git a/packages/react-native/ReactCommon/react/renderer/core/Props.h b/packages/react-native/ReactCommon/react/renderer/core/Props.h index 2dadef6b6e6f..444b6bac9f62 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/Props.h +++ b/packages/react-native/ReactCommon/react/renderer/core/Props.h @@ -41,7 +41,7 @@ class Props : public virtual Sealable, public virtual DebugStringConvertible { virtual ~Props() = default; #endif - Props(const Props &other) = delete; + Props(const Props &other) = default; Props &operator=(const Props &other) = delete; /** @@ -96,4 +96,66 @@ class Props : public virtual Sealable, public virtual DebugStringConvertible { const std::function &filterObjectKeys = nullptr); }; +namespace detail { + +/* + * Extracts the class type from a pointer-to-member-function expression. + * Used in unevaluated context only. + */ +template +auto memberFunctionClass(T C::*) -> C; + +} // namespace detail + +/* + * Internal: `T` declares its OWN `setProp` (not just inherits one from a + * base class). `&T::setProp` resolves to a pointer-to-member-function whose + * class part is the level where `setProp` was actually declared — if `T` + * inherits without overriding, that class is some base, not `T`. + * + * Distinguishing own-declaration from inherited-declaration matters because + * `setProp` is non-virtual. A subclass that adds fields but forgets to + * override `setProp` would silently inherit its parent's switch — and the new + * fields would never be reached by the iterator-setter dispatch. + */ +template +concept DeclaresOwnSetProp = std::is_same_v; + +/* + * Internal: `T` exposes a `setProp(ctx, hash, name, value) -> void` callable + * with the canonical Props signature, declared on `T` itself. + */ +template +concept HasSetProp = DeclaresOwnSetProp && + requires(T &t, const PropsParserContext &ctx, RawPropsPropNameHash hash, const char *name, const RawValue &value) { + { t.setProp(ctx, hash, name, value) } -> std::same_as; + }; + +/* + * Marks a Props type as supporting the iterator-setter construction path used + * by `ConcreteComponentDescriptor::cloneProps` when + * `enableCppPropsIteratorSetter` is on. The contract is: + * + * 1. The type is copy-constructible from a source Props (so `cloneProps` + * can build the new Props by copy and then overwrite individual fields). + * 2. The type descends from `Props`, anchoring the `setProp` chain in the + * `Props::setProp` base case. + * 3. The type declares its OWN `setProp` with the canonical signature — + * not inherited — so the iterator dispatch reaches every field that the + * type adds beyond its base. + * + * `setProp` is non-virtual; subclasses chain explicitly via + * `Parent::setProp(...)`. The chain integrity beyond `T` is enforced by the + * compiler at each level's `setProp` body — if a subclass calls + * `Parent::setProp(...)` and `Parent` does not define one, the build fails + * at that call site. This concept guards the entry point (`T` itself) and + * relies on those per-level calls to keep the chain whole. + * + * When the concept is NOT satisfied for some `ConcreteProps`, + * `cloneProps` falls through to the classic per-field `convertRawProp` path + * for that component regardless of the runtime flag. + */ +template +concept HasIteratorSetterCtor = std::copy_constructible && std::derived_from && HasSetProp; + } // namespace facebook::react diff --git a/packages/react-native/ReactCommon/react/renderer/core/RawProps.cpp b/packages/react-native/ReactCommon/react/renderer/core/RawProps.cpp index 66b021d43e34..5a5b405d9516 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/RawProps.cpp +++ b/packages/react-native/ReactCommon/react/renderer/core/RawProps.cpp @@ -9,7 +9,6 @@ #include #include -#include #include namespace facebook::react { @@ -110,15 +109,11 @@ bool RawProps::isEmpty() const noexcept { * Returns a const unowning pointer to `RawValue` of a prop with a given name. * Returns `nullptr` if a prop with the given name does not exist. */ -const RawValue* RawProps::at( - const char* name, - const char* prefix, - const char* suffix) const noexcept { +const RawValue* RawProps::at(const char* name) const noexcept { react_native_assert( parser_ && "The object is not parsed. `parse` must be called before `at`."); - return parser_->at( - *this, RawPropsKey{.prefix = prefix, .name = name, .suffix = suffix}); + return parser_->at(*this, name); } } // namespace facebook::react diff --git a/packages/react-native/ReactCommon/react/renderer/core/RawProps.h b/packages/react-native/ReactCommon/react/renderer/core/RawProps.h index 631ef315c987..20ad0137bfa8 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/RawProps.h +++ b/packages/react-native/ReactCommon/react/renderer/core/RawProps.h @@ -90,7 +90,46 @@ class RawProps final { * Returns a const unowning pointer to `RawValue` of a prop with a given name. * Returns `nullptr` if a prop with the given name does not exist. */ - const RawValue *at(const char *name, const char *prefix, const char *suffix) const noexcept; + const RawValue *at(const char *name) const noexcept; + + /* + * Iterates the underlying source object and invokes `fn(name, value)` for + * each entry, in source order. Skips parsing — does NOT require a prior + * `parse(parser)` call. For `Mode::JSI` this walks the JSI object in-place + * (no `folly::dynamic` materialization). For `Mode::Dynamic` it walks + * `dynamic_.items()`. For `Mode::Empty` it is a no-op. + * + * The callback signature is `void(const char *name, const RawValue &value)`. + * `name` is a null-terminated C string owned by storage that lives until + * the callback returns. + */ + template + void forEachItem(Fn &&fn) const + { + switch (mode_) { + case Mode::Empty: + return; + case Mode::JSI: { + auto object = value_.asObject(*runtime_); + auto names = object.getPropertyNames(*runtime_); + auto count = names.size(*runtime_); + for (size_t i = 0; i < count; ++i) { + auto name = names.getValueAtIndex(*runtime_, i).asString(*runtime_).utf8(*runtime_); + auto propValue = object.getProperty(*runtime_, jsi::PropNameID::forUtf8(*runtime_, name)); + fn(name.c_str(), RawValue{*runtime_, std::move(propValue)}); + } + return; + } + case Mode::Dynamic: + for (const auto &pair : dynamic_.items()) { + const auto &name = pair.first.getString(); + fn(name.c_str(), RawValue{pair.second}); + } + return; + default: + return; + } + } private: friend class RawPropsParser; diff --git a/packages/react-native/ReactCommon/react/renderer/core/RawPropsKey.cpp b/packages/react-native/ReactCommon/react/renderer/core/RawPropsKey.cpp deleted file mode 100644 index 01ac0f16617c..000000000000 --- a/packages/react-native/ReactCommon/react/renderer/core/RawPropsKey.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "RawPropsKey.h" - -#include -#include -#include - -#include - -namespace facebook::react { - -void RawPropsKey::render(char* buffer, RawPropsPropNameLength* length) - const noexcept { - *length = 0; - - constexpr size_t maxLength = kPropNameLengthHardCap - 1; - - auto appendSegment = [&](const char* segment) { - auto copyLen = std::min(std::strlen(segment), maxLength - *length); - std::memcpy(buffer + *length, segment, copyLen); - *length += static_cast(copyLen); - }; - - if (prefix != nullptr) { - appendSegment(prefix); - } - - appendSegment(name); - - if (suffix != nullptr) { - appendSegment(suffix); - } -} - -RawPropsKey::operator std::string() const noexcept { - auto buffer = std::array(); - RawPropsPropNameLength length = 0; - render(buffer.data(), &length); - return std::string{buffer.data(), length}; -} - -static bool areFieldsEqual(const char* lhs, const char* rhs) { - if (lhs == nullptr || rhs == nullptr) { - return lhs == rhs; - } - return lhs == rhs || strcmp(lhs, rhs) == 0; -} - -bool operator==(const RawPropsKey& lhs, const RawPropsKey& rhs) noexcept { - // Note: We check the name first. - return areFieldsEqual(lhs.name, rhs.name) && - areFieldsEqual(lhs.prefix, rhs.prefix) && - areFieldsEqual(lhs.suffix, rhs.suffix); -} - -} // namespace facebook::react diff --git a/packages/react-native/ReactCommon/react/renderer/core/RawPropsKey.h b/packages/react-native/ReactCommon/react/renderer/core/RawPropsKey.h deleted file mode 100644 index fefdf22525d6..000000000000 --- a/packages/react-native/ReactCommon/react/renderer/core/RawPropsKey.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -#include - -namespace facebook::react { - -/* - * Represent a prop name stored as three `char const *` fragments. - */ -class RawPropsKey final { - public: - const char *prefix{}; - const char *name{}; - const char *suffix{}; - - /* - * Converts to `std::string`. - */ - explicit operator std::string() const noexcept; - - /* - * Renders compound prop name to given buffer and put the resulting length - * into `length`. - */ - void render(char *buffer, RawPropsPropNameLength *length) const noexcept; -}; - -bool operator==(const RawPropsKey &lhs, const RawPropsKey &rhs) noexcept; - -} // namespace facebook::react diff --git a/packages/react-native/ReactCommon/react/renderer/core/RawPropsKeyMap.cpp b/packages/react-native/ReactCommon/react/renderer/core/RawPropsKeyMap.cpp index 81b0113658de..0771a90a073f 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/RawPropsKeyMap.cpp +++ b/packages/react-native/ReactCommon/react/renderer/core/RawPropsKeyMap.cpp @@ -9,7 +9,6 @@ #include -#include #include #include #include @@ -33,11 +32,14 @@ bool RawPropsKeyMap::shouldFirstOneBeBeforeSecondOne( } void RawPropsKeyMap::insert( - const RawPropsKey& key, + std::string_view key, RawPropsValueIndex value) noexcept { auto item = Item{}; item.value = value; - key.render(item.name, &item.length); + auto length = + std::min(key.size(), static_cast(kPropNameLengthHardCap - 1)); + std::copy_n(key.data(), length, item.name); + item.length = static_cast(length); items_.push_back(item); react_native_assert( items_.size() < std::numeric_limits::max()); @@ -52,26 +54,9 @@ void RawPropsKeyMap::reindex() noexcept { &RawPropsKeyMap::shouldFirstOneBeBeforeSecondOne); // Filtering out duplicating keys. - // Accessing the same key twice is supported by RawPropsPorser, but the - // RawPropsKey used must be identical, and if not, lookup will be - // inconsistent. - auto it = items_.begin(); - auto end = items_.end(); - // Implements std::unique with additional logging - if (it != end) { - auto result = it; - while (++it != end) { - if (hasSameName(*result, *it)) { - LOG(WARNING) - << "Component property map contains multiple entries for '" - << std::string_view(it->name, it->length) - << "'. Ensure all calls to convertRawProp use a consistent prefix, name and suffix."; - } else if (++result != it) { - *result = *it; - } - } - items_.erase(++result, items_.end()); - } + items_.erase( + std::unique(items_.begin(), items_.end(), &RawPropsKeyMap::hasSameName), + items_.end()); buckets_.resize(kPropNameLengthHardCap); @@ -91,9 +76,8 @@ void RawPropsKeyMap::reindex() noexcept { } } -RawPropsValueIndex RawPropsKeyMap::at( - const char* name, - RawPropsPropNameLength length) noexcept { +RawPropsValueIndex RawPropsKeyMap::at(std::string_view name) noexcept { + auto length = static_cast(name.size()); react_native_assert(length > 0); react_native_assert(length < kPropNameLengthHardCap); if (length == 0 || length >= kPropNameLengthHardCap) [[unlikely]] { @@ -107,7 +91,7 @@ RawPropsValueIndex RawPropsKeyMap::at( // 2. Binary search in the bucket. while (lower <= upper) { auto median = (lower + upper) / 2; - auto condition = std::memcmp(items_[median].name, name, length); + auto condition = std::memcmp(items_[median].name, name.data(), length); if (condition < 0) { lower = median + 1; } else if (condition == 0) { diff --git a/packages/react-native/ReactCommon/react/renderer/core/RawPropsKeyMap.h b/packages/react-native/ReactCommon/react/renderer/core/RawPropsKeyMap.h index ee14ea4ccbb2..15f438af59c3 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/RawPropsKeyMap.h +++ b/packages/react-native/ReactCommon/react/renderer/core/RawPropsKeyMap.h @@ -7,8 +7,8 @@ #pragma once -#include #include +#include #include namespace facebook::react { @@ -25,7 +25,7 @@ class RawPropsKeyMap final { /* * Stores `value` with by given `key`. */ - void insert(const RawPropsKey &key, RawPropsValueIndex value) noexcept; + void insert(std::string_view key, RawPropsValueIndex value) noexcept; /* * Reindexes the stored data. @@ -37,7 +37,7 @@ class RawPropsKeyMap final { * Finds and returns the `value` (some index) by given `key`. * Returns `kRawPropsValueIndexEmpty` if the value wan't found. */ - RawPropsValueIndex at(const char *name, RawPropsPropNameLength length) noexcept; + RawPropsValueIndex at(std::string_view name) noexcept; private: struct Item { diff --git a/packages/react-native/ReactCommon/react/renderer/core/RawPropsParser.cpp b/packages/react-native/ReactCommon/react/renderer/core/RawPropsParser.cpp index 71a3fb93fbed..1bf4bf4ae85b 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/RawPropsParser.cpp +++ b/packages/react-native/ReactCommon/react/renderer/core/RawPropsParser.cpp @@ -19,7 +19,7 @@ namespace facebook::react { // which props are accessed during parsing, and in which order. const RawValue* RawPropsParser::at( const RawProps& rawProps, - const RawPropsKey& key) const noexcept { + std::string_view key) const noexcept { if (!ready_) [[unlikely]] { // Check against the same key being inserted more than once. // This happens commonly with nested Props structs, where the higher-level @@ -74,7 +74,7 @@ const RawValue* RawPropsParser::at( if (resetLoop) { LOG(ERROR) << "Looked up property name which was not seen when preparing: " - << (std::string)key; + << key; return nullptr; } resetLoop = true; @@ -126,8 +126,7 @@ void RawPropsParser::preparse(const RawProps& rawProps) const noexcept { for (size_t i = 0; i < count; i++) { auto nameValue = names.getValueAtIndex(runtime, i).getString(runtime); auto name = nameValue.utf8(runtime); - auto keyIndex = nameToIndex_.at( - name.data(), static_cast(name.size())); + auto keyIndex = nameToIndex_.at(name); if (keyIndex == kRawPropsValueIndexEmpty) { continue; @@ -150,8 +149,7 @@ void RawPropsParser::preparse(const RawProps& rawProps) const noexcept { for (const auto& pair : dynamic.items()) { auto name = pair.first.getString(); - auto keyIndex = nameToIndex_.at( - name.data(), static_cast(name.size())); + auto keyIndex = nameToIndex_.at(name); if (keyIndex == kRawPropsValueIndexEmpty) { continue; diff --git a/packages/react-native/ReactCommon/react/renderer/core/RawPropsParser.h b/packages/react-native/ReactCommon/react/renderer/core/RawPropsParser.h index ad28ae7b2113..c98379b4f833 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/RawPropsParser.h +++ b/packages/react-native/ReactCommon/react/renderer/core/RawPropsParser.h @@ -10,10 +10,10 @@ #include #include #include -#include #include #include #include +#include namespace facebook::react { @@ -70,9 +70,9 @@ class RawPropsParser final { /* * To be used by `RawProps` only. */ - const RawValue *at(const RawProps &rawProps, const RawPropsKey &key) const noexcept; + const RawValue *at(const RawProps &rawProps, std::string_view key) const noexcept; - mutable std::vector keys_{}; + mutable std::vector keys_{}; mutable RawPropsKeyMap nameToIndex_{}; mutable bool ready_{false}; }; diff --git a/packages/react-native/ReactCommon/react/renderer/core/propsConversions.h b/packages/react-native/ReactCommon/react/renderer/core/propsConversions.h index 1b1cb73208e8..94a1e70545e8 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/propsConversions.h +++ b/packages/react-native/ReactCommon/react/renderer/core/propsConversions.h @@ -11,7 +11,6 @@ #include #include -#include #include namespace facebook::react { @@ -168,11 +167,9 @@ T convertRawProp( const RawProps &rawProps, const char *name, const T &sourceValue, - const U &defaultValue, - const char *namePrefix = nullptr, - const char *nameSuffix = nullptr) + const U &defaultValue) { - const auto *rawValue = rawProps.at(name, namePrefix, nameSuffix); + const auto *rawValue = rawProps.at(name); if (rawValue == nullptr) [[likely]] { return sourceValue; } @@ -189,9 +186,8 @@ T convertRawProp( return result; } catch (const std::exception &e) { // In case of errors, log the error and fall back to the default - RawPropsKey key{.prefix = namePrefix, .name = name, .suffix = nameSuffix}; // TODO: report this using ErrorUtils so it's more visible to the user - LOG(ERROR) << "Error while converting prop '" << static_cast(key) << "': " << e.what(); + LOG(ERROR) << "Error while converting prop '" << name << "': " << e.what(); return defaultValue; } } diff --git a/packages/react-native/ReactCommon/react/renderer/core/tests/RawPropsTest.cpp b/packages/react-native/ReactCommon/react/renderer/core/tests/RawPropsTest.cpp index c905cd1e84ec..caff5c160c32 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/tests/RawPropsTest.cpp +++ b/packages/react-native/ReactCommon/react/renderer/core/tests/RawPropsTest.cpp @@ -175,7 +175,7 @@ TEST(RawPropsTest, handleRawPropsSingleString) { parser.prepare(); raw.parse(parser); - std::string value = (std::string)*raw.at("nativeID", nullptr, nullptr); + std::string value = (std::string)*raw.at("nativeID"); EXPECT_STREQ(value.c_str(), "abc"); } @@ -189,7 +189,7 @@ TEST(RawPropsTest, handleRawPropsSingleFloat) { parser.prepare(); raw.parse(parser); - auto value = (float)*raw.at("floatValue", nullptr, nullptr); + auto value = (float)*raw.at("floatValue"); EXPECT_NEAR(value, 42.42, 0.00001); } @@ -203,7 +203,7 @@ TEST(RawPropsTest, handleRawPropsSingleDouble) { parser.prepare(); raw.parse(parser); - auto value = (double)*raw.at("doubleValue", nullptr, nullptr); + auto value = (double)*raw.at("doubleValue"); EXPECT_NEAR(value, 42.42, 0.00001); } @@ -217,7 +217,7 @@ TEST(RawPropsTest, handleRawPropsSingleInt) { parser.prepare(); raw.parse(parser); - int value = (int)*raw.at("intValue", nullptr, nullptr); + int value = (int)*raw.at("intValue"); EXPECT_EQ(value, 42); } @@ -231,9 +231,9 @@ TEST(RawPropsTest, handleRawPropsSingleIntGetManyTimes) { parser.prepare(); raw.parse(parser); - EXPECT_EQ((int)*raw.at("intValue", nullptr, nullptr), 42); - EXPECT_EQ((int)*raw.at("intValue", nullptr, nullptr), 42); - EXPECT_EQ((int)*raw.at("intValue", nullptr, nullptr), 42); + EXPECT_EQ((int)*raw.at("intValue"), 42); + EXPECT_EQ((int)*raw.at("intValue"), 42); + EXPECT_EQ((int)*raw.at("intValue"), 42); } TEST(RawPropsTest, handleRawPropsPrimitiveTypes) { @@ -249,13 +249,11 @@ TEST(RawPropsTest, handleRawPropsPrimitiveTypes) { parser.prepare(); raw.parse(parser); - EXPECT_EQ((int)*raw.at("intValue", nullptr, nullptr), 42); - EXPECT_NEAR((double)*raw.at("doubleValue", nullptr, nullptr), 17.42, 0.0001); - EXPECT_NEAR((float)*raw.at("floatValue", nullptr, nullptr), 66.67, 0.00001); - EXPECT_STREQ( - ((std::string)*raw.at("stringValue", nullptr, nullptr)).c_str(), - "helloworld"); - EXPECT_EQ((bool)*raw.at("boolValue", nullptr, nullptr), true); + EXPECT_EQ((int)*raw.at("intValue"), 42); + EXPECT_NEAR((double)*raw.at("doubleValue"), 17.42, 0.0001); + EXPECT_NEAR((float)*raw.at("floatValue"), 66.67, 0.00001); + EXPECT_STREQ(((std::string)*raw.at("stringValue")).c_str(), "helloworld"); + EXPECT_EQ((bool)*raw.at("boolValue"), true); } TEST(RawPropsTest, handleRawPropsPrimitiveTypesGetTwice) { @@ -271,21 +269,17 @@ TEST(RawPropsTest, handleRawPropsPrimitiveTypesGetTwice) { parser.prepare(); raw.parse(parser); - EXPECT_EQ((int)*raw.at("intValue", nullptr, nullptr), 42); - EXPECT_NEAR((double)*raw.at("doubleValue", nullptr, nullptr), 17.42, 0.0001); - EXPECT_NEAR((float)*raw.at("floatValue", nullptr, nullptr), 66.67, 0.00001); - EXPECT_STREQ( - ((std::string)*raw.at("stringValue", nullptr, nullptr)).c_str(), - "helloworld"); - EXPECT_EQ((bool)*raw.at("boolValue", nullptr, nullptr), true); - - EXPECT_EQ((int)*raw.at("intValue", nullptr, nullptr), 42); - EXPECT_NEAR((double)*raw.at("doubleValue", nullptr, nullptr), 17.42, 0.0001); - EXPECT_NEAR((float)*raw.at("floatValue", nullptr, nullptr), 66.67, 0.00001); - EXPECT_STREQ( - ((std::string)*raw.at("stringValue", nullptr, nullptr)).c_str(), - "helloworld"); - EXPECT_EQ((bool)*raw.at("boolValue", nullptr, nullptr), true); + EXPECT_EQ((int)*raw.at("intValue"), 42); + EXPECT_NEAR((double)*raw.at("doubleValue"), 17.42, 0.0001); + EXPECT_NEAR((float)*raw.at("floatValue"), 66.67, 0.00001); + EXPECT_STREQ(((std::string)*raw.at("stringValue")).c_str(), "helloworld"); + EXPECT_EQ((bool)*raw.at("boolValue"), true); + + EXPECT_EQ((int)*raw.at("intValue"), 42); + EXPECT_NEAR((double)*raw.at("doubleValue"), 17.42, 0.0001); + EXPECT_NEAR((float)*raw.at("floatValue"), 66.67, 0.00001); + EXPECT_STREQ(((std::string)*raw.at("stringValue")).c_str(), "helloworld"); + EXPECT_EQ((bool)*raw.at("boolValue"), true); } TEST(RawPropsTest, handleRawPropsPrimitiveTypesGetOutOfOrder) { @@ -301,21 +295,17 @@ TEST(RawPropsTest, handleRawPropsPrimitiveTypesGetOutOfOrder) { parser.prepare(); raw.parse(parser); - EXPECT_EQ((int)*raw.at("intValue", nullptr, nullptr), 42); - EXPECT_NEAR((double)*raw.at("doubleValue", nullptr, nullptr), 17.42, 0.0001); - EXPECT_NEAR((float)*raw.at("floatValue", nullptr, nullptr), 66.67, 0.00001); - EXPECT_STREQ( - ((std::string)*raw.at("stringValue", nullptr, nullptr)).c_str(), - "helloworld"); - EXPECT_EQ((bool)*raw.at("boolValue", nullptr, nullptr), true); - - EXPECT_NEAR((double)*raw.at("doubleValue", nullptr, nullptr), 17.42, 0.0001); - EXPECT_EQ((int)*raw.at("intValue", nullptr, nullptr), 42); - EXPECT_NEAR((float)*raw.at("floatValue", nullptr, nullptr), 66.67, 0.00001); - EXPECT_STREQ( - ((std::string)*raw.at("stringValue", nullptr, nullptr)).c_str(), - "helloworld"); - EXPECT_EQ((bool)*raw.at("boolValue", nullptr, nullptr), true); + EXPECT_EQ((int)*raw.at("intValue"), 42); + EXPECT_NEAR((double)*raw.at("doubleValue"), 17.42, 0.0001); + EXPECT_NEAR((float)*raw.at("floatValue"), 66.67, 0.00001); + EXPECT_STREQ(((std::string)*raw.at("stringValue")).c_str(), "helloworld"); + EXPECT_EQ((bool)*raw.at("boolValue"), true); + + EXPECT_NEAR((double)*raw.at("doubleValue"), 17.42, 0.0001); + EXPECT_EQ((int)*raw.at("intValue"), 42); + EXPECT_NEAR((float)*raw.at("floatValue"), 66.67, 0.00001); + EXPECT_STREQ(((std::string)*raw.at("stringValue")).c_str(), "helloworld"); + EXPECT_EQ((bool)*raw.at("boolValue"), true); } TEST(RawPropsTest, handleRawPropsPrimitiveTypesIncomplete) { @@ -328,13 +318,13 @@ TEST(RawPropsTest, handleRawPropsPrimitiveTypesIncomplete) { parser.prepare(); raw.parse(parser); - EXPECT_EQ((int)*raw.at("intValue", nullptr, nullptr), 42); - EXPECT_EQ(raw.at("doubleValue", nullptr, nullptr), nullptr); - EXPECT_EQ(raw.at("floatValue", nullptr, nullptr), nullptr); - EXPECT_EQ((int)*raw.at("intValue", nullptr, nullptr), 42); - EXPECT_EQ(raw.at("stringValue", nullptr, nullptr), nullptr); - EXPECT_EQ(raw.at("boolValue", nullptr, nullptr), nullptr); - EXPECT_EQ((int)*raw.at("intValue", nullptr, nullptr), 42); + EXPECT_EQ((int)*raw.at("intValue"), 42); + EXPECT_EQ(raw.at("doubleValue"), nullptr); + EXPECT_EQ(raw.at("floatValue"), nullptr); + EXPECT_EQ((int)*raw.at("intValue"), 42); + EXPECT_EQ(raw.at("stringValue"), nullptr); + EXPECT_EQ(raw.at("boolValue"), nullptr); + EXPECT_EQ((int)*raw.at("intValue"), 42); } #ifdef REACT_NATIVE_DEBUG @@ -351,8 +341,8 @@ TEST(RawPropsTest, handleRawPropsPrimitiveTypesIncorrectLookup) { // Before D18662135, looking up an invalid key would trigger // an infinite loop. This is out of contract, so we should only // test this in debug. - EXPECT_EQ(raw.at("flurb", nullptr, nullptr), nullptr); - EXPECT_EQ((int)*raw.at("intValue", nullptr, nullptr), 42); + EXPECT_EQ(raw.at("flurb"), nullptr); + EXPECT_EQ((int)*raw.at("intValue"), 42); } #endif diff --git a/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api index a85c1f0c88b4..8336ec0d1444 100644 --- a/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api @@ -795,6 +795,15 @@ concept facebook::react::CSSSyntaxVisitorReturn = std::is_default_constructible_ template concept facebook::react::CSSValidCompoundDataType = facebook::react::detail::is_variant_of_data_types::value; template +concept facebook::react::DeclaresOwnSetProp = std::is_same_v; +template +concept facebook::react::HasIteratorSetterCtor = std::copy_constructible && std::derived_from && HasSetProp; +template +concept facebook::react::HasSetProp = DeclaresOwnSetProp && +requires(T& t, const facebook::react::PropsParserContext& ctx, facebook::react::RawPropsPropNameHash hash, const char* name, const facebook::react::RawValue& value) { + { t.setProp(ctx, hash, name, value) } -> std::same_as; +}; +template concept facebook::react::Hashable = !std::is_same_v&& (requires(T a) { { std::hash{}(a) } -> std::convertible_to; }); @@ -1020,7 +1029,7 @@ facebook::react::ComponentDescriptorProvider facebook::react::concreteComponentD template DestinationTimePointT facebook::react::clockCast(SourceTimePointT timePoint); template -T facebook::react::convertRawProp(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const char* name, const T& sourceValue, const U& defaultValue, const char* namePrefix = nullptr, const char* nameSuffix = nullptr); +T facebook::react::convertRawProp(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const char* name, const T& sourceValue, const U& defaultValue); template T facebook::react::get(const facebook::react::AnimatedPropBase& animatedProp); template @@ -1165,7 +1174,6 @@ bool facebook::react::operator==(const facebook::react::LayoutContext& lhs, cons bool facebook::react::operator==(const facebook::react::LineMeasureCacheKey& lhs, const facebook::react::LineMeasureCacheKey& rhs); bool facebook::react::operator==(const facebook::react::PerformanceObserver& lhs, const facebook::react::PerformanceObserver& rhs); bool facebook::react::operator==(const facebook::react::PreparedTextCacheKey& lhs, const facebook::react::PreparedTextCacheKey& rhs); -bool facebook::react::operator==(const facebook::react::RawPropsKey& lhs, const facebook::react::RawPropsKey& rhs) noexcept; bool facebook::react::operator==(const facebook::react::Size& rhs, const facebook::react::Size& lhs) noexcept; bool facebook::react::operator==(const facebook::react::TextMeasureCacheKey& lhs, const facebook::react::TextMeasureCacheKey& rhs); constexpr bool facebook::react::operator&(facebook::react::ModalHostViewSupportedOrientationsMask const lhs, enum facebook::react::ModalHostViewSupportedOrientations const rhs); @@ -4128,7 +4136,7 @@ class facebook::react::PreparedTextCacheKey { class facebook::react::Props : public virtual facebook::react::Sealable, public virtual facebook::react::DebugStringConvertible { protected void initialize(const facebook::react::PropsParserContext& context, const facebook::react::Props& sourceProps, const facebook::react::RawProps& rawProps, const std::function& filterObjectKeys = nullptr); public Props() = default; - public Props(const facebook::react::Props& other) = delete; + public Props(const facebook::react::Props& other) = default; public Props(const facebook::react::PropsParserContext& context, const facebook::react::Props& sourceProps, const facebook::react::RawProps& rawProps, const std::function& filterObjectKeys = nullptr); public facebook::react::Props& operator=(const facebook::react::Props& other) = delete; public folly::dynamic rawProps; @@ -4191,12 +4199,14 @@ class facebook::react::RawProps { public RawProps(facebook::react::RawProps&& other) noexcept = default; public RawProps(folly::dynamic dynamic) noexcept; public bool isEmpty() const noexcept; - public const facebook::react::RawValue* at(const char* name, const char* prefix, const char* suffix) const noexcept; + public const facebook::react::RawValue* at(const char* name) const noexcept; public facebook::react::RawProps& operator=(const facebook::react::RawProps& other) noexcept = delete; public facebook::react::RawProps& operator=(facebook::react::RawProps&& other) noexcept = delete; public folly::dynamic toDynamic(const std::function& filterObjectKeys = nullptr) const; public operator folly::dynamic() const; public void parse(const facebook::react::RawPropsParser& parser) noexcept; + template + public void forEachItem(Fn&& fn) const; } enum facebook::react::RawProps::Mode { @@ -4205,17 +4215,9 @@ enum facebook::react::RawProps::Mode { JSI, } -class facebook::react::RawPropsKey { - public const char* name; - public const char* prefix; - public const char* suffix; - public operator std::string() const noexcept; - public void render(char* buffer, facebook::react::RawPropsPropNameLength* length) const noexcept; -} - class facebook::react::RawPropsKeyMap { - public facebook::react::RawPropsValueIndex at(const char* name, facebook::react::RawPropsPropNameLength length) noexcept; - public void insert(const facebook::react::RawPropsKey& key, facebook::react::RawPropsValueIndex value) noexcept; + public facebook::react::RawPropsValueIndex at(std::string_view name) noexcept; + public void insert(std::string_view key, facebook::react::RawPropsValueIndex value) noexcept; public void reindex() noexcept; } @@ -7120,6 +7122,37 @@ struct facebook::react::CallbackWithId { public facebook::react::CallbackId callbackId; } +struct facebook::react::CascadedRectangleCornersNames { + public const char* all; + public const char* bottomEnd; + public const char* bottomLeft; + public const char* bottomRight; + public const char* bottomStart; + public const char* endEnd; + public const char* endStart; + public const char* startEnd; + public const char* startStart; + public const char* topEnd; + public const char* topLeft; + public const char* topRight; + public const char* topStart; +} + +struct facebook::react::CascadedRectangleEdgesNames { + public const char* all; + public const char* block; + public const char* blockEnd; + public const char* blockStart; + public const char* bottom; + public const char* end; + public const char* horizontal; + public const char* left; + public const char* right; + public const char* start; + public const char* top; + public const char* vertical; +} + struct facebook::react::ColorComponents { public facebook::react::ColorSpace colorSpace; public float alpha; @@ -8232,6 +8265,7 @@ class facebook::react::ConcreteShadowNode : public BaseShadowNodeT { public static facebook::react::ComponentHandle Handle(); public static facebook::react::ComponentName Name(); public static facebook::react::ConcreteShadowNode::ConcreteStateData initialStateData(const facebook::react::Props::Shared&, const facebook::react::ShadowNodeFamily::Shared&, const facebook::react::ComponentDescriptor&); + public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::Props::Shared& baseProps); public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const facebook::react::Props::Shared& baseProps = nullptr); public static facebook::react::ShadowNodeTraits BaseTraits(); public static void initializeDynamicProps(facebook::react::ConcreteShadowNode::UnsharedConcreteProps props, const facebook::react::RawProps& rawProps, const facebook::react::Props::Shared& baseProps = nullptr); @@ -9916,6 +9950,8 @@ template std::optional facebook::react::detail::parseLegacyHslFunction(facebook::react::CSSValueParser& parser); template std::optional facebook::react::detail::parseModernHslFunction(facebook::react::CSSValueParser& parser); +template +C facebook::react::detail::memberFunctionClass(T C::*); template constexpr std::optional facebook::react::detail::normalizeComponent(const std::variant& component, float baseValue); diff --git a/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api index 837ff53d1b61..9508fecc2ea1 100644 --- a/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api @@ -794,6 +794,15 @@ concept facebook::react::CSSSyntaxVisitorReturn = std::is_default_constructible_ template concept facebook::react::CSSValidCompoundDataType = facebook::react::detail::is_variant_of_data_types::value; template +concept facebook::react::DeclaresOwnSetProp = std::is_same_v; +template +concept facebook::react::HasIteratorSetterCtor = std::copy_constructible && std::derived_from && HasSetProp; +template +concept facebook::react::HasSetProp = DeclaresOwnSetProp && +requires(T& t, const facebook::react::PropsParserContext& ctx, facebook::react::RawPropsPropNameHash hash, const char* name, const facebook::react::RawValue& value) { + { t.setProp(ctx, hash, name, value) } -> std::same_as; +}; +template concept facebook::react::Hashable = !std::is_same_v&& (requires(T a) { { std::hash{}(a) } -> std::convertible_to; }); @@ -1016,7 +1025,7 @@ facebook::react::ComponentDescriptorProvider facebook::react::concreteComponentD template DestinationTimePointT facebook::react::clockCast(SourceTimePointT timePoint); template -T facebook::react::convertRawProp(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const char* name, const T& sourceValue, const U& defaultValue, const char* namePrefix = nullptr, const char* nameSuffix = nullptr); +T facebook::react::convertRawProp(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const char* name, const T& sourceValue, const U& defaultValue); template T facebook::react::get(const facebook::react::AnimatedPropBase& animatedProp); template @@ -1161,7 +1170,6 @@ bool facebook::react::operator==(const facebook::react::LayoutContext& lhs, cons bool facebook::react::operator==(const facebook::react::LineMeasureCacheKey& lhs, const facebook::react::LineMeasureCacheKey& rhs); bool facebook::react::operator==(const facebook::react::PerformanceObserver& lhs, const facebook::react::PerformanceObserver& rhs); bool facebook::react::operator==(const facebook::react::PreparedTextCacheKey& lhs, const facebook::react::PreparedTextCacheKey& rhs); -bool facebook::react::operator==(const facebook::react::RawPropsKey& lhs, const facebook::react::RawPropsKey& rhs) noexcept; bool facebook::react::operator==(const facebook::react::Size& rhs, const facebook::react::Size& lhs) noexcept; bool facebook::react::operator==(const facebook::react::TextMeasureCacheKey& lhs, const facebook::react::TextMeasureCacheKey& rhs); constexpr bool facebook::react::operator&(facebook::react::ModalHostViewSupportedOrientationsMask const lhs, enum facebook::react::ModalHostViewSupportedOrientations const rhs); @@ -3982,7 +3990,7 @@ class facebook::react::PreparedTextCacheKey { class facebook::react::Props : public virtual facebook::react::Sealable, public virtual facebook::react::DebugStringConvertible { protected void initialize(const facebook::react::PropsParserContext& context, const facebook::react::Props& sourceProps, const facebook::react::RawProps& rawProps, const std::function& filterObjectKeys = nullptr); public Props() = default; - public Props(const facebook::react::Props& other) = delete; + public Props(const facebook::react::Props& other) = default; public Props(const facebook::react::PropsParserContext& context, const facebook::react::Props& sourceProps, const facebook::react::RawProps& rawProps, const std::function& filterObjectKeys = nullptr); public facebook::react::Props& operator=(const facebook::react::Props& other) = delete; public folly::dynamic rawProps; @@ -4035,12 +4043,14 @@ class facebook::react::RawProps { public RawProps(facebook::react::RawProps&& other) noexcept = default; public RawProps(folly::dynamic dynamic) noexcept; public bool isEmpty() const noexcept; - public const facebook::react::RawValue* at(const char* name, const char* prefix, const char* suffix) const noexcept; + public const facebook::react::RawValue* at(const char* name) const noexcept; public facebook::react::RawProps& operator=(const facebook::react::RawProps& other) noexcept = delete; public facebook::react::RawProps& operator=(facebook::react::RawProps&& other) noexcept = delete; public folly::dynamic toDynamic(const std::function& filterObjectKeys = nullptr) const; public operator folly::dynamic() const; public void parse(const facebook::react::RawPropsParser& parser) noexcept; + template + public void forEachItem(Fn&& fn) const; } enum facebook::react::RawProps::Mode { @@ -4049,17 +4059,9 @@ enum facebook::react::RawProps::Mode { JSI, } -class facebook::react::RawPropsKey { - public const char* name; - public const char* prefix; - public const char* suffix; - public operator std::string() const noexcept; - public void render(char* buffer, facebook::react::RawPropsPropNameLength* length) const noexcept; -} - class facebook::react::RawPropsKeyMap { - public facebook::react::RawPropsValueIndex at(const char* name, facebook::react::RawPropsPropNameLength length) noexcept; - public void insert(const facebook::react::RawPropsKey& key, facebook::react::RawPropsValueIndex value) noexcept; + public facebook::react::RawPropsValueIndex at(std::string_view name) noexcept; + public void insert(std::string_view key, facebook::react::RawPropsValueIndex value) noexcept; public void reindex() noexcept; } @@ -6934,6 +6936,37 @@ struct facebook::react::CallbackWithId { public facebook::react::CallbackId callbackId; } +struct facebook::react::CascadedRectangleCornersNames { + public const char* all; + public const char* bottomEnd; + public const char* bottomLeft; + public const char* bottomRight; + public const char* bottomStart; + public const char* endEnd; + public const char* endStart; + public const char* startEnd; + public const char* startStart; + public const char* topEnd; + public const char* topLeft; + public const char* topRight; + public const char* topStart; +} + +struct facebook::react::CascadedRectangleEdgesNames { + public const char* all; + public const char* block; + public const char* blockEnd; + public const char* blockStart; + public const char* bottom; + public const char* end; + public const char* horizontal; + public const char* left; + public const char* right; + public const char* start; + public const char* top; + public const char* vertical; +} + struct facebook::react::ColorComponents { public facebook::react::ColorSpace colorSpace; public float alpha; @@ -7996,6 +8029,7 @@ class facebook::react::ConcreteShadowNode : public BaseShadowNodeT { public static facebook::react::ComponentHandle Handle(); public static facebook::react::ComponentName Name(); public static facebook::react::ConcreteShadowNode::ConcreteStateData initialStateData(const facebook::react::Props::Shared&, const facebook::react::ShadowNodeFamily::Shared&, const facebook::react::ComponentDescriptor&); + public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::Props::Shared& baseProps); public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const facebook::react::Props::Shared& baseProps = nullptr); public static facebook::react::ShadowNodeTraits BaseTraits(); public static void initializeDynamicProps(facebook::react::ConcreteShadowNode::UnsharedConcreteProps props, const facebook::react::RawProps& rawProps, const facebook::react::Props::Shared& baseProps = nullptr); @@ -9542,6 +9576,8 @@ template std::optional facebook::react::detail::parseLegacyHslFunction(facebook::react::CSSValueParser& parser); template std::optional facebook::react::detail::parseModernHslFunction(facebook::react::CSSValueParser& parser); +template +C facebook::react::detail::memberFunctionClass(T C::*); template constexpr std::optional facebook::react::detail::normalizeComponent(const std::variant& component, float baseValue); diff --git a/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api index 3a0800477f40..7bb5c994eaf7 100644 --- a/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api @@ -795,6 +795,15 @@ concept facebook::react::CSSSyntaxVisitorReturn = std::is_default_constructible_ template concept facebook::react::CSSValidCompoundDataType = facebook::react::detail::is_variant_of_data_types::value; template +concept facebook::react::DeclaresOwnSetProp = std::is_same_v; +template +concept facebook::react::HasIteratorSetterCtor = std::copy_constructible && std::derived_from && HasSetProp; +template +concept facebook::react::HasSetProp = DeclaresOwnSetProp && +requires(T& t, const facebook::react::PropsParserContext& ctx, facebook::react::RawPropsPropNameHash hash, const char* name, const facebook::react::RawValue& value) { + { t.setProp(ctx, hash, name, value) } -> std::same_as; +}; +template concept facebook::react::Hashable = !std::is_same_v&& (requires(T a) { { std::hash{}(a) } -> std::convertible_to; }); @@ -1020,7 +1029,7 @@ facebook::react::ComponentDescriptorProvider facebook::react::concreteComponentD template DestinationTimePointT facebook::react::clockCast(SourceTimePointT timePoint); template -T facebook::react::convertRawProp(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const char* name, const T& sourceValue, const U& defaultValue, const char* namePrefix = nullptr, const char* nameSuffix = nullptr); +T facebook::react::convertRawProp(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const char* name, const T& sourceValue, const U& defaultValue); template T facebook::react::get(const facebook::react::AnimatedPropBase& animatedProp); template @@ -1165,7 +1174,6 @@ bool facebook::react::operator==(const facebook::react::LayoutContext& lhs, cons bool facebook::react::operator==(const facebook::react::LineMeasureCacheKey& lhs, const facebook::react::LineMeasureCacheKey& rhs); bool facebook::react::operator==(const facebook::react::PerformanceObserver& lhs, const facebook::react::PerformanceObserver& rhs); bool facebook::react::operator==(const facebook::react::PreparedTextCacheKey& lhs, const facebook::react::PreparedTextCacheKey& rhs); -bool facebook::react::operator==(const facebook::react::RawPropsKey& lhs, const facebook::react::RawPropsKey& rhs) noexcept; bool facebook::react::operator==(const facebook::react::Size& rhs, const facebook::react::Size& lhs) noexcept; bool facebook::react::operator==(const facebook::react::TextMeasureCacheKey& lhs, const facebook::react::TextMeasureCacheKey& rhs); constexpr bool facebook::react::operator&(facebook::react::ModalHostViewSupportedOrientationsMask const lhs, enum facebook::react::ModalHostViewSupportedOrientations const rhs); @@ -4125,7 +4133,7 @@ class facebook::react::PreparedTextCacheKey { class facebook::react::Props : public virtual facebook::react::Sealable, public virtual facebook::react::DebugStringConvertible { protected void initialize(const facebook::react::PropsParserContext& context, const facebook::react::Props& sourceProps, const facebook::react::RawProps& rawProps, const std::function& filterObjectKeys = nullptr); public Props() = default; - public Props(const facebook::react::Props& other) = delete; + public Props(const facebook::react::Props& other) = default; public Props(const facebook::react::PropsParserContext& context, const facebook::react::Props& sourceProps, const facebook::react::RawProps& rawProps, const std::function& filterObjectKeys = nullptr); public facebook::react::Props& operator=(const facebook::react::Props& other) = delete; public folly::dynamic rawProps; @@ -4188,12 +4196,14 @@ class facebook::react::RawProps { public RawProps(facebook::react::RawProps&& other) noexcept = default; public RawProps(folly::dynamic dynamic) noexcept; public bool isEmpty() const noexcept; - public const facebook::react::RawValue* at(const char* name, const char* prefix, const char* suffix) const noexcept; + public const facebook::react::RawValue* at(const char* name) const noexcept; public facebook::react::RawProps& operator=(const facebook::react::RawProps& other) noexcept = delete; public facebook::react::RawProps& operator=(facebook::react::RawProps&& other) noexcept = delete; public folly::dynamic toDynamic(const std::function& filterObjectKeys = nullptr) const; public operator folly::dynamic() const; public void parse(const facebook::react::RawPropsParser& parser) noexcept; + template + public void forEachItem(Fn&& fn) const; } enum facebook::react::RawProps::Mode { @@ -4202,17 +4212,9 @@ enum facebook::react::RawProps::Mode { JSI, } -class facebook::react::RawPropsKey { - public const char* name; - public const char* prefix; - public const char* suffix; - public operator std::string() const noexcept; - public void render(char* buffer, facebook::react::RawPropsPropNameLength* length) const noexcept; -} - class facebook::react::RawPropsKeyMap { - public facebook::react::RawPropsValueIndex at(const char* name, facebook::react::RawPropsPropNameLength length) noexcept; - public void insert(const facebook::react::RawPropsKey& key, facebook::react::RawPropsValueIndex value) noexcept; + public facebook::react::RawPropsValueIndex at(std::string_view name) noexcept; + public void insert(std::string_view key, facebook::react::RawPropsValueIndex value) noexcept; public void reindex() noexcept; } @@ -7111,6 +7113,37 @@ struct facebook::react::CallbackWithId { public facebook::react::CallbackId callbackId; } +struct facebook::react::CascadedRectangleCornersNames { + public const char* all; + public const char* bottomEnd; + public const char* bottomLeft; + public const char* bottomRight; + public const char* bottomStart; + public const char* endEnd; + public const char* endStart; + public const char* startEnd; + public const char* startStart; + public const char* topEnd; + public const char* topLeft; + public const char* topRight; + public const char* topStart; +} + +struct facebook::react::CascadedRectangleEdgesNames { + public const char* all; + public const char* block; + public const char* blockEnd; + public const char* blockStart; + public const char* bottom; + public const char* end; + public const char* horizontal; + public const char* left; + public const char* right; + public const char* start; + public const char* top; + public const char* vertical; +} + struct facebook::react::ColorComponents { public facebook::react::ColorSpace colorSpace; public float alpha; @@ -8223,6 +8256,7 @@ class facebook::react::ConcreteShadowNode : public BaseShadowNodeT { public static facebook::react::ComponentHandle Handle(); public static facebook::react::ComponentName Name(); public static facebook::react::ConcreteShadowNode::ConcreteStateData initialStateData(const facebook::react::Props::Shared&, const facebook::react::ShadowNodeFamily::Shared&, const facebook::react::ComponentDescriptor&); + public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::Props::Shared& baseProps); public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const facebook::react::Props::Shared& baseProps = nullptr); public static facebook::react::ShadowNodeTraits BaseTraits(); public static void initializeDynamicProps(facebook::react::ConcreteShadowNode::UnsharedConcreteProps props, const facebook::react::RawProps& rawProps, const facebook::react::Props::Shared& baseProps = nullptr); @@ -9769,6 +9803,8 @@ template std::optional facebook::react::detail::parseLegacyHslFunction(facebook::react::CSSValueParser& parser); template std::optional facebook::react::detail::parseModernHslFunction(facebook::react::CSSValueParser& parser); +template +C facebook::react::detail::memberFunctionClass(T C::*); template constexpr std::optional facebook::react::detail::normalizeComponent(const std::variant& component, float baseValue); diff --git a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api index 5ef595005d8a..ad2b2f51e787 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api @@ -3651,6 +3651,15 @@ concept facebook::react::CSSSyntaxVisitorReturn = std::is_default_constructible_ template concept facebook::react::CSSValidCompoundDataType = facebook::react::detail::is_variant_of_data_types::value; template +concept facebook::react::DeclaresOwnSetProp = std::is_same_v; +template +concept facebook::react::HasIteratorSetterCtor = std::copy_constructible && std::derived_from && HasSetProp; +template +concept facebook::react::HasSetProp = DeclaresOwnSetProp && +requires(T& t, const facebook::react::PropsParserContext& ctx, facebook::react::RawPropsPropNameHash hash, const char* name, const facebook::react::RawValue& value) { + { t.setProp(ctx, hash, name, value) } -> std::same_as; +}; +template concept facebook::react::Hashable = !std::is_same_v&& (requires(T a) { { std::hash{}(a) } -> std::convertible_to; }); @@ -3853,7 +3862,7 @@ DestinationTimePointT facebook::react::clockCast(SourceTimePointT timePoint); template RCTManagedPointer* facebook::react::managedPointer(P initializer); template -T facebook::react::convertRawProp(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const char* name, const T& sourceValue, const U& defaultValue, const char* namePrefix = nullptr, const char* nameSuffix = nullptr); +T facebook::react::convertRawProp(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const char* name, const T& sourceValue, const U& defaultValue); template T facebook::react::get(const facebook::react::AnimatedPropBase& animatedProp); template @@ -4000,7 +4009,6 @@ bool facebook::react::operator==(const facebook::react::LayoutContext& lhs, cons bool facebook::react::operator==(const facebook::react::LineMeasureCacheKey& lhs, const facebook::react::LineMeasureCacheKey& rhs); bool facebook::react::operator==(const facebook::react::PerformanceObserver& lhs, const facebook::react::PerformanceObserver& rhs); bool facebook::react::operator==(const facebook::react::PreparedTextCacheKey& lhs, const facebook::react::PreparedTextCacheKey& rhs); -bool facebook::react::operator==(const facebook::react::RawPropsKey& lhs, const facebook::react::RawPropsKey& rhs) noexcept; bool facebook::react::operator==(const facebook::react::Size& rhs, const facebook::react::Size& lhs) noexcept; bool facebook::react::operator==(const facebook::react::TextMeasureCacheKey& lhs, const facebook::react::TextMeasureCacheKey& rhs); constexpr bool facebook::react::operator&(facebook::react::ModalHostViewSupportedOrientationsMask const lhs, enum facebook::react::ModalHostViewSupportedOrientations const rhs); @@ -6315,7 +6323,7 @@ class facebook::react::PreparedTextCacheKey { class facebook::react::Props : public virtual facebook::react::Sealable, public virtual facebook::react::DebugStringConvertible { protected void initialize(const facebook::react::PropsParserContext& context, const facebook::react::Props& sourceProps, const facebook::react::RawProps& rawProps, const std::function& filterObjectKeys = nullptr); public Props() = default; - public Props(const facebook::react::Props& other) = delete; + public Props(const facebook::react::Props& other) = default; public Props(const facebook::react::PropsParserContext& context, const facebook::react::Props& sourceProps, const facebook::react::RawProps& rawProps, const std::function& filterObjectKeys = nullptr); public facebook::react::Props& operator=(const facebook::react::Props& other) = delete; public std::string nativeId; @@ -6408,12 +6416,14 @@ class facebook::react::RawProps { public RawProps(facebook::react::RawProps&& other) noexcept = default; public RawProps(folly::dynamic dynamic) noexcept; public bool isEmpty() const noexcept; - public const facebook::react::RawValue* at(const char* name, const char* prefix, const char* suffix) const noexcept; + public const facebook::react::RawValue* at(const char* name) const noexcept; public facebook::react::RawProps& operator=(const facebook::react::RawProps& other) noexcept = delete; public facebook::react::RawProps& operator=(facebook::react::RawProps&& other) noexcept = delete; public folly::dynamic toDynamic(const std::function& filterObjectKeys = nullptr) const; public operator folly::dynamic() const; public void parse(const facebook::react::RawPropsParser& parser) noexcept; + template + public void forEachItem(Fn&& fn) const; } enum facebook::react::RawProps::Mode { @@ -6422,17 +6432,9 @@ enum facebook::react::RawProps::Mode { JSI, } -class facebook::react::RawPropsKey { - public const char* name; - public const char* prefix; - public const char* suffix; - public operator std::string() const noexcept; - public void render(char* buffer, facebook::react::RawPropsPropNameLength* length) const noexcept; -} - class facebook::react::RawPropsKeyMap { - public facebook::react::RawPropsValueIndex at(const char* name, facebook::react::RawPropsPropNameLength length) noexcept; - public void insert(const facebook::react::RawPropsKey& key, facebook::react::RawPropsValueIndex value) noexcept; + public facebook::react::RawPropsValueIndex at(std::string_view name) noexcept; + public void insert(std::string_view key, facebook::react::RawPropsValueIndex value) noexcept; public void reindex() noexcept; } @@ -9308,6 +9310,37 @@ struct facebook::react::CallbackWithId { public facebook::react::CallbackId callbackId; } +struct facebook::react::CascadedRectangleCornersNames { + public const char* all; + public const char* bottomEnd; + public const char* bottomLeft; + public const char* bottomRight; + public const char* bottomStart; + public const char* endEnd; + public const char* endStart; + public const char* startEnd; + public const char* startStart; + public const char* topEnd; + public const char* topLeft; + public const char* topRight; + public const char* topStart; +} + +struct facebook::react::CascadedRectangleEdgesNames { + public const char* all; + public const char* block; + public const char* blockEnd; + public const char* blockStart; + public const char* bottom; + public const char* end; + public const char* horizontal; + public const char* left; + public const char* right; + public const char* start; + public const char* top; + public const char* vertical; +} + struct facebook::react::Color { public Color(); public Color(const facebook::react::ColorComponents& components); @@ -10213,6 +10246,7 @@ class facebook::react::ConcreteShadowNode : public BaseShadowNodeT { public static facebook::react::ComponentHandle Handle(); public static facebook::react::ComponentName Name(); public static facebook::react::ConcreteShadowNode::ConcreteStateData initialStateData(const facebook::react::Props::Shared&, const facebook::react::ShadowNodeFamily::Shared&, const facebook::react::ComponentDescriptor&); + public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::Props::Shared& baseProps); public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const facebook::react::Props::Shared& baseProps = nullptr); public static facebook::react::ShadowNodeTraits BaseTraits(); public using ConcreteEventEmitter = EventEmitterT; @@ -11814,6 +11848,8 @@ template std::optional facebook::react::detail::parseLegacyHslFunction(facebook::react::CSSValueParser& parser); template std::optional facebook::react::detail::parseModernHslFunction(facebook::react::CSSValueParser& parser); +template +C facebook::react::detail::memberFunctionClass(T C::*); template constexpr std::optional facebook::react::detail::normalizeComponent(const std::variant& component, float baseValue); diff --git a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api index 80f834aa2350..e4477bb3e825 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api @@ -3638,6 +3638,15 @@ concept facebook::react::CSSSyntaxVisitorReturn = std::is_default_constructible_ template concept facebook::react::CSSValidCompoundDataType = facebook::react::detail::is_variant_of_data_types::value; template +concept facebook::react::DeclaresOwnSetProp = std::is_same_v; +template +concept facebook::react::HasIteratorSetterCtor = std::copy_constructible && std::derived_from && HasSetProp; +template +concept facebook::react::HasSetProp = DeclaresOwnSetProp && +requires(T& t, const facebook::react::PropsParserContext& ctx, facebook::react::RawPropsPropNameHash hash, const char* name, const facebook::react::RawValue& value) { + { t.setProp(ctx, hash, name, value) } -> std::same_as; +}; +template concept facebook::react::Hashable = !std::is_same_v&& (requires(T a) { { std::hash{}(a) } -> std::convertible_to; }); @@ -3838,7 +3847,7 @@ DestinationTimePointT facebook::react::clockCast(SourceTimePointT timePoint); template RCTManagedPointer* facebook::react::managedPointer(P initializer); template -T facebook::react::convertRawProp(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const char* name, const T& sourceValue, const U& defaultValue, const char* namePrefix = nullptr, const char* nameSuffix = nullptr); +T facebook::react::convertRawProp(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const char* name, const T& sourceValue, const U& defaultValue); template T facebook::react::get(const facebook::react::AnimatedPropBase& animatedProp); template @@ -3985,7 +3994,6 @@ bool facebook::react::operator==(const facebook::react::LayoutContext& lhs, cons bool facebook::react::operator==(const facebook::react::LineMeasureCacheKey& lhs, const facebook::react::LineMeasureCacheKey& rhs); bool facebook::react::operator==(const facebook::react::PerformanceObserver& lhs, const facebook::react::PerformanceObserver& rhs); bool facebook::react::operator==(const facebook::react::PreparedTextCacheKey& lhs, const facebook::react::PreparedTextCacheKey& rhs); -bool facebook::react::operator==(const facebook::react::RawPropsKey& lhs, const facebook::react::RawPropsKey& rhs) noexcept; bool facebook::react::operator==(const facebook::react::Size& rhs, const facebook::react::Size& lhs) noexcept; bool facebook::react::operator==(const facebook::react::TextMeasureCacheKey& lhs, const facebook::react::TextMeasureCacheKey& rhs); constexpr bool facebook::react::operator&(facebook::react::ModalHostViewSupportedOrientationsMask const lhs, enum facebook::react::ModalHostViewSupportedOrientations const rhs); @@ -6197,7 +6205,7 @@ class facebook::react::PreparedTextCacheKey { class facebook::react::Props : public virtual facebook::react::Sealable, public virtual facebook::react::DebugStringConvertible { protected void initialize(const facebook::react::PropsParserContext& context, const facebook::react::Props& sourceProps, const facebook::react::RawProps& rawProps, const std::function& filterObjectKeys = nullptr); public Props() = default; - public Props(const facebook::react::Props& other) = delete; + public Props(const facebook::react::Props& other) = default; public Props(const facebook::react::PropsParserContext& context, const facebook::react::Props& sourceProps, const facebook::react::RawProps& rawProps, const std::function& filterObjectKeys = nullptr); public facebook::react::Props& operator=(const facebook::react::Props& other) = delete; public std::string nativeId; @@ -6280,12 +6288,14 @@ class facebook::react::RawProps { public RawProps(facebook::react::RawProps&& other) noexcept = default; public RawProps(folly::dynamic dynamic) noexcept; public bool isEmpty() const noexcept; - public const facebook::react::RawValue* at(const char* name, const char* prefix, const char* suffix) const noexcept; + public const facebook::react::RawValue* at(const char* name) const noexcept; public facebook::react::RawProps& operator=(const facebook::react::RawProps& other) noexcept = delete; public facebook::react::RawProps& operator=(facebook::react::RawProps&& other) noexcept = delete; public folly::dynamic toDynamic(const std::function& filterObjectKeys = nullptr) const; public operator folly::dynamic() const; public void parse(const facebook::react::RawPropsParser& parser) noexcept; + template + public void forEachItem(Fn&& fn) const; } enum facebook::react::RawProps::Mode { @@ -6294,17 +6304,9 @@ enum facebook::react::RawProps::Mode { JSI, } -class facebook::react::RawPropsKey { - public const char* name; - public const char* prefix; - public const char* suffix; - public operator std::string() const noexcept; - public void render(char* buffer, facebook::react::RawPropsPropNameLength* length) const noexcept; -} - class facebook::react::RawPropsKeyMap { - public facebook::react::RawPropsValueIndex at(const char* name, facebook::react::RawPropsPropNameLength length) noexcept; - public void insert(const facebook::react::RawPropsKey& key, facebook::react::RawPropsValueIndex value) noexcept; + public facebook::react::RawPropsValueIndex at(std::string_view name) noexcept; + public void insert(std::string_view key, facebook::react::RawPropsValueIndex value) noexcept; public void reindex() noexcept; } @@ -9150,6 +9152,37 @@ struct facebook::react::CallbackWithId { public facebook::react::CallbackId callbackId; } +struct facebook::react::CascadedRectangleCornersNames { + public const char* all; + public const char* bottomEnd; + public const char* bottomLeft; + public const char* bottomRight; + public const char* bottomStart; + public const char* endEnd; + public const char* endStart; + public const char* startEnd; + public const char* startStart; + public const char* topEnd; + public const char* topLeft; + public const char* topRight; + public const char* topStart; +} + +struct facebook::react::CascadedRectangleEdgesNames { + public const char* all; + public const char* block; + public const char* blockEnd; + public const char* blockStart; + public const char* bottom; + public const char* end; + public const char* horizontal; + public const char* left; + public const char* right; + public const char* start; + public const char* top; + public const char* vertical; +} + struct facebook::react::Color { public Color(); public Color(const facebook::react::ColorComponents& components); @@ -10029,6 +10062,7 @@ class facebook::react::ConcreteShadowNode : public BaseShadowNodeT { public static facebook::react::ComponentHandle Handle(); public static facebook::react::ComponentName Name(); public static facebook::react::ConcreteShadowNode::ConcreteStateData initialStateData(const facebook::react::Props::Shared&, const facebook::react::ShadowNodeFamily::Shared&, const facebook::react::ComponentDescriptor&); + public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::Props::Shared& baseProps); public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const facebook::react::Props::Shared& baseProps = nullptr); public static facebook::react::ShadowNodeTraits BaseTraits(); public using ConcreteEventEmitter = EventEmitterT; @@ -11502,6 +11536,8 @@ template std::optional facebook::react::detail::parseLegacyHslFunction(facebook::react::CSSValueParser& parser); template std::optional facebook::react::detail::parseModernHslFunction(facebook::react::CSSValueParser& parser); +template +C facebook::react::detail::memberFunctionClass(T C::*); template constexpr std::optional facebook::react::detail::normalizeComponent(const std::variant& component, float baseValue); diff --git a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api index bc1b98fae6e6..33263f40cb00 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api @@ -3651,6 +3651,15 @@ concept facebook::react::CSSSyntaxVisitorReturn = std::is_default_constructible_ template concept facebook::react::CSSValidCompoundDataType = facebook::react::detail::is_variant_of_data_types::value; template +concept facebook::react::DeclaresOwnSetProp = std::is_same_v; +template +concept facebook::react::HasIteratorSetterCtor = std::copy_constructible && std::derived_from && HasSetProp; +template +concept facebook::react::HasSetProp = DeclaresOwnSetProp && +requires(T& t, const facebook::react::PropsParserContext& ctx, facebook::react::RawPropsPropNameHash hash, const char* name, const facebook::react::RawValue& value) { + { t.setProp(ctx, hash, name, value) } -> std::same_as; +}; +template concept facebook::react::Hashable = !std::is_same_v&& (requires(T a) { { std::hash{}(a) } -> std::convertible_to; }); @@ -3853,7 +3862,7 @@ DestinationTimePointT facebook::react::clockCast(SourceTimePointT timePoint); template RCTManagedPointer* facebook::react::managedPointer(P initializer); template -T facebook::react::convertRawProp(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const char* name, const T& sourceValue, const U& defaultValue, const char* namePrefix = nullptr, const char* nameSuffix = nullptr); +T facebook::react::convertRawProp(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const char* name, const T& sourceValue, const U& defaultValue); template T facebook::react::get(const facebook::react::AnimatedPropBase& animatedProp); template @@ -4000,7 +4009,6 @@ bool facebook::react::operator==(const facebook::react::LayoutContext& lhs, cons bool facebook::react::operator==(const facebook::react::LineMeasureCacheKey& lhs, const facebook::react::LineMeasureCacheKey& rhs); bool facebook::react::operator==(const facebook::react::PerformanceObserver& lhs, const facebook::react::PerformanceObserver& rhs); bool facebook::react::operator==(const facebook::react::PreparedTextCacheKey& lhs, const facebook::react::PreparedTextCacheKey& rhs); -bool facebook::react::operator==(const facebook::react::RawPropsKey& lhs, const facebook::react::RawPropsKey& rhs) noexcept; bool facebook::react::operator==(const facebook::react::Size& rhs, const facebook::react::Size& lhs) noexcept; bool facebook::react::operator==(const facebook::react::TextMeasureCacheKey& lhs, const facebook::react::TextMeasureCacheKey& rhs); constexpr bool facebook::react::operator&(facebook::react::ModalHostViewSupportedOrientationsMask const lhs, enum facebook::react::ModalHostViewSupportedOrientations const rhs); @@ -6312,7 +6320,7 @@ class facebook::react::PreparedTextCacheKey { class facebook::react::Props : public virtual facebook::react::Sealable, public virtual facebook::react::DebugStringConvertible { protected void initialize(const facebook::react::PropsParserContext& context, const facebook::react::Props& sourceProps, const facebook::react::RawProps& rawProps, const std::function& filterObjectKeys = nullptr); public Props() = default; - public Props(const facebook::react::Props& other) = delete; + public Props(const facebook::react::Props& other) = default; public Props(const facebook::react::PropsParserContext& context, const facebook::react::Props& sourceProps, const facebook::react::RawProps& rawProps, const std::function& filterObjectKeys = nullptr); public facebook::react::Props& operator=(const facebook::react::Props& other) = delete; public std::string nativeId; @@ -6405,12 +6413,14 @@ class facebook::react::RawProps { public RawProps(facebook::react::RawProps&& other) noexcept = default; public RawProps(folly::dynamic dynamic) noexcept; public bool isEmpty() const noexcept; - public const facebook::react::RawValue* at(const char* name, const char* prefix, const char* suffix) const noexcept; + public const facebook::react::RawValue* at(const char* name) const noexcept; public facebook::react::RawProps& operator=(const facebook::react::RawProps& other) noexcept = delete; public facebook::react::RawProps& operator=(facebook::react::RawProps&& other) noexcept = delete; public folly::dynamic toDynamic(const std::function& filterObjectKeys = nullptr) const; public operator folly::dynamic() const; public void parse(const facebook::react::RawPropsParser& parser) noexcept; + template + public void forEachItem(Fn&& fn) const; } enum facebook::react::RawProps::Mode { @@ -6419,17 +6429,9 @@ enum facebook::react::RawProps::Mode { JSI, } -class facebook::react::RawPropsKey { - public const char* name; - public const char* prefix; - public const char* suffix; - public operator std::string() const noexcept; - public void render(char* buffer, facebook::react::RawPropsPropNameLength* length) const noexcept; -} - class facebook::react::RawPropsKeyMap { - public facebook::react::RawPropsValueIndex at(const char* name, facebook::react::RawPropsPropNameLength length) noexcept; - public void insert(const facebook::react::RawPropsKey& key, facebook::react::RawPropsValueIndex value) noexcept; + public facebook::react::RawPropsValueIndex at(std::string_view name) noexcept; + public void insert(std::string_view key, facebook::react::RawPropsValueIndex value) noexcept; public void reindex() noexcept; } @@ -9299,6 +9301,37 @@ struct facebook::react::CallbackWithId { public facebook::react::CallbackId callbackId; } +struct facebook::react::CascadedRectangleCornersNames { + public const char* all; + public const char* bottomEnd; + public const char* bottomLeft; + public const char* bottomRight; + public const char* bottomStart; + public const char* endEnd; + public const char* endStart; + public const char* startEnd; + public const char* startStart; + public const char* topEnd; + public const char* topLeft; + public const char* topRight; + public const char* topStart; +} + +struct facebook::react::CascadedRectangleEdgesNames { + public const char* all; + public const char* block; + public const char* blockEnd; + public const char* blockStart; + public const char* bottom; + public const char* end; + public const char* horizontal; + public const char* left; + public const char* right; + public const char* start; + public const char* top; + public const char* vertical; +} + struct facebook::react::Color { public Color(); public Color(const facebook::react::ColorComponents& components); @@ -10204,6 +10237,7 @@ class facebook::react::ConcreteShadowNode : public BaseShadowNodeT { public static facebook::react::ComponentHandle Handle(); public static facebook::react::ComponentName Name(); public static facebook::react::ConcreteShadowNode::ConcreteStateData initialStateData(const facebook::react::Props::Shared&, const facebook::react::ShadowNodeFamily::Shared&, const facebook::react::ComponentDescriptor&); + public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::Props::Shared& baseProps); public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const facebook::react::Props::Shared& baseProps = nullptr); public static facebook::react::ShadowNodeTraits BaseTraits(); public using ConcreteEventEmitter = EventEmitterT; @@ -11677,6 +11711,8 @@ template std::optional facebook::react::detail::parseLegacyHslFunction(facebook::react::CSSValueParser& parser); template std::optional facebook::react::detail::parseModernHslFunction(facebook::react::CSSValueParser& parser); +template +C facebook::react::detail::memberFunctionClass(T C::*); template constexpr std::optional facebook::react::detail::normalizeComponent(const std::variant& component, float baseValue); diff --git a/scripts/cxx-api/api-snapshots/ReactCommonDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactCommonDebugCxx.api index 4c3b5750c2a3..1f561d145e4a 100644 --- a/scripts/cxx-api/api-snapshots/ReactCommonDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactCommonDebugCxx.api @@ -404,6 +404,15 @@ concept facebook::react::CSSSyntaxVisitorReturn = std::is_default_constructible_ template concept facebook::react::CSSValidCompoundDataType = facebook::react::detail::is_variant_of_data_types::value; template +concept facebook::react::DeclaresOwnSetProp = std::is_same_v; +template +concept facebook::react::HasIteratorSetterCtor = std::copy_constructible && std::derived_from && HasSetProp; +template +concept facebook::react::HasSetProp = DeclaresOwnSetProp && +requires(T& t, const facebook::react::PropsParserContext& ctx, facebook::react::RawPropsPropNameHash hash, const char* name, const facebook::react::RawValue& value) { + { t.setProp(ctx, hash, name, value) } -> std::same_as; +}; +template concept facebook::react::Hashable = !std::is_same_v&& (requires(T a) { { std::hash{}(a) } -> std::convertible_to; }); @@ -590,7 +599,7 @@ facebook::react::ComponentDescriptorProvider facebook::react::concreteComponentD template DestinationTimePointT facebook::react::clockCast(SourceTimePointT timePoint); template -T facebook::react::convertRawProp(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const char* name, const T& sourceValue, const U& defaultValue, const char* namePrefix = nullptr, const char* nameSuffix = nullptr); +T facebook::react::convertRawProp(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const char* name, const T& sourceValue, const U& defaultValue); template T facebook::react::get(const facebook::react::AnimatedPropBase& animatedProp); template @@ -724,7 +733,6 @@ bool facebook::react::operator==(const facebook::react::LayoutContext& lhs, cons bool facebook::react::operator==(const facebook::react::LineMeasureCacheKey& lhs, const facebook::react::LineMeasureCacheKey& rhs); bool facebook::react::operator==(const facebook::react::PerformanceObserver& lhs, const facebook::react::PerformanceObserver& rhs); bool facebook::react::operator==(const facebook::react::PreparedTextCacheKey& lhs, const facebook::react::PreparedTextCacheKey& rhs); -bool facebook::react::operator==(const facebook::react::RawPropsKey& lhs, const facebook::react::RawPropsKey& rhs) noexcept; bool facebook::react::operator==(const facebook::react::Size& rhs, const facebook::react::Size& lhs) noexcept; bool facebook::react::operator==(const facebook::react::TextMeasureCacheKey& lhs, const facebook::react::TextMeasureCacheKey& rhs); constexpr bool facebook::react::operator==(const facebook::react::AccessibilityState& lhs, const facebook::react::AccessibilityState& rhs); @@ -2733,7 +2741,7 @@ class facebook::react::PreparedTextCacheKey { class facebook::react::Props : public virtual facebook::react::Sealable, public virtual facebook::react::DebugStringConvertible { protected void initialize(const facebook::react::PropsParserContext& context, const facebook::react::Props& sourceProps, const facebook::react::RawProps& rawProps, const std::function& filterObjectKeys = nullptr); public Props() = default; - public Props(const facebook::react::Props& other) = delete; + public Props(const facebook::react::Props& other) = default; public Props(const facebook::react::PropsParserContext& context, const facebook::react::Props& sourceProps, const facebook::react::RawProps& rawProps, const std::function& filterObjectKeys = nullptr); public facebook::react::Props& operator=(const facebook::react::Props& other) = delete; public std::string nativeId; @@ -2773,12 +2781,14 @@ class facebook::react::RawProps { public RawProps(facebook::react::RawProps&& other) noexcept = default; public RawProps(folly::dynamic dynamic) noexcept; public bool isEmpty() const noexcept; - public const facebook::react::RawValue* at(const char* name, const char* prefix, const char* suffix) const noexcept; + public const facebook::react::RawValue* at(const char* name) const noexcept; public facebook::react::RawProps& operator=(const facebook::react::RawProps& other) noexcept = delete; public facebook::react::RawProps& operator=(facebook::react::RawProps&& other) noexcept = delete; public folly::dynamic toDynamic(const std::function& filterObjectKeys = nullptr) const; public operator folly::dynamic() const; public void parse(const facebook::react::RawPropsParser& parser) noexcept; + template + public void forEachItem(Fn&& fn) const; } enum facebook::react::RawProps::Mode { @@ -2787,17 +2797,9 @@ enum facebook::react::RawProps::Mode { JSI, } -class facebook::react::RawPropsKey { - public const char* name; - public const char* prefix; - public const char* suffix; - public operator std::string() const noexcept; - public void render(char* buffer, facebook::react::RawPropsPropNameLength* length) const noexcept; -} - class facebook::react::RawPropsKeyMap { - public facebook::react::RawPropsValueIndex at(const char* name, facebook::react::RawPropsPropNameLength length) noexcept; - public void insert(const facebook::react::RawPropsKey& key, facebook::react::RawPropsValueIndex value) noexcept; + public facebook::react::RawPropsValueIndex at(std::string_view name) noexcept; + public void insert(std::string_view key, facebook::react::RawPropsValueIndex value) noexcept; public void reindex() noexcept; } @@ -5451,6 +5453,37 @@ struct facebook::react::CallbackWithId { public facebook::react::CallbackId callbackId; } +struct facebook::react::CascadedRectangleCornersNames { + public const char* all; + public const char* bottomEnd; + public const char* bottomLeft; + public const char* bottomRight; + public const char* bottomStart; + public const char* endEnd; + public const char* endStart; + public const char* startEnd; + public const char* startStart; + public const char* topEnd; + public const char* topLeft; + public const char* topRight; + public const char* topStart; +} + +struct facebook::react::CascadedRectangleEdgesNames { + public const char* all; + public const char* block; + public const char* blockEnd; + public const char* blockStart; + public const char* bottom; + public const char* end; + public const char* horizontal; + public const char* left; + public const char* right; + public const char* start; + public const char* top; + public const char* vertical; +} + struct facebook::react::ColorComponents { public facebook::react::ColorSpace colorSpace; public float alpha; @@ -6322,6 +6355,7 @@ class facebook::react::ConcreteShadowNode : public BaseShadowNodeT { public static facebook::react::ComponentHandle Handle(); public static facebook::react::ComponentName Name(); public static facebook::react::ConcreteShadowNode::ConcreteStateData initialStateData(const facebook::react::Props::Shared&, const facebook::react::ShadowNodeFamily::Shared&, const facebook::react::ComponentDescriptor&); + public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::Props::Shared& baseProps); public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const facebook::react::Props::Shared& baseProps = nullptr); public static facebook::react::ShadowNodeTraits BaseTraits(); public using ConcreteEventEmitter = EventEmitterT; @@ -6976,6 +7010,8 @@ template std::optional facebook::react::detail::parseLegacyHslFunction(facebook::react::CSSValueParser& parser); template std::optional facebook::react::detail::parseModernHslFunction(facebook::react::CSSValueParser& parser); +template +C facebook::react::detail::memberFunctionClass(T C::*); template constexpr std::optional facebook::react::detail::normalizeComponent(const std::variant& component, float baseValue); diff --git a/scripts/cxx-api/api-snapshots/ReactCommonNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactCommonNewarchCxx.api index 2492570e8064..0e17ea3e737c 100644 --- a/scripts/cxx-api/api-snapshots/ReactCommonNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactCommonNewarchCxx.api @@ -403,6 +403,15 @@ concept facebook::react::CSSSyntaxVisitorReturn = std::is_default_constructible_ template concept facebook::react::CSSValidCompoundDataType = facebook::react::detail::is_variant_of_data_types::value; template +concept facebook::react::DeclaresOwnSetProp = std::is_same_v; +template +concept facebook::react::HasIteratorSetterCtor = std::copy_constructible && std::derived_from && HasSetProp; +template +concept facebook::react::HasSetProp = DeclaresOwnSetProp && +requires(T& t, const facebook::react::PropsParserContext& ctx, facebook::react::RawPropsPropNameHash hash, const char* name, const facebook::react::RawValue& value) { + { t.setProp(ctx, hash, name, value) } -> std::same_as; +}; +template concept facebook::react::Hashable = !std::is_same_v&& (requires(T a) { { std::hash{}(a) } -> std::convertible_to; }); @@ -587,7 +596,7 @@ facebook::react::ComponentDescriptorProvider facebook::react::concreteComponentD template DestinationTimePointT facebook::react::clockCast(SourceTimePointT timePoint); template -T facebook::react::convertRawProp(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const char* name, const T& sourceValue, const U& defaultValue, const char* namePrefix = nullptr, const char* nameSuffix = nullptr); +T facebook::react::convertRawProp(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const char* name, const T& sourceValue, const U& defaultValue); template T facebook::react::get(const facebook::react::AnimatedPropBase& animatedProp); template @@ -721,7 +730,6 @@ bool facebook::react::operator==(const facebook::react::LayoutContext& lhs, cons bool facebook::react::operator==(const facebook::react::LineMeasureCacheKey& lhs, const facebook::react::LineMeasureCacheKey& rhs); bool facebook::react::operator==(const facebook::react::PerformanceObserver& lhs, const facebook::react::PerformanceObserver& rhs); bool facebook::react::operator==(const facebook::react::PreparedTextCacheKey& lhs, const facebook::react::PreparedTextCacheKey& rhs); -bool facebook::react::operator==(const facebook::react::RawPropsKey& lhs, const facebook::react::RawPropsKey& rhs) noexcept; bool facebook::react::operator==(const facebook::react::Size& rhs, const facebook::react::Size& lhs) noexcept; bool facebook::react::operator==(const facebook::react::TextMeasureCacheKey& lhs, const facebook::react::TextMeasureCacheKey& rhs); constexpr bool facebook::react::operator==(const facebook::react::AccessibilityState& lhs, const facebook::react::AccessibilityState& rhs); @@ -2627,7 +2635,7 @@ class facebook::react::PreparedTextCacheKey { class facebook::react::Props : public virtual facebook::react::Sealable, public virtual facebook::react::DebugStringConvertible { protected void initialize(const facebook::react::PropsParserContext& context, const facebook::react::Props& sourceProps, const facebook::react::RawProps& rawProps, const std::function& filterObjectKeys = nullptr); public Props() = default; - public Props(const facebook::react::Props& other) = delete; + public Props(const facebook::react::Props& other) = default; public Props(const facebook::react::PropsParserContext& context, const facebook::react::Props& sourceProps, const facebook::react::RawProps& rawProps, const std::function& filterObjectKeys = nullptr); public facebook::react::Props& operator=(const facebook::react::Props& other) = delete; public std::string nativeId; @@ -2657,12 +2665,14 @@ class facebook::react::RawProps { public RawProps(facebook::react::RawProps&& other) noexcept = default; public RawProps(folly::dynamic dynamic) noexcept; public bool isEmpty() const noexcept; - public const facebook::react::RawValue* at(const char* name, const char* prefix, const char* suffix) const noexcept; + public const facebook::react::RawValue* at(const char* name) const noexcept; public facebook::react::RawProps& operator=(const facebook::react::RawProps& other) noexcept = delete; public facebook::react::RawProps& operator=(facebook::react::RawProps&& other) noexcept = delete; public folly::dynamic toDynamic(const std::function& filterObjectKeys = nullptr) const; public operator folly::dynamic() const; public void parse(const facebook::react::RawPropsParser& parser) noexcept; + template + public void forEachItem(Fn&& fn) const; } enum facebook::react::RawProps::Mode { @@ -2671,17 +2681,9 @@ enum facebook::react::RawProps::Mode { JSI, } -class facebook::react::RawPropsKey { - public const char* name; - public const char* prefix; - public const char* suffix; - public operator std::string() const noexcept; - public void render(char* buffer, facebook::react::RawPropsPropNameLength* length) const noexcept; -} - class facebook::react::RawPropsKeyMap { - public facebook::react::RawPropsValueIndex at(const char* name, facebook::react::RawPropsPropNameLength length) noexcept; - public void insert(const facebook::react::RawPropsKey& key, facebook::react::RawPropsValueIndex value) noexcept; + public facebook::react::RawPropsValueIndex at(std::string_view name) noexcept; + public void insert(std::string_view key, facebook::react::RawPropsValueIndex value) noexcept; public void reindex() noexcept; } @@ -5305,6 +5307,37 @@ struct facebook::react::CallbackWithId { public facebook::react::CallbackId callbackId; } +struct facebook::react::CascadedRectangleCornersNames { + public const char* all; + public const char* bottomEnd; + public const char* bottomLeft; + public const char* bottomRight; + public const char* bottomStart; + public const char* endEnd; + public const char* endStart; + public const char* startEnd; + public const char* startStart; + public const char* topEnd; + public const char* topLeft; + public const char* topRight; + public const char* topStart; +} + +struct facebook::react::CascadedRectangleEdgesNames { + public const char* all; + public const char* block; + public const char* blockEnd; + public const char* blockStart; + public const char* bottom; + public const char* end; + public const char* horizontal; + public const char* left; + public const char* right; + public const char* start; + public const char* top; + public const char* vertical; +} + struct facebook::react::ColorComponents { public facebook::react::ColorSpace colorSpace; public float alpha; @@ -6150,6 +6183,7 @@ class facebook::react::ConcreteShadowNode : public BaseShadowNodeT { public static facebook::react::ComponentHandle Handle(); public static facebook::react::ComponentName Name(); public static facebook::react::ConcreteShadowNode::ConcreteStateData initialStateData(const facebook::react::Props::Shared&, const facebook::react::ShadowNodeFamily::Shared&, const facebook::react::ComponentDescriptor&); + public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::Props::Shared& baseProps); public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const facebook::react::Props::Shared& baseProps = nullptr); public static facebook::react::ShadowNodeTraits BaseTraits(); public using ConcreteEventEmitter = EventEmitterT; @@ -6804,6 +6838,8 @@ template std::optional facebook::react::detail::parseLegacyHslFunction(facebook::react::CSSValueParser& parser); template std::optional facebook::react::detail::parseModernHslFunction(facebook::react::CSSValueParser& parser); +template +C facebook::react::detail::memberFunctionClass(T C::*); template constexpr std::optional facebook::react::detail::normalizeComponent(const std::variant& component, float baseValue); diff --git a/scripts/cxx-api/api-snapshots/ReactCommonReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactCommonReleaseCxx.api index 6f46c2322b79..1281b1ef80a5 100644 --- a/scripts/cxx-api/api-snapshots/ReactCommonReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactCommonReleaseCxx.api @@ -404,6 +404,15 @@ concept facebook::react::CSSSyntaxVisitorReturn = std::is_default_constructible_ template concept facebook::react::CSSValidCompoundDataType = facebook::react::detail::is_variant_of_data_types::value; template +concept facebook::react::DeclaresOwnSetProp = std::is_same_v; +template +concept facebook::react::HasIteratorSetterCtor = std::copy_constructible && std::derived_from && HasSetProp; +template +concept facebook::react::HasSetProp = DeclaresOwnSetProp && +requires(T& t, const facebook::react::PropsParserContext& ctx, facebook::react::RawPropsPropNameHash hash, const char* name, const facebook::react::RawValue& value) { + { t.setProp(ctx, hash, name, value) } -> std::same_as; +}; +template concept facebook::react::Hashable = !std::is_same_v&& (requires(T a) { { std::hash{}(a) } -> std::convertible_to; }); @@ -590,7 +599,7 @@ facebook::react::ComponentDescriptorProvider facebook::react::concreteComponentD template DestinationTimePointT facebook::react::clockCast(SourceTimePointT timePoint); template -T facebook::react::convertRawProp(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const char* name, const T& sourceValue, const U& defaultValue, const char* namePrefix = nullptr, const char* nameSuffix = nullptr); +T facebook::react::convertRawProp(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const char* name, const T& sourceValue, const U& defaultValue); template T facebook::react::get(const facebook::react::AnimatedPropBase& animatedProp); template @@ -724,7 +733,6 @@ bool facebook::react::operator==(const facebook::react::LayoutContext& lhs, cons bool facebook::react::operator==(const facebook::react::LineMeasureCacheKey& lhs, const facebook::react::LineMeasureCacheKey& rhs); bool facebook::react::operator==(const facebook::react::PerformanceObserver& lhs, const facebook::react::PerformanceObserver& rhs); bool facebook::react::operator==(const facebook::react::PreparedTextCacheKey& lhs, const facebook::react::PreparedTextCacheKey& rhs); -bool facebook::react::operator==(const facebook::react::RawPropsKey& lhs, const facebook::react::RawPropsKey& rhs) noexcept; bool facebook::react::operator==(const facebook::react::Size& rhs, const facebook::react::Size& lhs) noexcept; bool facebook::react::operator==(const facebook::react::TextMeasureCacheKey& lhs, const facebook::react::TextMeasureCacheKey& rhs); constexpr bool facebook::react::operator==(const facebook::react::AccessibilityState& lhs, const facebook::react::AccessibilityState& rhs); @@ -2730,7 +2738,7 @@ class facebook::react::PreparedTextCacheKey { class facebook::react::Props : public virtual facebook::react::Sealable, public virtual facebook::react::DebugStringConvertible { protected void initialize(const facebook::react::PropsParserContext& context, const facebook::react::Props& sourceProps, const facebook::react::RawProps& rawProps, const std::function& filterObjectKeys = nullptr); public Props() = default; - public Props(const facebook::react::Props& other) = delete; + public Props(const facebook::react::Props& other) = default; public Props(const facebook::react::PropsParserContext& context, const facebook::react::Props& sourceProps, const facebook::react::RawProps& rawProps, const std::function& filterObjectKeys = nullptr); public facebook::react::Props& operator=(const facebook::react::Props& other) = delete; public std::string nativeId; @@ -2770,12 +2778,14 @@ class facebook::react::RawProps { public RawProps(facebook::react::RawProps&& other) noexcept = default; public RawProps(folly::dynamic dynamic) noexcept; public bool isEmpty() const noexcept; - public const facebook::react::RawValue* at(const char* name, const char* prefix, const char* suffix) const noexcept; + public const facebook::react::RawValue* at(const char* name) const noexcept; public facebook::react::RawProps& operator=(const facebook::react::RawProps& other) noexcept = delete; public facebook::react::RawProps& operator=(facebook::react::RawProps&& other) noexcept = delete; public folly::dynamic toDynamic(const std::function& filterObjectKeys = nullptr) const; public operator folly::dynamic() const; public void parse(const facebook::react::RawPropsParser& parser) noexcept; + template + public void forEachItem(Fn&& fn) const; } enum facebook::react::RawProps::Mode { @@ -2784,17 +2794,9 @@ enum facebook::react::RawProps::Mode { JSI, } -class facebook::react::RawPropsKey { - public const char* name; - public const char* prefix; - public const char* suffix; - public operator std::string() const noexcept; - public void render(char* buffer, facebook::react::RawPropsPropNameLength* length) const noexcept; -} - class facebook::react::RawPropsKeyMap { - public facebook::react::RawPropsValueIndex at(const char* name, facebook::react::RawPropsPropNameLength length) noexcept; - public void insert(const facebook::react::RawPropsKey& key, facebook::react::RawPropsValueIndex value) noexcept; + public facebook::react::RawPropsValueIndex at(std::string_view name) noexcept; + public void insert(std::string_view key, facebook::react::RawPropsValueIndex value) noexcept; public void reindex() noexcept; } @@ -5442,6 +5444,37 @@ struct facebook::react::CallbackWithId { public facebook::react::CallbackId callbackId; } +struct facebook::react::CascadedRectangleCornersNames { + public const char* all; + public const char* bottomEnd; + public const char* bottomLeft; + public const char* bottomRight; + public const char* bottomStart; + public const char* endEnd; + public const char* endStart; + public const char* startEnd; + public const char* startStart; + public const char* topEnd; + public const char* topLeft; + public const char* topRight; + public const char* topStart; +} + +struct facebook::react::CascadedRectangleEdgesNames { + public const char* all; + public const char* block; + public const char* blockEnd; + public const char* blockStart; + public const char* bottom; + public const char* end; + public const char* horizontal; + public const char* left; + public const char* right; + public const char* start; + public const char* top; + public const char* vertical; +} + struct facebook::react::ColorComponents { public facebook::react::ColorSpace colorSpace; public float alpha; @@ -6313,6 +6346,7 @@ class facebook::react::ConcreteShadowNode : public BaseShadowNodeT { public static facebook::react::ComponentHandle Handle(); public static facebook::react::ComponentName Name(); public static facebook::react::ConcreteShadowNode::ConcreteStateData initialStateData(const facebook::react::Props::Shared&, const facebook::react::ShadowNodeFamily::Shared&, const facebook::react::ComponentDescriptor&); + public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::Props::Shared& baseProps); public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const facebook::react::Props::Shared& baseProps = nullptr); public static facebook::react::ShadowNodeTraits BaseTraits(); public using ConcreteEventEmitter = EventEmitterT; @@ -6967,6 +7001,8 @@ template std::optional facebook::react::detail::parseLegacyHslFunction(facebook::react::CSSValueParser& parser); template std::optional facebook::react::detail::parseModernHslFunction(facebook::react::CSSValueParser& parser); +template +C facebook::react::detail::memberFunctionClass(T C::*); template constexpr std::optional facebook::react::detail::normalizeComponent(const std::variant& component, float baseValue);