From ff3ea5eaec1a0f255ec7e8071424dd8ebb27bcec Mon Sep 17 00:00:00 2001 From: Jakub Piasecki Date: Wed, 9 Sep 2026 02:03:15 -0700 Subject: [PATCH] Forward declare LeakChecker in UIManager.h (#58091) Summary: Pull Request resolved: https://github.com/react/react-native/pull/58091 Under the C++ Stable API RFC, `react/renderer/uimanager:uimanager` is a public target while `react/renderer/leakchecker:leakchecker` is private. `UIManager.h` is an exported header of the uimanager target and is re-exported from the module umbrella `React/UIManager.h`, so it transitively exposed the private module through the blessed public entry point. The private guard is suppressed only by `RN_BUILDING`, not by `RN_UMBRELLA_CONTEXT`, so a consumer including `` under `RN_STRICT_API` would get a hard error from a header they never named and cannot acknowledge. `UIManager.h` only needs the type for the `std::unique_ptr leakChecker_` data member. `~UIManager()` is already out of line, so a forward declaration is sufficient and the include moves to `UIManager.cpp`, which already constructs the object. No build config change is needed: `leakchecker` is already a non-exported dep of the uimanager target in both BUCK and CMake. `UIManager.h` is the only public or for-frameworks header in ReactCommon that still reached `leakchecker`, so the module is now cleanly private. Changelog: [Internal] Reviewed By: christophpurrer Differential Revision: D117188750 fbshipit-source-id: c607a8c3a9d8208bbffa66ecf13dcf44102cbce4 --- .../ReactCommon/react/renderer/uimanager/UIManager.cpp | 1 + .../ReactCommon/react/renderer/uimanager/UIManager.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp b/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp index 6b7c6667941..df92c08d559 100644 --- a/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp +++ b/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include diff --git a/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.h b/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.h index 9b3d152b62a..3789c40b247 100644 --- a/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.h +++ b/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.h @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -37,6 +36,7 @@ namespace facebook::react { +class LeakChecker; class UIManagerBinding; class UIManagerCommitHook; class UIManagerMountHook;