From 3407055f2dbc7165d91ef3e571a0c4f1f05e1620 Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Mon, 29 Jun 2026 02:24:15 -0700 Subject: [PATCH] Add back backwards compat for rawProps.at(x,y,z) (#57346) Summary: Restores a deprecated three-argument overload of `RawProps::at()` for backwards compatibility with existing callers (like Nitro modules) that pass prefix/suffix separately. The new overload concatenates `prefix + name + suffix` when needed and delegates to the parser's `at(string_view)` method. When both prefix and suffix are null, it forwards directly to the single-argument version. Changelog: [Internal] Reviewed By: cortinico Differential Revision: D109837388 --- .../react/renderer/core/RawProps.cpp | 22 +++++++++++++++++++ .../react/renderer/core/RawProps.h | 5 +++++ .../api-snapshots/ReactAndroidDebugCxx.api | 1 + .../api-snapshots/ReactAndroidNewarchCxx.api | 1 + .../api-snapshots/ReactAndroidReleaseCxx.api | 1 + .../api-snapshots/ReactAppleDebugCxx.api | 1 + .../api-snapshots/ReactAppleNewarchCxx.api | 1 + .../api-snapshots/ReactAppleReleaseCxx.api | 1 + .../api-snapshots/ReactCommonDebugCxx.api | 1 + .../api-snapshots/ReactCommonNewarchCxx.api | 1 + .../api-snapshots/ReactCommonReleaseCxx.api | 1 + 11 files changed, 36 insertions(+) diff --git a/packages/react-native/ReactCommon/react/renderer/core/RawProps.cpp b/packages/react-native/ReactCommon/react/renderer/core/RawProps.cpp index 5a5b405d9516..bf1849ffa10c 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/RawProps.cpp +++ b/packages/react-native/ReactCommon/react/renderer/core/RawProps.cpp @@ -116,4 +116,26 @@ const RawValue* RawProps::at(const char* name) const noexcept { return parser_->at(*this, name); } +const RawValue* RawProps::at( + const char* name, + const char* prefix, + const char* suffix) const noexcept { + if (prefix == nullptr && suffix == nullptr) { + return at(name); + } + + std::string concatenated; + if (prefix != nullptr) { + concatenated += prefix; + } + concatenated += name; + if (suffix != nullptr) { + concatenated += suffix; + } + react_native_assert( + parser_ && + "The object is not parsed. `parse` must be called before `at`."); + return parser_->at(*this, concatenated); +} + } // 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 e1ffd6265d35..0abfce1c8256 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/RawProps.h +++ b/packages/react-native/ReactCommon/react/renderer/core/RawProps.h @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -92,6 +93,10 @@ class RawProps final { */ const RawValue *at(const char *name) const noexcept; + // Deprecated: Use at(name) instead. This overload exists for backwards + // compatibility with callers that pass prefix/suffix separately. + const RawValue *at(const char *name, const char *prefix, const char *suffix) const noexcept; + private: friend class RawPropsParser; diff --git a/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api index 8e829c46bde1..5a33e7d7d9da 100644 --- a/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api @@ -4190,6 +4190,7 @@ class facebook::react::RawProps { public RawProps(folly::dynamic dynamic) noexcept; public bool isEmpty() const noexcept; public const facebook::react::RawValue* at(const char* name) const noexcept; + public const facebook::react::RawValue* at(const char* name, const char* prefix, const char* suffix) 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; diff --git a/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api index 68888450c512..a10464aed19c 100644 --- a/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api @@ -4034,6 +4034,7 @@ class facebook::react::RawProps { public RawProps(folly::dynamic dynamic) noexcept; public bool isEmpty() const noexcept; public const facebook::react::RawValue* at(const char* name) const noexcept; + public const facebook::react::RawValue* at(const char* name, const char* prefix, const char* suffix) 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; diff --git a/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api index 14571543b728..b357d56bfc81 100644 --- a/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api @@ -4187,6 +4187,7 @@ class facebook::react::RawProps { public RawProps(folly::dynamic dynamic) noexcept; public bool isEmpty() const noexcept; public const facebook::react::RawValue* at(const char* name) const noexcept; + public const facebook::react::RawValue* at(const char* name, const char* prefix, const char* suffix) 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; diff --git a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api index 1eed958ecd58..4dd76e3aa931 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api @@ -6407,6 +6407,7 @@ class facebook::react::RawProps { public RawProps(folly::dynamic dynamic) noexcept; public bool isEmpty() const noexcept; public const facebook::react::RawValue* at(const char* name) const noexcept; + public const facebook::react::RawValue* at(const char* name, const char* prefix, const char* suffix) 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; diff --git a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api index d29785710d59..16e2dc5a0c80 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api @@ -6279,6 +6279,7 @@ class facebook::react::RawProps { public RawProps(folly::dynamic dynamic) noexcept; public bool isEmpty() const noexcept; public const facebook::react::RawValue* at(const char* name) const noexcept; + public const facebook::react::RawValue* at(const char* name, const char* prefix, const char* suffix) 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; diff --git a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api index 4c5d3b6c1d86..48d9cc57fdb4 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api @@ -6404,6 +6404,7 @@ class facebook::react::RawProps { public RawProps(folly::dynamic dynamic) noexcept; public bool isEmpty() const noexcept; public const facebook::react::RawValue* at(const char* name) const noexcept; + public const facebook::react::RawValue* at(const char* name, const char* prefix, const char* suffix) 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; diff --git a/scripts/cxx-api/api-snapshots/ReactCommonDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactCommonDebugCxx.api index e040adc8b613..e40ffd1a5777 100644 --- a/scripts/cxx-api/api-snapshots/ReactCommonDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactCommonDebugCxx.api @@ -2772,6 +2772,7 @@ class facebook::react::RawProps { public RawProps(folly::dynamic dynamic) noexcept; public bool isEmpty() const noexcept; public const facebook::react::RawValue* at(const char* name) const noexcept; + public const facebook::react::RawValue* at(const char* name, const char* prefix, const char* suffix) 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; diff --git a/scripts/cxx-api/api-snapshots/ReactCommonNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactCommonNewarchCxx.api index 42992e00ebac..2c5d2474a718 100644 --- a/scripts/cxx-api/api-snapshots/ReactCommonNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactCommonNewarchCxx.api @@ -2656,6 +2656,7 @@ class facebook::react::RawProps { public RawProps(folly::dynamic dynamic) noexcept; public bool isEmpty() const noexcept; public const facebook::react::RawValue* at(const char* name) const noexcept; + public const facebook::react::RawValue* at(const char* name, const char* prefix, const char* suffix) 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; diff --git a/scripts/cxx-api/api-snapshots/ReactCommonReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactCommonReleaseCxx.api index c56d1d911a28..8c562f2e7322 100644 --- a/scripts/cxx-api/api-snapshots/ReactCommonReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactCommonReleaseCxx.api @@ -2769,6 +2769,7 @@ class facebook::react::RawProps { public RawProps(folly::dynamic dynamic) noexcept; public bool isEmpty() const noexcept; public const facebook::react::RawValue* at(const char* name) const noexcept; + public const facebook::react::RawValue* at(const char* name, const char* prefix, const char* suffix) 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;