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" +} 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);