Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
28b1471
initial workspace launching sample app fabric without xaml
sharath2727 Oct 8, 2025
7cb5b7e
XamlHost Definition, declaration and Codegen components
sharath2727 Oct 8, 2025
ffa1c03
Introduce XamlApplication that enables to host xaml ui
sharath2727 Oct 8, 2025
b7cbe82
Introduce xamlhost component
sharath2727 Oct 9, 2025
ed1e67c
Register XamlHostComponentView
sharath2727 Oct 9, 2025
0a95df7
Using XamlHost in Sample App and hardcoding button in xamlisland
sharath2727 Oct 9, 2025
6861056
Accessibility Validated on hardcoded xaml control
sharath2727 Oct 9, 2025
b3d5b4f
Cleaned up
sharath2727 Nov 4, 2025
c90b1da
Change files
sharath2727 Nov 4, 2025
9357561
yarn format
sharath2727 Nov 4, 2025
805ba4d
yarn lint fix
sharath2727 Nov 4, 2025
46dc340
Merge branch 'main' into user/sharath227/xamlislandprototypework
sharath2727 Nov 4, 2025
9889e8c
Microsoft.ReactNative.Xaml namespace and lint fixes
sharath2727 Nov 5, 2025
284c423
Merge branch 'main' into user/sharath227/xamlislandprototypework
sharath2727 Nov 5, 2025
522cf31
rework index.windows.js and js.flow
sharath2727 Nov 5, 2025
529423b
Introduce IXamlProvider
sharath2727 Nov 6, 2025
9b6aa17
Yarn issue
sharath2727 Nov 6, 2025
b9036c3
Avoid compiling xaml for office solution
sharath2727 Nov 7, 2025
11c54ea
yarn format fix
sharath2727 Nov 7, 2025
6b92ff5
Merge branch 'main' into user/sharath227/xamlislandprototypework
sharath2727 Nov 7, 2025
b179f47
Update shared vcxitems filter
sharath2727 Nov 7, 2025
713b950
Merge branch 'main' into user/sharath227/xamlislandprototypework
sharath2727 Nov 10, 2025
c2aa6d4
Fix overrides
sharath2727 Nov 10, 2025
572a024
Fixed formatting errors
sharath2727 Nov 10, 2025
8392fc5
fix winrt document generation error
sharath2727 Nov 10, 2025
9aa90f6
Handle winrt document generation failure gracefully
sharath2727 Nov 10, 2025
b477234
Optimize GetXmlnsDefinitions Implementation
sharath2727 Nov 11, 2025
c298c47
Merge branch 'main' into user/sharath227/xamlislandprototypework
sharath2727 Nov 11, 2025
e0baeb1
Comment out hittest for contentislandcomponentview
sharath2727 Nov 12, 2025
b9f8621
Merge branch 'main' into user/sharath227/xamlislandprototypework
sharath2727 Nov 12, 2025
8075851
Remove references to contentislandcomponentview::hittest
sharath2727 Nov 12, 2025
fe8e41e
Restore sampleappfabric.sln
sharath2727 Nov 12, 2025
bc34500
Update vnext/Microsoft.ReactNative/IXamlProvider.idl
sharath2727 Nov 12, 2025
0e025a4
Merge branch 'main' into user/sharath227/xamlislandprototypework
sharath2727 Nov 12, 2025
d07d6cb
Update vnext/Shared/Shared.vcxitems
sundaramramaswamy Nov 13, 2025
2b9836d
Update vnext/Shared/Shared.vcxitems
sundaramramaswamy Nov 13, 2025
577d5af
Update vnext/Shared/Shared.vcxitems
sundaramramaswamy Nov 13, 2025
7b4cc7a
Xamlhost dependency on xamlapplication.idl
sharath2727 Nov 13, 2025
9879fb9
Merge branch 'main' into user/sharath227/xamlislandprototypework
sharath2727 Nov 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .ado/jobs/universal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
Invoke-WebRequest -UseBasicParsing $winmd2md_url -OutFile $env:TEMP\winmd2md.exe
& $env:TEMP\winmd2md.exe /experimental /outputDirectory vnext\target\winmd2md vnext\target\${{ matrix.BuildPlatform }}\${{ matrix.BuildConfiguration }}\Microsoft.ReactNative\Microsoft.ReactNative.winmd
displayName: "Generate WinRT API docs"
continueOnError: true

- task: PublishBuildArtifacts@1
displayName: Upload WinRT API docs
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Introduce xamlhost component",
"packageName": "react-native-windows",
"email": "[email protected]",
"dependentChangeType": "patch"
}
5 changes: 5 additions & 0 deletions vnext/Microsoft.ReactNative/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Application
x:Class="Microsoft.ReactNative.Xaml.XamlApplication"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</Application>
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,13 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::SetFocus(void) {
return UiaSetFocusHelper(m_view);
}

winrt::IUnknown CompositionDynamicAutomationProvider::TryGetChildSiteLinkAutomationProvider() {
if (m_childSiteLink) {
return m_childSiteLink.AutomationProvider().as<winrt::IUnknown>();
}
return nullptr;
}

HRESULT __stdcall CompositionDynamicAutomationProvider::get_FragmentRoot(IRawElementProviderFragmentRoot **pRetVal) {
if (pRetVal == nullptr)
return E_POINTER;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ class CompositionDynamicAutomationProvider : public winrt::implements<
void AddToSelectionItems(winrt::com_ptr<IRawElementProviderSimple> &item);
void RemoveFromSelectionItems(winrt::com_ptr<IRawElementProviderSimple> &item);

void SetChildSiteLink(winrt::Microsoft::UI::Content::ChildSiteLink childSiteLink) {
m_childSiteLink = childSiteLink;
}

// If this object is for a ChildSiteLink, returns the ChildSiteLink's automation provider.
// This will be a provider object from the hosted framework (for example, WinUI).
winrt::IUnknown TryGetChildSiteLinkAutomationProvider();

private:
::Microsoft::ReactNative::ReactTaggedView m_view;
winrt::com_ptr<ITextProvider2> m_textProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ HRESULT __stdcall CompositionRootAutomationProvider::ElementProviderFromPoint(
auto local = rootView->ConvertScreenToLocal({static_cast<float>(x), static_cast<float>(y)});
auto provider = rootView->UiaProviderFromPoint(
{static_cast<LONG>(local.X * rootView->LayoutMetrics().PointScaleFactor),
static_cast<LONG>(local.Y * rootView->LayoutMetrics().PointScaleFactor)});
static_cast<LONG>(local.Y * rootView->LayoutMetrics().PointScaleFactor)},
{static_cast<LONG>(x), static_cast<LONG>(y)});
auto spFragment = provider.try_as<IRawElementProviderFragment>();
if (spFragment) {
*pRetVal = spFragment.detach();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,12 @@ ContentIslandComponentView::~ContentIslandComponentView() noexcept {
void ContentIslandComponentView::MountChildComponentView(
const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
uint32_t index) noexcept {
assert(false);
base_type::MountChildComponentView(childComponentView, index);
}

void ContentIslandComponentView::UnmountChildComponentView(
const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
uint32_t index) noexcept {
assert(false);
base_type::UnmountChildComponentView(childComponentView, index);
}

Expand Down Expand Up @@ -262,6 +260,12 @@ void ContentIslandComponentView::ConfigureChildSiteLinkAutomation() noexcept {
args.AutomationProvider(nullptr);
args.Handled(true);
});

if (m_uiaProvider) {
auto providerImpl =
m_uiaProvider.as<winrt::Microsoft::ReactNative::implementation::CompositionDynamicAutomationProvider>();
providerImpl->SetChildSiteLink(m_childSiteLink);
}
}

} // namespace winrt::Microsoft::ReactNative::Composition::implementation
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <Fabric/FabricUIManagerModule.h>
#include <winrt/Microsoft.UI.Input.h>
#include "CompositionDynamicAutomationProvider.h"
#include "CompositionRootAutomationProvider.h"
#include "ReactNativeIsland.h"
#include "Theme.h"
Expand Down Expand Up @@ -275,7 +276,7 @@ facebook::react::Point RootComponentView::getClientOffset() const noexcept {
return {};
}

winrt::IInspectable RootComponentView::UiaProviderFromPoint(const POINT &ptPixels) noexcept {
winrt::IUnknown RootComponentView::UiaProviderFromPoint(const POINT &ptPixels, const POINT &ptScreen) noexcept {
facebook::react::Point ptDips{
static_cast<facebook::react::Float>(ptPixels.x) / m_layoutMetrics.pointScaleFactor,
static_cast<facebook::react::Float>(ptPixels.y) / m_layoutMetrics.pointScaleFactor};
Expand All @@ -295,7 +296,41 @@ winrt::IInspectable RootComponentView::UiaProviderFromPoint(const POINT &ptPixel
if (view == nullptr)
return nullptr;

return winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(view)->EnsureUiaProvider();
auto uiaProvider =
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(view)->EnsureUiaProvider();

// TODO: Avoid exposing CompositionDynamicAutomationProvider in RootComponentView
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please file a follow-up task for this and paste its link here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#15317 - I already created a task and adding pending sub tasks to it. Will add this here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, please add the task to the comment too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The TODO comment suggests that exposing CompositionDynamicAutomationProvider in RootComponentView should be avoided, but doesn't provide a concrete alternative approach or tracking issue. Consider either refactoring to avoid this dependency or documenting a plan for future improvement with a tracking issue reference.

Suggested change
// TODO: Avoid exposing CompositionDynamicAutomationProvider in RootComponentView
// TODO: Avoid exposing CompositionDynamicAutomationProvider in RootComponentView.
// See tracking issue: https://github.com/microsoft/react-native-windows/issues/XXXX

Copilot uses AI. Check for mistakes.
auto dynamicProvider =
uiaProvider.try_as<winrt::Microsoft::ReactNative::implementation::CompositionDynamicAutomationProvider>();
if (dynamicProvider) {
if (auto childProvider = dynamicProvider->TryGetChildSiteLinkAutomationProvider()) {
// ChildProvider is the the automation provider from the ChildSiteLink. In the case of WinUI, this
// is a pointer to WinUI's internal CUIAHostWindow object.
// It seems odd, but even though this node doesn't behave as a fragment root in our case (the real fragment root
// is the RootComponentView's UIA provider), we still use its IRawElementProviderFragmentRoot -- just so
// we can do the ElementProviderFromPoint call. (this was recommended by the team who did the initial
// architecture work).
if (auto fragmentRoot = childProvider.try_as<IRawElementProviderFragmentRoot>()) {
com_ptr<IRawElementProviderFragment> frag;
// WinUI then does its own hitTest inside the XAML tree.
fragmentRoot->ElementProviderFromPoint(
ptScreen
.x, // Note since we're going through IRawElementProviderFragment the coordinates are in screen space.
ptScreen.y,
frag.put());
// We return the specific child provider(frag) when hosted XAML has an element
// under the cursor. This satisfies the UIA "element at point" contract and exposes
// the control’s patterns/properties. If the hosted tree finds nothing, we fall back
// to the RNW container’s provider (uiaProvider) to keep the island accessible.
// (A Microsoft_UI_Xaml!CUIAWrapper object)
if (frag) {
return frag.as<winrt::IUnknown>();
}
}
}
}

return uiaProvider;
}

float RootComponentView::FontSizeMultiplier() const noexcept {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct RootComponentView : RootComponentViewT<RootComponentView, ViewComponentVi
facebook::react::LayoutMetrics const &layoutMetrics,
facebook::react::LayoutMetrics const &oldLayoutMetrics) noexcept override;

winrt::Windows::Foundation::IInspectable UiaProviderFromPoint(const POINT &ptPixels) noexcept;
winrt::Windows::Foundation::IUnknown UiaProviderFromPoint(const POINT &ptPixels, const POINT &ptScreen) noexcept;

RootComponentView(
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
Expand Down
1 change: 0 additions & 1 deletion vnext/Microsoft.ReactNative/IReactPackageProvider.idl
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@ namespace Microsoft.ReactNative
"Use the @IReactPackageBuilder to register custom native modules and view managers.")
void CreatePackage(IReactPackageBuilder packageBuilder);
};

} // namespace Microsoft.ReactNative
11 changes: 11 additions & 0 deletions vnext/Microsoft.ReactNative/IXamlProvider.idl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

#include "DocString.h"

namespace Microsoft.ReactNative.Xaml {
[webhosthidden]
interface IXamlControl {
DOC_STRING(
"Native components that want to be Xaml-based can implement IXamlControl to allow their object to be parented to a XamlHost.")
Microsoft.UI.Xaml.UIElement GetXamlElement();
};
} // namespace Microsoft.ReactNative.Xaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
</CppWinRTNamespaceMergeDepth>
<CppWinRTLibs>true</CppWinRTLibs>
<BuildMSRNCxxReactCommon>false</BuildMSRNCxxReactCommon>
<SupportWinUI3Islands>true</SupportWinUI3Islands>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="$(ReactNativeWindowsDir)PropertySheets\React.Cpp.props" />
Expand Down
71 changes: 71 additions & 0 deletions vnext/Microsoft.ReactNative/XamlApplication.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#include "pch.h"
#include "XamlApplication.h"
#include "Xaml.XamlApplication.g.cpp"

#include "winrt/Microsoft.UI.Xaml.XamlTypeInfo.h"

namespace winrt::Microsoft::ReactNative::Xaml::implementation {
using namespace ::winrt::Microsoft::UI::Xaml;
using namespace ::winrt::Microsoft::UI::Xaml::Markup;
using namespace ::winrt::Windows::UI::Xaml::Interop;
XamlApplication::XamlApplication() {
s_current = *this;

// TODO: It's probably not a good idea to only load the controls pri file, there are other ones too.
auto resourceManager =
winrt::Microsoft::Windows::ApplicationModel::Resources::ResourceManager(L"Microsoft.UI.Xaml.Controls.pri");

this->ResourceManagerRequested([resourceManager](auto &&, ResourceManagerRequestedEventArgs args) {
args.CustomResourceManager(resourceManager);
});
winrt::Microsoft::UI::Xaml::Hosting::WindowsXamlManager::InitializeForCurrentThread();

m_providers.push_back(
winrt::make_self<winrt::Microsoft::ReactNative::implementation::XamlMetaDataProvider>()
.as<winrt::Microsoft::UI::Xaml::Markup::IXamlMetadataProvider>()); // Default generated provider
m_providers.push_back(winrt::Microsoft::UI::Xaml::XamlTypeInfo::XamlControlsXamlMetaDataProvider());

auto winUIResources = winrt::Microsoft::UI::Xaml::Controls::XamlControlsResources();
Resources().MergedDictionaries().Append(winUIResources);
}

XamlApplication::~XamlApplication() {
s_current = nullptr;
}

void XamlApplication::AddMetadataProvider(
winrt::Microsoft::UI::Xaml::Markup::IXamlMetadataProvider const &otherProvider) {
m_providers.push_back(otherProvider);
}

winrt::Microsoft::UI::Xaml::Markup::IXamlType XamlApplication::GetXamlType(
winrt::Windows::UI::Xaml::Interop::TypeName const &type) {
for (const auto &provider : m_providers) {
if (auto result = provider.GetXamlType(type)) {
return result;
}
}
return nullptr;
}

winrt::Microsoft::UI::Xaml::Markup::IXamlType XamlApplication::GetXamlType(hstring const &fullName) {
for (const auto &provider : m_providers) {
if (auto result = provider.GetXamlType(fullName)) {
return result;
}
}

return nullptr;
}
com_array<winrt::Microsoft::UI::Xaml::Markup::XmlnsDefinition> XamlApplication::GetXmlnsDefinitions() {
std::vector<::winrt::Microsoft::UI::Xaml::Markup::XmlnsDefinition> allDefinitions;
for (const auto &provider : m_providers) {
const auto &definitions = provider.GetXmlnsDefinitions();
allDefinitions.insert(allDefinitions.cend(), definitions.cbegin(), definitions.cend());
}
return winrt::com_array<::winrt::Microsoft::UI::Xaml::Markup::XmlnsDefinition>(
allDefinitions.begin(), allDefinitions.end());
}

winrt::Microsoft::ReactNative::Xaml::XamlApplication XamlApplication::s_current{nullptr};
} // namespace winrt::Microsoft::ReactNative::Xaml::implementation
47 changes: 47 additions & 0 deletions vnext/Microsoft.ReactNative/XamlApplication.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#pragma once
#include "Xaml.XamlApplication.g.h"

#include <winrt/Microsoft.UI.Composition.h>
#include <winrt/Microsoft.UI.Dispatching.h>
#include <winrt/Microsoft.UI.Xaml.Controls.Primitives.h>
#include <winrt/Microsoft.UI.Xaml.Controls.h>
#include <winrt/Microsoft.Windows.ApplicationModel.Resources.h>
#include <winrt/Windows.Foundation.h>

#include "winrt/Microsoft.UI.Xaml.Hosting.h"
#include "winrt/Microsoft.UI.Xaml.Interop.h"
#include "winrt/Microsoft.UI.Xaml.Markup.h"
#include "winrt/Microsoft.UI.Xaml.h"

#include "winrt/Windows.UI.Xaml.Interop.h"

#include "XamlMetaDataProvider.h"

namespace winrt::Microsoft::ReactNative::Xaml::implementation {
struct XamlApplication : XamlApplicationT<XamlApplication> {
XamlApplication();
~XamlApplication();

static void EnsureCreated() {
if (Current() == nullptr) {
s_current = winrt::make<winrt::Microsoft::ReactNative::Xaml::implementation::XamlApplication>();
}
}

static winrt::Microsoft::ReactNative::Xaml::XamlApplication Current() {
return s_current;
}

void AddMetadataProvider(winrt::Microsoft::UI::Xaml::Markup::IXamlMetadataProvider const &otherProvider);
winrt::Microsoft::UI::Xaml::Markup::IXamlType GetXamlType(winrt::Windows::UI::Xaml::Interop::TypeName const &type);
winrt::Microsoft::UI::Xaml::Markup::IXamlType GetXamlType(hstring const &fullName);
com_array<winrt::Microsoft::UI::Xaml::Markup::XmlnsDefinition> GetXmlnsDefinitions();

private:
static winrt::Microsoft::ReactNative::Xaml::XamlApplication s_current;
std::vector<winrt::Microsoft::UI::Xaml::Markup::IXamlMetadataProvider> m_providers;
};
} // namespace winrt::Microsoft::ReactNative::Xaml::implementation
namespace winrt::Microsoft::ReactNative::Xaml::factory_implementation {
struct XamlApplication : XamlApplicationT<XamlApplication, implementation::XamlApplication> {};
} // namespace winrt::Microsoft::ReactNative::Xaml::factory_implementation
22 changes: 22 additions & 0 deletions vnext/Microsoft.ReactNative/XamlApplication.idl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#include "DocString.h"

namespace Microsoft.ReactNative.Xaml {
[webhosthidden][default_interface] runtimeclass XamlApplication : Microsoft.UI.Xaml.Application,
Microsoft.UI.Xaml.Markup.IXamlMetadataProvider {
DOC_STRING("Initializes a new XamlApplication instance for RNW-hosted WinUI/XAML.")
XamlApplication();

DOC_STRING("Ensures the XamlApplication singleton exists.")
static void EnsureCreated();

DOC_STRING("Gets the process-wide XamlApplication singleton.")
static XamlApplication Current {
get;
};

DOC_STRING("Adds an additional XAML metadata provider to the application.")
void AddMetadataProvider(Microsoft.UI.Xaml.Markup.IXamlMetadataProvider otherProvider);
}
} // namespace Microsoft.ReactNative.Xaml
61 changes: 61 additions & 0 deletions vnext/Microsoft.ReactNative/XamlHost.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#include "pch.h"

#include "XamlApplication.h"
#include "XamlHost.h"

#if defined(RNW_NEW_ARCH)

#include "..\codegen\react\components\rnwcore\XamlHost.g.h"

namespace winrt::Microsoft::ReactNative {

struct XamlHostComponentView : public winrt::implements<XamlHostComponentView, winrt::IInspectable>,
::Microsoft::ReactNativeSpecs::BaseXamlHost<XamlHostComponentView> {
void InitializeContentIsland(
const winrt::Microsoft::ReactNative::Composition::ContentIslandComponentView &islandView) noexcept {
winrt::Microsoft::ReactNative::Xaml::implementation::XamlApplication::EnsureCreated();

m_xamlIsland = winrt::Microsoft::UI::Xaml::XamlIsland{};

islandView.Connect(m_xamlIsland.ContentIsland());
}

void MountChildComponentView(
const winrt::Microsoft::ReactNative::ComponentView & /*view*/,
const winrt::Microsoft::ReactNative::MountChildComponentViewArgs &args) noexcept override {
// Add the xaml child to the m_xamlIsland here.
auto childXamlControl = args.Child().UserData().as<winrt::Microsoft::ReactNative::Xaml::IXamlControl>();
if (childXamlControl) {
auto xamlElement = childXamlControl.GetXamlElement();
m_xamlIsland.Content(xamlElement);
}
}

void UnmountChildComponentView(
const winrt::Microsoft::ReactNative::ComponentView & /*view*/,
const winrt::Microsoft::ReactNative::UnmountChildComponentViewArgs &) noexcept override {
m_xamlIsland.Content(nullptr);
}

private:
winrt::Microsoft::UI::Xaml::XamlIsland m_xamlIsland{nullptr};
};

} // namespace winrt::Microsoft::ReactNative

void RegisterXamlHostComponentView(winrt::Microsoft::ReactNative::IReactPackageBuilder const &packageBuilder) {
::Microsoft::ReactNativeSpecs::RegisterXamlHostNativeComponent<winrt::Microsoft::ReactNative::XamlHostComponentView>(
packageBuilder,
[](const winrt::Microsoft::ReactNative::Composition::IReactCompositionViewComponentBuilder &builder) {
builder.SetContentIslandComponentViewInitializer(
[](const winrt::Microsoft::ReactNative::Composition::ContentIslandComponentView &islandView) noexcept {
auto userData = winrt::make_self<winrt::Microsoft::ReactNative::XamlHostComponentView>();
userData->InitializeContentIsland(islandView);
islandView.UserData(*userData);
});
});
}

#endif // defined(RNW_NEW_ARCH) && defined(USE_EXPERIMENTAL_WINUI3)
7 changes: 7 additions & 0 deletions vnext/Microsoft.ReactNative/XamlHost.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#if defined(RNW_NEW_ARCH)

void RegisterXamlHostComponentView(winrt::Microsoft::ReactNative::IReactPackageBuilder const &packageBuilder);

#endif // defined(RNW_NEW_ARCH) && defined(USE_EXPERIMENTAL_WINUI3)
Loading
Loading