From 00b37b3a7c7bbf08622471c48ec0d9aa5be7c43f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Ma=C5=82ecki?= Date: Tue, 6 Oct 2026 09:16:06 -0700 Subject: [PATCH] Make ModalHostViewUtils header private (#58883) Summary: Pull Request resolved: https://github.com/react/react-native/pull/58883 `react/renderer/components/modal/ModalHostViewUtils.h` declares `ModalHostViewScreenSize()`, a per-platform helper that is only used to compute the default screen size of `ModalHostViewState`. Lower it from "for frameworks" to private. It was reachable from the "for frameworks" API only because `ModalHostViewState.h` called it from an inline default constructor. Move that constructor out of line into `ModalHostViewState.cpp`, so `ModalHostViewState.h` no longer includes the utils header. While here, `ModalHostViewState.h` now gets `Float`/`Size` from the `` umbrella instead of including the public `react/renderer/graphics/Float.h` directly (`Size` previously only arrived transitively through the utils header). Changelog: [Internal] Differential Revision: D123601668 --- .../react/renderer/components/modal/ModalHostViewState.cpp | 4 ++++ .../react/renderer/components/modal/ModalHostViewState.h | 5 ++--- .../react/renderer/components/modal/ModalHostViewUtils.h | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/react-native/ReactCommon/react/renderer/components/modal/ModalHostViewState.cpp b/packages/react-native/ReactCommon/react/renderer/components/modal/ModalHostViewState.cpp index e27e93774550..9f5bff0bfac8 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/modal/ModalHostViewState.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/modal/ModalHostViewState.cpp @@ -6,9 +6,13 @@ */ #include "ModalHostViewState.h" +#include "ModalHostViewUtils.h" namespace facebook::react { +ModalHostViewState::ModalHostViewState() + : screenSize(ModalHostViewScreenSize()) {} + #ifdef RN_SERIALIZABLE_STATE folly::dynamic ModalHostViewState::getDynamic() const { return folly::dynamic::object("screenWidth", screenSize.width)( diff --git a/packages/react-native/ReactCommon/react/renderer/components/modal/ModalHostViewState.h b/packages/react-native/ReactCommon/react/renderer/components/modal/ModalHostViewState.h index f85268778d7e..8631094fd8d0 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/modal/ModalHostViewState.h +++ b/packages/react-native/ReactCommon/react/renderer/components/modal/ModalHostViewState.h @@ -9,9 +9,8 @@ #include +#include #include -#include -#include "ModalHostViewUtils.h" #ifdef RN_SERIALIZABLE_STATE #include @@ -26,7 +25,7 @@ class ModalHostViewState final { public: using Shared = std::shared_ptr; - ModalHostViewState() : screenSize(ModalHostViewScreenSize()) {} + ModalHostViewState(); ModalHostViewState(Size screenSize_) : screenSize(screenSize_) {}; #ifdef RN_SERIALIZABLE_STATE diff --git a/packages/react-native/ReactCommon/react/renderer/components/modal/ModalHostViewUtils.h b/packages/react-native/ReactCommon/react/renderer/components/modal/ModalHostViewUtils.h index 0174a4154cf6..2f27b4c64d43 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/modal/ModalHostViewUtils.h +++ b/packages/react-native/ReactCommon/react/renderer/components/modal/ModalHostViewUtils.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include