diff --git a/packages/react-native/ReactCommon/react/renderer/scheduler/SurfaceManager.cpp b/packages/react-native/ReactCommon/react/renderer/scheduler/SurfaceManager.cpp index 7aaf876c3c4..81f7d67f3ea 100644 --- a/packages/react-native/ReactCommon/react/renderer/scheduler/SurfaceManager.cpp +++ b/packages/react-native/ReactCommon/react/renderer/scheduler/SurfaceManager.cpp @@ -89,6 +89,22 @@ std::unordered_set SurfaceManager::getRunningSurfaces() return surfaceIds; } +std::optional SurfaceManager::getSurfaceProps( + SurfaceId surfaceId) const noexcept { + std::optional surfaceProps; + + visit(surfaceId, [&](const SurfaceHandler& surfaceHandler) { + surfaceProps = SurfaceManager::SurfaceProps{ + surfaceId, + surfaceHandler.getModuleName(), + surfaceHandler.getProps(), + surfaceHandler.getLayoutConstraints(), + surfaceHandler.getLayoutContext()}; + }); + + return surfaceProps; +} + Size SurfaceManager::measureSurface( SurfaceId surfaceId, const LayoutConstraints& layoutConstraints, diff --git a/packages/react-native/ReactCommon/react/renderer/scheduler/SurfaceManager.h b/packages/react-native/ReactCommon/react/renderer/scheduler/SurfaceManager.h index 4671212ffb8..e8709a7cd7b 100644 --- a/packages/react-native/ReactCommon/react/renderer/scheduler/SurfaceManager.h +++ b/packages/react-native/ReactCommon/react/renderer/scheduler/SurfaceManager.h @@ -8,6 +8,7 @@ #pragma once #include +#include #include #include @@ -29,6 +30,15 @@ class SurfaceManager final { explicit SurfaceManager(const Scheduler& scheduler) noexcept; ~SurfaceManager() noexcept; + /* SurfaceProps contain information about running surfaces */ + struct SurfaceProps { + SurfaceId surfaceId; + std::string moduleName; + folly::dynamic props; + LayoutConstraints layoutConstraints; + LayoutContext layoutContext; + }; + #pragma mark - Surface Management void startSurface( @@ -46,6 +56,9 @@ class SurfaceManager final { std::unordered_set getRunningSurfaces() const noexcept; + std::optional getSurfaceProps( + SurfaceId surfaceId) const noexcept; + Size measureSurface( SurfaceId surfaceId, const LayoutConstraints& layoutConstraints,