From 2eed050412be83a043e62cdffaa5e254fddc95bb Mon Sep 17 00:00:00 2001 From: Andrew <30809111+acoates-ms@users.noreply.github.com> Date: Mon, 15 Jul 2024 13:19:02 -0700 Subject: [PATCH 1/2] [Fabric] call reportMount to implement UIManagerMountHook support --- .../Fabric/FabricUIManagerModule.cpp | 12 +++++++++++- .../Fabric/FabricUIManagerModule.h | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/vnext/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp b/vnext/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp index 58df7c80555..2c528c9fa33 100644 --- a/vnext/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +++ b/vnext/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp @@ -182,7 +182,17 @@ void FabricUIManager::constraintSurfaceLayout( m_surfaceManager->constraintSurfaceLayout(surfaceId, layoutConstraints, layoutContext); } -void FabricUIManager::didMountComponentsWithRootTag(facebook::react::SurfaceId surfaceId) noexcept {} +winrt::Microsoft::ReactNative::ReactNotificationId +FabricUIManager::NotifyMountedId() noexcept { + return {L"ReactNative.Fabric", L"Mounted"}; +} + +void FabricUIManager::didMountComponentsWithRootTag(facebook::react::SurfaceId surfaceId) noexcept { + m_context.UIDispatcher().Post([context = m_context, self = shared_from_this(), surfaceId]() { + self->m_scheduler->reportMount(surfaceId); + context.Notifications().SendNotification(NotifyMountedId(), surfaceId); + }); +} void FabricUIManager::RCTPerformMountInstructions( facebook::react::ShadowViewMutationList const &mutations, diff --git a/vnext/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h b/vnext/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h index ad3e360440b..5a087af33f3 100644 --- a/vnext/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +++ b/vnext/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h @@ -52,6 +52,8 @@ struct FabricUIManager final : public std::enable_shared_from_this NotifyMountedId() noexcept; + private: void installFabricUIManager() noexcept; void initiateTransaction(facebook::react::MountingCoordinator::Shared mountingCoordinator); From 3954aa4329e4cafc10797b11b17e6c360c5caeaa Mon Sep 17 00:00:00 2001 From: Andrew <30809111+acoates-ms@users.noreply.github.com> Date: Mon, 15 Jul 2024 13:19:11 -0700 Subject: [PATCH 2/2] Change files --- ...ative-windows-24c5a09a-7492-4f70-9a80-a82c358fb058.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/react-native-windows-24c5a09a-7492-4f70-9a80-a82c358fb058.json diff --git a/change/react-native-windows-24c5a09a-7492-4f70-9a80-a82c358fb058.json b/change/react-native-windows-24c5a09a-7492-4f70-9a80-a82c358fb058.json new file mode 100644 index 00000000000..410391ebba6 --- /dev/null +++ b/change/react-native-windows-24c5a09a-7492-4f70-9a80-a82c358fb058.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "[Fabric] call reportMount to implement UIManagerMountHook support", + "packageName": "react-native-windows", + "email": "30809111+acoates-ms@users.noreply.github.com", + "dependentChangeType": "patch" +}