Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions packages/react-native/ReactCommon/react/renderer/core/RawProps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include <limits>
#include <optional>
#include <string>

#include <folly/dynamic.h>
#include <jsi/JSIDynamic.h>
Expand Down Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool(const std::string&)>& filterObjectKeys = nullptr) const;
Expand Down
1 change: 1 addition & 0 deletions scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool(const std::string&)>& filterObjectKeys = nullptr) const;
Expand Down
1 change: 1 addition & 0 deletions scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool(const std::string&)>& filterObjectKeys = nullptr) const;
Expand Down
1 change: 1 addition & 0 deletions scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool(const std::string&)>& filterObjectKeys = nullptr) const;
Expand Down
1 change: 1 addition & 0 deletions scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool(const std::string&)>& filterObjectKeys = nullptr) const;
Expand Down
1 change: 1 addition & 0 deletions scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool(const std::string&)>& filterObjectKeys = nullptr) const;
Expand Down
1 change: 1 addition & 0 deletions scripts/cxx-api/api-snapshots/ReactCommonDebugCxx.api
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool(const std::string&)>& filterObjectKeys = nullptr) const;
Expand Down
1 change: 1 addition & 0 deletions scripts/cxx-api/api-snapshots/ReactCommonNewarchCxx.api
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool(const std::string&)>& filterObjectKeys = nullptr) const;
Expand Down
1 change: 1 addition & 0 deletions scripts/cxx-api/api-snapshots/ReactCommonReleaseCxx.api
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool(const std::string&)>& filterObjectKeys = nullptr) const;
Expand Down
Loading