Update ReactNativeVersion.h not to rely on an anonymous struct (#55271)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55271

Changelog: [Internal]

During research for the Stable C++ Api project, I've noticed that doxygen isn't able to handle anonymous structs, producing weird results.

The only occurence of this pattern in the codebase was in the `ReactNativeVersion.h` file. This diff updates this file not to use that pattern.

Reviewed By: cortinico

Differential Revision: D91220998

fbshipit-source-id: 9fd2ec5fb811111a0f3c75bf442f95df4b06a04b
This commit is contained in:
Jakub Piasecki authored and meta-codesync[bot] committed 2026-01-22 07:59:01 -08:00
1 parent 8544a6803f
commit 589547ab61
3 files changed
+16 -8

No files matched your search

@@ -138,12 +138,14 @@ exports[`updateReactNativeArtifacts should set nightly version: packages/react-n
namespace facebook::react {
constexpr struct {
struct ReactNativeVersionType {
int32_t Major = 0;
int32_t Minor = 81;
int32_t Patch = 0;
std::string_view Prerelease = \\"nightly-29282302-abcd1234\\";
} ReactNativeVersion;
};
constexpr ReactNativeVersionType ReactNativeVersion;
} // namespace facebook::react
"
@@ -293,12 +295,14 @@ exports[`updateReactNativeArtifacts should set release version: packages/react-n
namespace facebook::react {
constexpr struct {
struct ReactNativeVersionType {
int32_t Major = 0;
int32_t Minor = 81;
int32_t Patch = 0;
std::string_view Prerelease = \\"\\";
} ReactNativeVersion;
};
constexpr ReactNativeVersionType ReactNativeVersion;
} // namespace facebook::react
"
@@ -32,14 +32,16 @@ module.exports = ({version} /*: {version: Version} */) /*: string */ => `/**
namespace facebook::react {
constexpr struct {
struct ReactNativeVersionType {
int32_t Major = ${version.major};
int32_t Minor = ${version.minor};
int32_t Patch = ${version.patch};
std::string_view Prerelease = ${
version.prerelease != null ? `"${version.prerelease}"` : '""'
};
} ReactNativeVersion;
};
constexpr ReactNativeVersionType ReactNativeVersion;
} // namespace facebook::react
`;