Skip to content

Commit

Permalink
[Fabric] call reportMount to implement UIManagerMountHook support (#1…
Browse files Browse the repository at this point in the history
…3443)

* [Fabric] call reportMount to implement UIManagerMountHook support

* Change files
  • Loading branch information
acoates-ms authored Jul 15, 2024
1 parent 244d85a commit a10a861
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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"
}
12 changes: 11 additions & 1 deletion vnext/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<facebook::react::SurfaceId>
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,
Expand Down
2 changes: 2 additions & 0 deletions vnext/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ struct FabricUIManager final : public std::enable_shared_from_this<FabricUIManag
winrt::Microsoft::ReactNative::ReactNativeIsland GetReactNativeIsland(
facebook::react::SurfaceId surfaceId) const noexcept;

static winrt::Microsoft::ReactNative::ReactNotificationId<facebook::react::SurfaceId> NotifyMountedId() noexcept;

private:
void installFabricUIManager() noexcept;
void initiateTransaction(facebook::react::MountingCoordinator::Shared mountingCoordinator);
Expand Down

0 comments on commit a10a861

Please sign in to comment.