From 28b1471a37866a78347ff50319c88fe4a4ab8863 Mon Sep 17 00:00:00 2001 From: Sharath Manchala <10109130+sharath2727@users.noreply.github.com> Date: Wed, 8 Oct 2025 16:59:03 +0530 Subject: [PATCH 01/31] initial workspace launching sample app fabric without xaml changes --- .../windows/SampleAppFabric.sln | 81 +++++++++---------- vnext/Shared/Shared.vcxitems.filters | 1 + 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/packages/sample-app-fabric/windows/SampleAppFabric.sln b/packages/sample-app-fabric/windows/SampleAppFabric.sln index 1eabd0cabef..66b1574ab2d 100644 --- a/packages/sample-app-fabric/windows/SampleAppFabric.sln +++ b/packages/sample-app-fabric/windows/SampleAppFabric.sln @@ -36,62 +36,50 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Include", "..\..\..\vnext\include\Include.vcxitems", "{EF074BA1-2D54-4D49-A28E-5E040B47CD2E}" EndProject Global - GlobalSection(SharedMSBuildProjectFiles) = preSolution - ..\..\..\vnext\Shared\Shared.vcxitems*{2049dbe9-8d13-42c9-ae4b-413ae38fffd0}*SharedItemsImports = 9 - ..\..\..\vnext\Mso\Mso.vcxitems*{84e05bfa-cbaf-4f0d-bfb6-4ce85742a57e}*SharedItemsImports = 9 - ..\..\..\vnext\Chakra\Chakra.vcxitems*{c38970c0-5fbf-4d69-90d8-cbac225ae895}*SharedItemsImports = 9 - ..\..\..\vnext\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{da8b35b3-da00-4b02-bde6-6a397b3fd46b}*SharedItemsImports = 9 - ..\..\..\vnext\include\Include.vcxitems*{ef074ba1-2d54-4d49-a28e-5e040b47cd2e}*SharedItemsImports = 9 - ..\..\..\vnext\Chakra\Chakra.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4 - ..\..\..\vnext\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4 - ..\..\..\vnext\Mso\Mso.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4 - ..\..\..\vnext\Shared\Shared.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4 - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM64 = Debug|ARM64 Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 - Debug|ARM64 = Debug|ARM64 + Release|ARM64 = Release|ARM64 Release|x64 = Release|x64 Release|x86 = Release|x86 - Release|ARM64 = Release|ARM64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|ARM64.Build.0 = Debug|ARM64 + {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|ARM64.Deploy.0 = Debug|ARM64 {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|x64.ActiveCfg = Debug|x64 {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|x64.Build.0 = Debug|x64 {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|x64.Deploy.0 = Debug|x64 {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|x86.ActiveCfg = Debug|x86 {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|x86.Build.0 = Debug|x86 {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|x86.Deploy.0 = Debug|x86 - {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|ARM64.Build.0 = Debug|ARM64 - {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|ARM64.ActiveCfg = Release|ARM64 + {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|ARM64.Build.0 = Release|ARM64 + {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|ARM64.Deploy.0 = Release|ARM64 {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|x64.ActiveCfg = Release|x64 {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|x64.Build.0 = Release|x64 {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|x64.Deploy.0 = Release|x64 {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|x86.ActiveCfg = Release|x86 {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|x86.Build.0 = Release|x86 {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|x86.Deploy.0 = Release|x86 - {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|ARM64.ActiveCfg = Release|ARM64 - {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|ARM64.Build.0 = Release|ARM64 - {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|ARM64.Deploy.0 = Release|ARM64 + {E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|ARM64.Build.0 = Debug|ARM64 + {E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|ARM64.Deploy.0 = Debug|ARM64 {E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|x64.ActiveCfg = Debug|x64 {E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|x64.Build.0 = Debug|x64 - {E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|x64.Deploy.0 = Debug|x64 {E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|x86.ActiveCfg = Debug|Win32 {E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|x86.Build.0 = Debug|Win32 {E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|x86.Deploy.0 = Debug|Win32 - {E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|ARM64.Build.0 = Debug|ARM64 - {E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|ARM64.ActiveCfg = Release|ARM64 + {E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|ARM64.Build.0 = Release|ARM64 + {E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|ARM64.Deploy.0 = Release|ARM64 {E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|x64.ActiveCfg = Release|x64 {E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|x64.Build.0 = Release|x64 {E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|x64.Deploy.0 = Release|x64 {E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|x86.ActiveCfg = Release|Win32 {E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|x86.Build.0 = Release|Win32 {E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|x86.Deploy.0 = Release|Win32 - {E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|ARM64.ActiveCfg = Release|ARM64 - {E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|ARM64.Build.0 = Release|ARM64 - {E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|ARM64.Deploy.0 = Release|ARM64 {A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|ARM64.ActiveCfg = Debug|ARM64 {A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|ARM64.Build.0 = Debug|ARM64 {A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|x64.ActiveCfg = Debug|x64 @@ -104,6 +92,20 @@ Global {A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x64.Build.0 = Release|x64 {A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x86.ActiveCfg = Release|Win32 {A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x86.Build.0 = Release|Win32 + {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|ARM64.Build.0 = Debug|ARM64 + {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x64.ActiveCfg = Debug|x64 + {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x64.Build.0 = Debug|x64 + {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x86.ActiveCfg = Debug|Win32 + {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x86.Build.0 = Debug|Win32 + {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x86.Deploy.0 = Debug|Win32 + {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|ARM64.ActiveCfg = Release|ARM64 + {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|ARM64.Build.0 = Release|ARM64 + {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x64.ActiveCfg = Release|x64 + {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x64.Build.0 = Release|x64 + {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x86.ActiveCfg = Release|Win32 + {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x86.Build.0 = Release|Win32 + {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x86.Deploy.0 = Release|Win32 {A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|ARM64.ActiveCfg = Debug|ARM64 {A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|ARM64.Build.0 = Debug|ARM64 {A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|x64.ActiveCfg = Debug|x64 @@ -140,26 +142,13 @@ Global {FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|x64.Build.0 = Release|x64 {FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|x86.ActiveCfg = Release|Win32 {FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|x86.Build.0 = Release|Win32 - {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|ARM64.Build.0 = Debug|ARM64 - {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x64.ActiveCfg = Debug|x64 - {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x64.Build.0 = Debug|x64 - {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x86.ActiveCfg = Debug|Win32 - {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x86.Build.0 = Debug|Win32 - {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x86.Deploy.0 = Debug|Win32 - {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|ARM64.ActiveCfg = Release|ARM64 - {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|ARM64.Build.0 = Release|ARM64 - {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x64.ActiveCfg = Release|x64 - {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x64.Build.0 = Release|x64 - {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x86.ActiveCfg = Release|Win32 - {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x86.Build.0 = Release|Win32 - {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x86.Deploy.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {A990658C-CE31-4BCC-976F-0FC6B1AF693D} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1} + {14B93DC8-FD93-4A6D-81CB-8BC96644501C} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1} {A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1} {C38970C0-5FBF-4D69-90D8-CBAC225AE895} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1} {F7D32BD0-2749-483E-9A0D-1635EF7E3136} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1} @@ -168,9 +157,19 @@ Global {2049DBE9-8D13-42C9-AE4B-413AE38FFFD0} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1} {84E05BFA-CBAF-4F0D-BFB6-4CE85742A57E} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1} {EF074BA1-2D54-4D49-A28E-5E040B47CD2E} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1} - {14B93DC8-FD93-4A6D-81CB-8BC96644501C} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {D43FAD39-F619-437D-BB40-04A3982ACB6A} EndGlobalSection + GlobalSection(SharedMSBuildProjectFiles) = preSolution + ..\..\..\vnext\Shared\Shared.vcxitems*{2049dbe9-8d13-42c9-ae4b-413ae38fffd0}*SharedItemsImports = 9 + ..\..\..\vnext\Mso\Mso.vcxitems*{84e05bfa-cbaf-4f0d-bfb6-4ce85742a57e}*SharedItemsImports = 9 + ..\..\..\vnext\Chakra\Chakra.vcxitems*{c38970c0-5fbf-4d69-90d8-cbac225ae895}*SharedItemsImports = 9 + ..\..\..\vnext\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{da8b35b3-da00-4b02-bde6-6a397b3fd46b}*SharedItemsImports = 9 + ..\..\..\vnext\include\Include.vcxitems*{ef074ba1-2d54-4d49-a28e-5e040b47cd2e}*SharedItemsImports = 9 + ..\..\..\vnext\Chakra\Chakra.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4 + ..\..\..\vnext\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4 + ..\..\..\vnext\Mso\Mso.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4 + ..\..\..\vnext\Shared\Shared.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4 + EndGlobalSection EndGlobal diff --git a/vnext/Shared/Shared.vcxitems.filters b/vnext/Shared/Shared.vcxitems.filters index 2ee2d481859..ea4dfb8d5fa 100644 --- a/vnext/Shared/Shared.vcxitems.filters +++ b/vnext/Shared/Shared.vcxitems.filters @@ -327,6 +327,7 @@ + From 7cb5b7e48e70e4065511d31a56ebeb0b8a135256 Mon Sep 17 00:00:00 2001 From: Sharath Manchala <10109130+sharath2727@users.noreply.github.com> Date: Wed, 8 Oct 2025 17:27:00 +0530 Subject: [PATCH 02/31] XamlHost Definition, declaration and Codegen components --- .../components/rnwcore/ComponentDescriptors.h | 1 + .../components/rnwcore/EventEmitters.cpp | 1 + .../react/components/rnwcore/EventEmitters.h | 7 + .../react/components/rnwcore/Props.cpp | 25 +++ .../codegen/react/components/rnwcore/Props.h | 14 ++ .../react/components/rnwcore/ShadowNodes.cpp | 1 + .../react/components/rnwcore/ShadowNodes.h | 11 + .../codegen/react/components/rnwcore/States.h | 12 ++ .../react/components/rnwcore/XamlHost.g.h | 200 ++++++++++++++++++ vnext/fmt/packages.lock.json | 13 ++ .../Libraries/Components/Xaml/XamlHost.d.ts | 13 ++ .../Components/Xaml/XamlHost.windows.js | 7 + vnext/src-win/index.windows.js | 1 + .../Xaml/XamlHostNativeComponent.js | 19 ++ 14 files changed, 325 insertions(+) create mode 100644 vnext/codegen/react/components/rnwcore/XamlHost.g.h create mode 100644 vnext/fmt/packages.lock.json create mode 100644 vnext/src-win/Libraries/Components/Xaml/XamlHost.d.ts create mode 100644 vnext/src-win/Libraries/Components/Xaml/XamlHost.windows.js create mode 100644 vnext/src-win/src/private/specs_DEPRECATED/Xaml/XamlHostNativeComponent.js diff --git a/vnext/codegen/react/components/rnwcore/ComponentDescriptors.h b/vnext/codegen/react/components/rnwcore/ComponentDescriptors.h index 45b7b5ea904..f3d7509b0e9 100644 --- a/vnext/codegen/react/components/rnwcore/ComponentDescriptors.h +++ b/vnext/codegen/react/components/rnwcore/ComponentDescriptors.h @@ -23,6 +23,7 @@ using DebuggingOverlayComponentDescriptor = ConcreteComponentDescriptor; using SwitchComponentDescriptor = ConcreteComponentDescriptor; using UnimplementedNativeViewComponentDescriptor = ConcreteComponentDescriptor; +using XamlHostComponentDescriptor = ConcreteComponentDescriptor; void rnwcore_registerComponentDescriptorsFromCodegen( std::shared_ptr registry); diff --git a/vnext/codegen/react/components/rnwcore/EventEmitters.cpp b/vnext/codegen/react/components/rnwcore/EventEmitters.cpp index b606e786965..4c80fea3870 100644 --- a/vnext/codegen/react/components/rnwcore/EventEmitters.cpp +++ b/vnext/codegen/react/components/rnwcore/EventEmitters.cpp @@ -129,4 +129,5 @@ payload.setProperty(runtime, "target", event.target); } + } // namespace facebook::react diff --git a/vnext/codegen/react/components/rnwcore/EventEmitters.h b/vnext/codegen/react/components/rnwcore/EventEmitters.h index 0c3bce4a218..ccac8315736 100644 --- a/vnext/codegen/react/components/rnwcore/EventEmitters.h +++ b/vnext/codegen/react/components/rnwcore/EventEmitters.h @@ -165,5 +165,12 @@ class UnimplementedNativeViewEventEmitter : public ViewEventEmitter { +}; +class XamlHostEventEmitter : public ViewEventEmitter { + public: + using ViewEventEmitter::ViewEventEmitter; + + + }; } // namespace facebook::react diff --git a/vnext/codegen/react/components/rnwcore/Props.cpp b/vnext/codegen/react/components/rnwcore/Props.cpp index ddfb5e91f62..87ce6e85903 100644 --- a/vnext/codegen/react/components/rnwcore/Props.cpp +++ b/vnext/codegen/react/components/rnwcore/Props.cpp @@ -546,5 +546,30 @@ folly::dynamic UnimplementedNativeViewProps::getDiffProps( return result; } #endif +XamlHostProps::XamlHostProps( + const PropsParserContext &context, + const XamlHostProps &sourceProps, + const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), + + label(convertRawProp(context, rawProps, "label", sourceProps.label, {})) {} + +#ifdef RN_SERIALIZABLE_STATE +folly::dynamic XamlHostProps::getDiffProps( + const Props* prevProps) const { + static const auto defaultProps = XamlHostProps(); + const XamlHostProps* oldProps = prevProps == nullptr + ? &defaultProps + : static_cast(prevProps); + if (this == oldProps) { + return folly::dynamic::object(); + } + folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps); + + if (label != oldProps->label) { + result["label"] = label; + } + return result; +} +#endif } // namespace facebook::react diff --git a/vnext/codegen/react/components/rnwcore/Props.h b/vnext/codegen/react/components/rnwcore/Props.h index e144d2b3f2c..19d29a0769f 100644 --- a/vnext/codegen/react/components/rnwcore/Props.h +++ b/vnext/codegen/react/components/rnwcore/Props.h @@ -447,4 +447,18 @@ class UnimplementedNativeViewProps final : public ViewProps { #endif }; +class XamlHostProps final : public ViewProps { + public: + XamlHostProps() = default; + XamlHostProps(const PropsParserContext& context, const XamlHostProps &sourceProps, const RawProps &rawProps); + +#pragma mark - Props + + std::string label{}; + + #ifdef RN_SERIALIZABLE_STATE + folly::dynamic getDiffProps(const Props* prevProps) const override; + #endif +}; + } // namespace facebook::react diff --git a/vnext/codegen/react/components/rnwcore/ShadowNodes.cpp b/vnext/codegen/react/components/rnwcore/ShadowNodes.cpp index dccefb1d478..627e9a2d3fe 100644 --- a/vnext/codegen/react/components/rnwcore/ShadowNodes.cpp +++ b/vnext/codegen/react/components/rnwcore/ShadowNodes.cpp @@ -19,5 +19,6 @@ extern const char DebuggingOverlayComponentName[] = "DebuggingOverlay"; extern const char PullToRefreshViewComponentName[] = "PullToRefreshView"; extern const char SwitchComponentName[] = "Switch"; extern const char UnimplementedNativeViewComponentName[] = "UnimplementedNativeView"; +extern const char XamlHostComponentName[] = "XamlHost"; } // namespace facebook::react diff --git a/vnext/codegen/react/components/rnwcore/ShadowNodes.h b/vnext/codegen/react/components/rnwcore/ShadowNodes.h index 2c7c94720cf..9b45530d5ad 100644 --- a/vnext/codegen/react/components/rnwcore/ShadowNodes.h +++ b/vnext/codegen/react/components/rnwcore/ShadowNodes.h @@ -95,4 +95,15 @@ using UnimplementedNativeViewShadowNode = ConcreteViewShadowNode< UnimplementedNativeViewEventEmitter, UnimplementedNativeViewState>; +JSI_EXPORT extern const char XamlHostComponentName[]; + +/* + * `ShadowNode` for component. + */ +using XamlHostShadowNode = ConcreteViewShadowNode< + XamlHostComponentName, + XamlHostProps, + XamlHostEventEmitter, + XamlHostState>; + } // namespace facebook::react diff --git a/vnext/codegen/react/components/rnwcore/States.h b/vnext/codegen/react/components/rnwcore/States.h index b7bece41b3f..09c3f7fa70a 100644 --- a/vnext/codegen/react/components/rnwcore/States.h +++ b/vnext/codegen/react/components/rnwcore/States.h @@ -98,4 +98,16 @@ class UnimplementedNativeViewState { #endif }; +class XamlHostState { +public: + XamlHostState() = default; + +#ifdef RN_SERIALIZABLE_STATE + XamlHostState(XamlHostState const &previousState, folly::dynamic data){}; + folly::dynamic getDynamic() const { + return {}; + }; +#endif +}; + } // namespace facebook::react \ No newline at end of file diff --git a/vnext/codegen/react/components/rnwcore/XamlHost.g.h b/vnext/codegen/react/components/rnwcore/XamlHost.g.h new file mode 100644 index 00000000000..26bd059c3c3 --- /dev/null +++ b/vnext/codegen/react/components/rnwcore/XamlHost.g.h @@ -0,0 +1,200 @@ + +/* + * This file is auto-generated from XamlHostNativeComponent spec file in flow / TypeScript. + */ +// clang-format off +#pragma once + +#include + +#ifdef RNW_NEW_ARCH +#include + +#include +#include +#endif // #ifdef RNW_NEW_ARCH + +#ifdef RNW_NEW_ARCH + +namespace Microsoft::ReactNativeSpecs { + +REACT_STRUCT(XamlHostProps) +struct XamlHostProps : winrt::implements { + XamlHostProps(winrt::Microsoft::ReactNative::ViewProps props, const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom) + : ViewProps(props) + { + if (cloneFrom) { + auto cloneFromProps = cloneFrom.as(); + label = cloneFromProps->label; + } + } + + void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept { + winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this); + } + + REACT_FIELD(label) + std::optional label; + + const winrt::Microsoft::ReactNative::ViewProps ViewProps; +}; + +struct XamlHostEventEmitter { + XamlHostEventEmitter(const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter) + : m_eventEmitter(eventEmitter) {} + + private: + winrt::Microsoft::ReactNative::EventEmitter m_eventEmitter{nullptr}; +}; + +template +struct BaseXamlHost { + + virtual void UpdateProps( + const winrt::Microsoft::ReactNative::ComponentView &/*view*/, + const winrt::com_ptr &newProps, + const winrt::com_ptr &/*oldProps*/) noexcept { + m_props = newProps; + } + + // UpdateLayoutMetrics will only be called if this method is overridden + virtual void UpdateLayoutMetrics( + const winrt::Microsoft::ReactNative::ComponentView &/*view*/, + const winrt::Microsoft::ReactNative::LayoutMetrics &/*newLayoutMetrics*/, + const winrt::Microsoft::ReactNative::LayoutMetrics &/*oldLayoutMetrics*/) noexcept { + } + + // UpdateState will only be called if this method is overridden + virtual void UpdateState( + const winrt::Microsoft::ReactNative::ComponentView &/*view*/, + const winrt::Microsoft::ReactNative::IComponentState &/*newState*/) noexcept { + } + + virtual void UpdateEventEmitter(const std::shared_ptr &eventEmitter) noexcept { + m_eventEmitter = eventEmitter; + } + + // MountChildComponentView will only be called if this method is overridden + virtual void MountChildComponentView(const winrt::Microsoft::ReactNative::ComponentView &/*view*/, + const winrt::Microsoft::ReactNative::MountChildComponentViewArgs &/*args*/) noexcept { + } + + // UnmountChildComponentView will only be called if this method is overridden + virtual void UnmountChildComponentView(const winrt::Microsoft::ReactNative::ComponentView &/*view*/, + const winrt::Microsoft::ReactNative::UnmountChildComponentViewArgs &/*args*/) noexcept { + } + + // Initialize will only be called if this method is overridden + virtual void Initialize(const winrt::Microsoft::ReactNative::ComponentView &/*view*/) noexcept { + } + + // CreateVisual will only be called if this method is overridden + virtual winrt::Microsoft::UI::Composition::Visual CreateVisual(const winrt::Microsoft::ReactNative::ComponentView &view) noexcept { + return view.as().Compositor().CreateSpriteVisual(); + } + + // FinalizeUpdate will only be called if this method is overridden + virtual void FinalizeUpdate(const winrt::Microsoft::ReactNative::ComponentView &/*view*/, + winrt::Microsoft::ReactNative::ComponentViewUpdateMask /*mask*/) noexcept { + } + + + + const std::shared_ptr& EventEmitter() const { return m_eventEmitter; } + const winrt::com_ptr& Props() const { return m_props; } + +private: + winrt::com_ptr m_props; + std::shared_ptr m_eventEmitter; +}; + +template +void RegisterXamlHostNativeComponent( + winrt::Microsoft::ReactNative::IReactPackageBuilder const &packageBuilder, + std::function builderCallback) noexcept { + packageBuilder.as().AddViewComponent( + L"XamlHost", [builderCallback](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept { + auto compBuilder = builder.as(); + + builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props, + const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom) noexcept { + return winrt::make(props, cloneFrom); + }); + + builder.SetUpdatePropsHandler([](const winrt::Microsoft::ReactNative::ComponentView &view, + const winrt::Microsoft::ReactNative::IComponentProps &newProps, + const winrt::Microsoft::ReactNative::IComponentProps &oldProps) noexcept { + auto userData = view.UserData().as(); + userData->UpdateProps(view, newProps ? newProps.as() : nullptr, oldProps ? oldProps.as() : nullptr); + }); + + compBuilder.SetUpdateLayoutMetricsHandler([](const winrt::Microsoft::ReactNative::ComponentView &view, + const winrt::Microsoft::ReactNative::LayoutMetrics &newLayoutMetrics, + const winrt::Microsoft::ReactNative::LayoutMetrics &oldLayoutMetrics) noexcept { + auto userData = view.UserData().as(); + userData->UpdateLayoutMetrics(view, newLayoutMetrics, oldLayoutMetrics); + }); + + builder.SetUpdateEventEmitterHandler([](const winrt::Microsoft::ReactNative::ComponentView &view, + const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter) noexcept { + auto userData = view.UserData().as(); + userData->UpdateEventEmitter(std::make_shared(eventEmitter)); + }); + + if CONSTEXPR_SUPPORTED_ON_VIRTUAL_FN_ADDRESS (&TUserData::FinalizeUpdate != &BaseXamlHost::FinalizeUpdate) { + builder.SetFinalizeUpdateHandler([](const winrt::Microsoft::ReactNative::ComponentView &view, + winrt::Microsoft::ReactNative::ComponentViewUpdateMask mask) noexcept { + auto userData = view.UserData().as(); + userData->FinalizeUpdate(view, mask); + }); + } + + if CONSTEXPR_SUPPORTED_ON_VIRTUAL_FN_ADDRESS (&TUserData::UpdateState != &BaseXamlHost::UpdateState) { + builder.SetUpdateStateHandler([](const winrt::Microsoft::ReactNative::ComponentView &view, + const winrt::Microsoft::ReactNative::IComponentState &newState) noexcept { + auto userData = view.UserData().as(); + userData->UpdateState(view, newState); + }); + } + + if CONSTEXPR_SUPPORTED_ON_VIRTUAL_FN_ADDRESS (&TUserData::MountChildComponentView != &BaseXamlHost::MountChildComponentView) { + builder.SetMountChildComponentViewHandler([](const winrt::Microsoft::ReactNative::ComponentView &view, + const winrt::Microsoft::ReactNative::MountChildComponentViewArgs &args) noexcept { + auto userData = view.UserData().as(); + return userData->MountChildComponentView(view, args); + }); + } + + if CONSTEXPR_SUPPORTED_ON_VIRTUAL_FN_ADDRESS (&TUserData::UnmountChildComponentView != &BaseXamlHost::UnmountChildComponentView) { + builder.SetUnmountChildComponentViewHandler([](const winrt::Microsoft::ReactNative::ComponentView &view, + const winrt::Microsoft::ReactNative::UnmountChildComponentViewArgs &args) noexcept { + auto userData = view.UserData().as(); + return userData->UnmountChildComponentView(view, args); + }); + } + + compBuilder.SetViewComponentViewInitializer([](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept { + auto userData = winrt::make_self(); + if CONSTEXPR_SUPPORTED_ON_VIRTUAL_FN_ADDRESS (&TUserData::Initialize != &BaseXamlHost::Initialize) { + userData->Initialize(view); + } + view.UserData(*userData); + }); + + if CONSTEXPR_SUPPORTED_ON_VIRTUAL_FN_ADDRESS (&TUserData::CreateVisual != &BaseXamlHost::CreateVisual) { + compBuilder.SetCreateVisualHandler([](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept { + auto userData = view.UserData().as(); + return userData->CreateVisual(view); + }); + } + + // Allow app to further customize the builder + if (builderCallback) { + builderCallback(compBuilder); + } + }); +} + +} // namespace Microsoft::ReactNativeSpecs + +#endif // #ifdef RNW_NEW_ARCH diff --git a/vnext/fmt/packages.lock.json b/vnext/fmt/packages.lock.json new file mode 100644 index 00000000000..a31237b580e --- /dev/null +++ b/vnext/fmt/packages.lock.json @@ -0,0 +1,13 @@ +{ + "version": 1, + "dependencies": { + "native,Version=v0.0": {}, + "native,Version=v0.0/win10-arm": {}, + "native,Version=v0.0/win10-arm-aot": {}, + "native,Version=v0.0/win10-arm64-aot": {}, + "native,Version=v0.0/win10-x64": {}, + "native,Version=v0.0/win10-x64-aot": {}, + "native,Version=v0.0/win10-x86": {}, + "native,Version=v0.0/win10-x86-aot": {} + } +} \ No newline at end of file diff --git a/vnext/src-win/Libraries/Components/Xaml/XamlHost.d.ts b/vnext/src-win/Libraries/Components/Xaml/XamlHost.d.ts new file mode 100644 index 00000000000..42f34d63e58 --- /dev/null +++ b/vnext/src-win/Libraries/Components/Xaml/XamlHost.d.ts @@ -0,0 +1,13 @@ +/** + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * @format + * @flow + */ +/// +import type {ViewProps} from 'react-native'; +export interface XamlHostProps extends ViewProps { + label: string; +} +declare const _default: import('react-native/Libraries/Utilities/codegenNativeComponent').NativeComponentType; +export default _default; \ No newline at end of file diff --git a/vnext/src-win/Libraries/Components/Xaml/XamlHost.windows.js b/vnext/src-win/Libraries/Components/Xaml/XamlHost.windows.js new file mode 100644 index 00000000000..c481f62c8fb --- /dev/null +++ b/vnext/src-win/Libraries/Components/Xaml/XamlHost.windows.js @@ -0,0 +1,7 @@ +/** + * @format + * @flow + */ + +import XamlHost from '../../../src/private/specs_DEPRECATED/components/Xaml/XamlHostNativeComponent'; +export default XamlHost; \ No newline at end of file diff --git a/vnext/src-win/index.windows.js b/vnext/src-win/index.windows.js index f9ac06c9822..4588ecff539 100644 --- a/vnext/src-win/index.windows.js +++ b/vnext/src-win/index.windows.js @@ -48,6 +48,7 @@ import typeof SafeAreaView from './Libraries/Components/SafeAreaView/SafeAreaVie import typeof ScrollView from './Libraries/Components/ScrollView/ScrollView'; import typeof StatusBar from './Libraries/Components/StatusBar/StatusBar'; import typeof Switch from './Libraries/Components/Switch/Switch'; +import typeof XamlHost from './Libraries/Components/Xaml/XamlHost'; import typeof InputAccessoryView from './Libraries/Components/TextInput/InputAccessoryView'; import TextInput from './Libraries/Components/TextInput/TextInput'; import typeof ToastAndroid from './Libraries/Components/ToastAndroid/ToastAndroid'; diff --git a/vnext/src-win/src/private/specs_DEPRECATED/Xaml/XamlHostNativeComponent.js b/vnext/src-win/src/private/specs_DEPRECATED/Xaml/XamlHostNativeComponent.js new file mode 100644 index 00000000000..9b7b7d07c40 --- /dev/null +++ b/vnext/src-win/src/private/specs_DEPRECATED/Xaml/XamlHostNativeComponent.js @@ -0,0 +1,19 @@ +/** + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * @format + * @flow + */ + +'use strict'; + +import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; + +type XamlHostProps = $ReadOnly<{| + ...ViewProps, + + // Props + label?: string, +|}>; + +export default codegenNativeComponent('XamlHost'); \ No newline at end of file From ffa1c0396e809adc8c431b8e261ecf01840b8d91 Mon Sep 17 00:00:00 2001 From: Sharath Manchala <10109130+sharath2727@users.noreply.github.com> Date: Wed, 8 Oct 2025 17:40:37 +0530 Subject: [PATCH 03/31] Introduce XamlApplication that enables to host xaml ui --- vnext/Microsoft.ReactNative/App.xaml | 6 ++ .../Microsoft.ReactNative/XamlApplication.cpp | 79 +++++++++++++++++++ vnext/Microsoft.ReactNative/XamlApplication.h | 47 +++++++++++ .../Microsoft.ReactNative/XamlApplication.idl | 17 ++++ vnext/Shared/Shared.vcxitems | 14 ++++ 5 files changed, 163 insertions(+) create mode 100644 vnext/Microsoft.ReactNative/App.xaml create mode 100644 vnext/Microsoft.ReactNative/XamlApplication.cpp create mode 100644 vnext/Microsoft.ReactNative/XamlApplication.h create mode 100644 vnext/Microsoft.ReactNative/XamlApplication.idl diff --git a/vnext/Microsoft.ReactNative/App.xaml b/vnext/Microsoft.ReactNative/App.xaml new file mode 100644 index 00000000000..3354935ec8d --- /dev/null +++ b/vnext/Microsoft.ReactNative/App.xaml @@ -0,0 +1,6 @@ + + diff --git a/vnext/Microsoft.ReactNative/XamlApplication.cpp b/vnext/Microsoft.ReactNative/XamlApplication.cpp new file mode 100644 index 00000000000..4bc71b863ed --- /dev/null +++ b/vnext/Microsoft.ReactNative/XamlApplication.cpp @@ -0,0 +1,79 @@ +#include "pch.h" +#include "XamlApplication.h" +#include "XamlApplication.g.cpp" + +#include "winrt/Microsoft.UI.Xaml.XamlTypeInfo.h" + +namespace winrt::Microsoft::ReactNative::implementation +{ +using namespace ::winrt::Microsoft::UI::Xaml; +using namespace ::winrt::Microsoft::UI::Xaml::Markup; +using namespace ::winrt::Windows::UI::Xaml::Interop; + XamlApplication::XamlApplication() + { + //m_providers.push_back(winrt::make_self().as()); + 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() + .as()); // 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 (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 (auto &&provider : m_providers) { + if (auto result = provider.GetXamlType(fullName)) { + return result; + } + } + + return nullptr; + } + com_array XamlApplication::GetXmlnsDefinitions() + { + std::vector<::winrt::Microsoft::UI::Xaml::Markup::XmlnsDefinition> allDefinitions; + for (const auto &provider : m_providers) { + auto definitionsCurrentProvider = provider.GetXmlnsDefinitions(); + for (const auto &definition : definitionsCurrentProvider) { + allDefinitions.insert(allDefinitions.begin(), definition); + } + } + return winrt::com_array<::winrt::Microsoft::UI::Xaml::Markup::XmlnsDefinition>( + allDefinitions.begin(), allDefinitions.end()); + } + + winrt::Microsoft::ReactNative::XamlApplication XamlApplication::s_current{nullptr}; +} diff --git a/vnext/Microsoft.ReactNative/XamlApplication.h b/vnext/Microsoft.ReactNative/XamlApplication.h new file mode 100644 index 00000000000..6a9e6d3b7a6 --- /dev/null +++ b/vnext/Microsoft.ReactNative/XamlApplication.h @@ -0,0 +1,47 @@ +#pragma once +#include "XamlApplication.g.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::implementation +{ + struct XamlApplication : XamlApplicationT + { + XamlApplication(); + ~XamlApplication(); + + static void EnsureCreated() + { + if (Current() == nullptr) { + s_current = winrt::make(); + } + } + + static winrt::Microsoft::ReactNative::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 GetXmlnsDefinitions(); + + private: + static winrt::Microsoft::ReactNative::XamlApplication s_current; + std::vector m_providers; + }; +} +namespace winrt::Microsoft::ReactNative::factory_implementation +{ + struct XamlApplication : XamlApplicationT + { + }; +} diff --git a/vnext/Microsoft.ReactNative/XamlApplication.idl b/vnext/Microsoft.ReactNative/XamlApplication.idl new file mode 100644 index 00000000000..928ac01617f --- /dev/null +++ b/vnext/Microsoft.ReactNative/XamlApplication.idl @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +namespace Microsoft.ReactNative { +[webhosthidden][default_interface] runtimeclass XamlApplication : Microsoft.UI.Xaml.Application, + Microsoft.UI.Xaml.Markup.IXamlMetadataProvider { + XamlApplication(); + + static void EnsureCreated(); + + static XamlApplication Current { + get; + }; + + void AddMetadataProvider(Microsoft.UI.Xaml.Markup.IXamlMetadataProvider otherProvider); +} +} // namespace Microsoft.ReactNative. Xaml diff --git a/vnext/Shared/Shared.vcxitems b/vnext/Shared/Shared.vcxitems index b8b3fcb6795..d23b1dc7e7f 100644 --- a/vnext/Shared/Shared.vcxitems +++ b/vnext/Shared/Shared.vcxitems @@ -245,6 +245,11 @@ true $(ReactNativeWindowsDir)Microsoft.ReactNative\ReactNativeAppBuilder.idl Code + + + true + $(ReactNativeWindowsDir)Microsoft.ReactNative\XamlApplication.idl + Code @@ -350,6 +355,11 @@ true $(MSBuildThisFileDirectory)..\Microsoft.ReactNative\ReactNativeAppBuilder.idl Code + + + true + $(MSBuildThisFileDirectory)..\Microsoft.ReactNative\XamlApplication.idl + Code $(MSBuildThisFileDirectory)..\Microsoft.ReactNative\IJSValueReader.idl @@ -708,6 +718,7 @@ + @@ -723,4 +734,7 @@ NotUsing + + + From b7cbe82ff3821fa4b45d28c9a0a9f2f647411ea5 Mon Sep 17 00:00:00 2001 From: Sharath Manchala <10109130+sharath2727@users.noreply.github.com> Date: Thu, 9 Oct 2025 11:29:23 +0530 Subject: [PATCH 04/31] Introduce xamlhost component --- vnext/Microsoft.ReactNative/Pch/pch.h | 17 +++++ vnext/Microsoft.ReactNative/XamlHost.cpp | 85 ++++++++++++++++++++++++ vnext/Microsoft.ReactNative/XamlHost.h | 10 +++ 3 files changed, 112 insertions(+) create mode 100644 vnext/Microsoft.ReactNative/XamlHost.cpp create mode 100644 vnext/Microsoft.ReactNative/XamlHost.h diff --git a/vnext/Microsoft.ReactNative/Pch/pch.h b/vnext/Microsoft.ReactNative/Pch/pch.h index 34b0b02b9be..9447187a9c1 100644 --- a/vnext/Microsoft.ReactNative/Pch/pch.h +++ b/vnext/Microsoft.ReactNative/Pch/pch.h @@ -77,3 +77,20 @@ #include #include #include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/vnext/Microsoft.ReactNative/XamlHost.cpp b/vnext/Microsoft.ReactNative/XamlHost.cpp new file mode 100644 index 00000000000..335cdacdebb --- /dev/null +++ b/vnext/Microsoft.ReactNative/XamlHost.cpp @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +#include "pch.h" + +#include "XamlApplication.h" +#include "XamlHost.h" +#include +#include + +#if defined(RNW_NEW_ARCH) + +#include "..\codegen\react\components\rnwcore\XamlHost.g.h" + +namespace winrt::Microsoft::ReactNative { + +struct XamlHostComponentView : public winrt::implements, + ::Microsoft::ReactNativeSpecs::BaseXamlHost { + void InitializeContentIsland( + const winrt::Microsoft::ReactNative::Composition::ContentIslandComponentView &islandView) noexcept { + winrt::Microsoft::ReactNative::implementation::XamlApplication::EnsureCreated(); + + m_xamlIsland = winrt::Microsoft::UI::Xaml::XamlIsland{}; + + // Host a xaml button in the xaml island + winrt::Microsoft::UI::Xaml::Controls::Button button; + button.Content(winrt::box_value(L"Click Me")); + button.HorizontalAlignment(winrt::Microsoft::UI::Xaml::HorizontalAlignment::Stretch); + button.VerticalAlignment(winrt::Microsoft::UI::Xaml::VerticalAlignment::Stretch); + // Attach Click event handler + button.Click([](winrt::IInspectable const &, winrt::Microsoft::UI::Xaml::RoutedEventArgs const &) { + OutputDebugString(L"Welcome to XAML world\n"); + }); + + + button.GotFocus([](winrt::IInspectable const &, + winrt::Microsoft::UI::Xaml::RoutedEventArgs const &) { + OutputDebugString(L"[XamlHost] Button received focus\n"); + }); + + // Accessibility-friendly settings + winrt::Microsoft::UI::Xaml::Automation::AutomationProperties::SetName(button, L"XAML Button"); + winrt::Microsoft::UI::Xaml::Automation::AutomationProperties::SetHelpText( + button, L"This is a button hosted in XAML Island."); + winrt::Microsoft::UI::Xaml::Automation::AutomationProperties::SetAutomationId(button, L"XamlButton1"); + + auto peer = winrt::Microsoft::UI::Xaml::Automation::Peers::FrameworkElementAutomationPeer::FromElement(button); + + auto buttonPeer = peer.try_as(); + + auto string = buttonPeer.GetHelpText(); + + button.IsTabStop(true); + button.TabIndex(0); + + m_xamlIsland.Content(button); + + 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(); + 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 + +#endif // defined(RNW_NEW_ARCH) && defined(USE_EXPERIMENTAL_WINUI3) diff --git a/vnext/Microsoft.ReactNative/XamlHost.h b/vnext/Microsoft.ReactNative/XamlHost.h new file mode 100644 index 00000000000..d64bb111f95 --- /dev/null +++ b/vnext/Microsoft.ReactNative/XamlHost.h @@ -0,0 +1,10 @@ +#pragma once + +#if defined(RNW_NEW_ARCH) + +__declspec(dllexport) void RegisterXamlHostComponentView( + winrt::Microsoft::ReactNative::IReactPackageBuilder const &packageBuilder); + +//void RegisterXamlControl(winrt::Microsoft::ReactNative::IReactPackageBuilder const &packageBuilder); + +#endif // defined(RNW_NEW_ARCH) && defined(USE_EXPERIMENTAL_WINUI3) From ed1e67c07bd707465a89447906e26a8c8526ee50 Mon Sep 17 00:00:00 2001 From: Sharath Manchala <10109130+sharath2727@users.noreply.github.com> Date: Thu, 9 Oct 2025 11:49:53 +0530 Subject: [PATCH 05/31] Register XamlHostComponentView --- vnext/Microsoft.ReactNative/XamlHost.cpp | 13 +++++++++++++ .../Microsoft.ReactNative/microsoft.reactnative.def | 1 + vnext/Shared/Shared.vcxitems | 10 ++++++++++ 3 files changed, 24 insertions(+) diff --git a/vnext/Microsoft.ReactNative/XamlHost.cpp b/vnext/Microsoft.ReactNative/XamlHost.cpp index 335cdacdebb..1a91194003e 100644 --- a/vnext/Microsoft.ReactNative/XamlHost.cpp +++ b/vnext/Microsoft.ReactNative/XamlHost.cpp @@ -80,6 +80,19 @@ struct XamlHostComponentView : public winrt::implements( + packageBuilder, + [](const winrt::Microsoft::ReactNative::Composition::IReactCompositionViewComponentBuilder &builder) { + builder.SetContentIslandComponentViewInitializer( + [](const winrt::Microsoft::ReactNative::Composition::ContentIslandComponentView &islandView) noexcept { + auto userData = winrt::make_self(); + userData->InitializeContentIsland(islandView); + islandView.UserData(*userData); + }); + }); +} + } // namespace winrt::Microsoft::ReactNative #endif // defined(RNW_NEW_ARCH) && defined(USE_EXPERIMENTAL_WINUI3) diff --git a/vnext/Microsoft.ReactNative/microsoft.reactnative.def b/vnext/Microsoft.ReactNative/microsoft.reactnative.def index d04a02ea81e..faff126f6c4 100644 --- a/vnext/Microsoft.ReactNative/microsoft.reactnative.def +++ b/vnext/Microsoft.ReactNative/microsoft.reactnative.def @@ -1,3 +1,4 @@ EXPORTS DllCanUnloadNow = WINRT_CanUnloadNow PRIVATE DllGetActivationFactory = WINRT_GetActivationFactory PRIVATE +RegisterXamlHostComponentView diff --git a/vnext/Shared/Shared.vcxitems b/vnext/Shared/Shared.vcxitems index d23b1dc7e7f..8bf641b621c 100644 --- a/vnext/Shared/Shared.vcxitems +++ b/vnext/Shared/Shared.vcxitems @@ -250,6 +250,11 @@ true $(ReactNativeWindowsDir)Microsoft.ReactNative\XamlApplication.idl Code + + + true + $(ReactNativeWindowsDir)Microsoft.ReactNative\XamlApplication.idl + Code @@ -360,6 +365,11 @@ true $(MSBuildThisFileDirectory)..\Microsoft.ReactNative\XamlApplication.idl Code + + + true + $(MSBuildThisFileDirectory)..\Microsoft.ReactNative\XamlApplication.idl + Code $(MSBuildThisFileDirectory)..\Microsoft.ReactNative\IJSValueReader.idl From 0a95df73bbfa7959e6e56221efd882bfff200f28 Mon Sep 17 00:00:00 2001 From: Sharath Manchala <10109130+sharath2727@users.noreply.github.com> Date: Thu, 9 Oct 2025 14:54:23 +0530 Subject: [PATCH 06/31] Using XamlHost in Sample App and hardcoding button in xamlisland --- packages/sample-app-fabric/App.tsx | 2 ++ .../windows/SampleAppFabric/SampleAppFabric.cpp | 3 +++ .../windows/SampleAppFabric/SampleAppFabric.vcxproj | 3 ++- vnext/Microsoft.ReactNative/XamlHost.cpp | 4 ++-- vnext/Shared/Shared.vcxitems.filters | 3 +++ .../{ => components}/Xaml/XamlHostNativeComponent.js | 0 6 files changed, 12 insertions(+), 3 deletions(-) rename vnext/src-win/src/private/specs_DEPRECATED/{ => components}/Xaml/XamlHostNativeComponent.js (100%) diff --git a/packages/sample-app-fabric/App.tsx b/packages/sample-app-fabric/App.tsx index 3ac27a50420..7148cb622fa 100644 --- a/packages/sample-app-fabric/App.tsx +++ b/packages/sample-app-fabric/App.tsx @@ -8,6 +8,7 @@ import React from 'react'; import {SafeAreaView, StatusBar, useColorScheme} from 'react-native'; import {NewAppScreen} from '@react-native/new-app-screen'; +import XamlHost from 'react-native-windows/Libraries/Components/Xaml/XamlHost'; function App(): React.JSX.Element { const isDarkMode = useColorScheme() === 'dark'; @@ -19,6 +20,7 @@ function App(): React.JSX.Element { backgroundColor="transparent" translucent /> + ); diff --git a/packages/sample-app-fabric/windows/SampleAppFabric/SampleAppFabric.cpp b/packages/sample-app-fabric/windows/SampleAppFabric/SampleAppFabric.cpp index 2aeaae1397e..37e4876c823 100644 --- a/packages/sample-app-fabric/windows/SampleAppFabric/SampleAppFabric.cpp +++ b/packages/sample-app-fabric/windows/SampleAppFabric/SampleAppFabric.cpp @@ -8,12 +8,15 @@ #include "NativeModules.h" +#include "../../../../vnext/Microsoft.ReactNative/XamlHost.h" + // A PackageProvider containing any turbo modules you define within this app project struct CompReactPackageProvider : winrt::implements { public: // IReactPackageProvider void CreatePackage(winrt::Microsoft::ReactNative::IReactPackageBuilder const &packageBuilder) noexcept { AddAttributedModules(packageBuilder, true); + RegisterXamlHostComponentView(packageBuilder); } }; diff --git a/packages/sample-app-fabric/windows/SampleAppFabric/SampleAppFabric.vcxproj b/packages/sample-app-fabric/windows/SampleAppFabric/SampleAppFabric.vcxproj index 415ba11b336..72536503782 100644 --- a/packages/sample-app-fabric/windows/SampleAppFabric/SampleAppFabric.vcxproj +++ b/packages/sample-app-fabric/windows/SampleAppFabric/SampleAppFabric.vcxproj @@ -77,7 +77,8 @@ 4453;28204 - shell32.lib;user32.lib;windowsapp.lib;%(AdditionalDependenices) + shell32.lib;user32.lib;windowsapp.lib;Microsoft.ReactNative.lib;%(AdditionalDependenices) + ..\..\..\..\vnext\target\x64\Debug\Microsoft.ReactNative\ Windows true diff --git a/vnext/Microsoft.ReactNative/XamlHost.cpp b/vnext/Microsoft.ReactNative/XamlHost.cpp index 1a91194003e..1da4c4bbd6e 100644 --- a/vnext/Microsoft.ReactNative/XamlHost.cpp +++ b/vnext/Microsoft.ReactNative/XamlHost.cpp @@ -80,6 +80,8 @@ struct XamlHostComponentView : public winrt::implements( packageBuilder, @@ -93,6 +95,4 @@ void RegisterXamlHostComponentView(winrt::Microsoft::ReactNative::IReactPackageB }); } -} // namespace winrt::Microsoft::ReactNative - #endif // defined(RNW_NEW_ARCH) && defined(USE_EXPERIMENTAL_WINUI3) diff --git a/vnext/Shared/Shared.vcxitems.filters b/vnext/Shared/Shared.vcxitems.filters index ea4dfb8d5fa..ee90630c0e0 100644 --- a/vnext/Shared/Shared.vcxitems.filters +++ b/vnext/Shared/Shared.vcxitems.filters @@ -827,4 +827,7 @@ + + + \ No newline at end of file diff --git a/vnext/src-win/src/private/specs_DEPRECATED/Xaml/XamlHostNativeComponent.js b/vnext/src-win/src/private/specs_DEPRECATED/components/Xaml/XamlHostNativeComponent.js similarity index 100% rename from vnext/src-win/src/private/specs_DEPRECATED/Xaml/XamlHostNativeComponent.js rename to vnext/src-win/src/private/specs_DEPRECATED/components/Xaml/XamlHostNativeComponent.js From 686105692cfe95c1375865579ec7dad0fcea75e3 Mon Sep 17 00:00:00 2001 From: Sharath Manchala <10109130+sharath2727@users.noreply.github.com> Date: Thu, 9 Oct 2025 16:07:37 +0530 Subject: [PATCH 07/31] Accessibility Validated on hardcoded xaml control --- .../CompositionDynamicAutomationProvider.cpp | 7 ++++ .../CompositionDynamicAutomationProvider.h | 8 ++++ .../CompositionRootAutomationProvider.cpp | 3 +- .../ContentIslandComponentView.cpp | 29 ++++++++++++++- .../Composition/ContentIslandComponentView.h | 3 ++ .../Fabric/Composition/RootComponentView.cpp | 37 ++++++++++++++++++- .../Fabric/Composition/RootComponentView.h | 2 +- 7 files changed, 83 insertions(+), 6 deletions(-) diff --git a/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp b/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp index 5e34404bd31..269a060ca51 100644 --- a/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +++ b/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp @@ -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(); + } + return nullptr; +} + HRESULT __stdcall CompositionDynamicAutomationProvider::get_FragmentRoot(IRawElementProviderFragmentRoot **pRetVal) { if (pRetVal == nullptr) return E_POINTER; diff --git a/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h b/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h index 7009a6e21b8..5049a52c4b3 100644 --- a/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +++ b/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h @@ -98,6 +98,14 @@ class CompositionDynamicAutomationProvider : public winrt::implements< void AddToSelectionItems(winrt::com_ptr &item); void RemoveFromSelectionItems(winrt::com_ptr &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 m_textProvider; diff --git a/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp b/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp index 6ead642c857..e254eb4c367 100644 --- a/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +++ b/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp @@ -219,7 +219,8 @@ HRESULT __stdcall CompositionRootAutomationProvider::ElementProviderFromPoint( auto local = rootView->ConvertScreenToLocal({static_cast(x), static_cast(y)}); auto provider = rootView->UiaProviderFromPoint( {static_cast(local.X * rootView->LayoutMetrics().PointScaleFactor), - static_cast(local.Y * rootView->LayoutMetrics().PointScaleFactor)}); + static_cast(local.Y * rootView->LayoutMetrics().PointScaleFactor)}, + {static_cast(x), static_cast(y)}); auto spFragment = provider.try_as(); if (spFragment) { *pRetVal = spFragment.detach(); diff --git a/vnext/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp b/vnext/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp index 57aa7d14656..44144b69878 100644 --- a/vnext/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +++ b/vnext/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp @@ -178,14 +178,14 @@ ContentIslandComponentView::~ContentIslandComponentView() noexcept { void ContentIslandComponentView::MountChildComponentView( const winrt::Microsoft::ReactNative::ComponentView &childComponentView, uint32_t index) noexcept { - assert(false); + //assert(false); base_type::MountChildComponentView(childComponentView, index); } void ContentIslandComponentView::UnmountChildComponentView( const winrt::Microsoft::ReactNative::ComponentView &childComponentView, uint32_t index) noexcept { - assert(false); + //assert(false); base_type::UnmountChildComponentView(childComponentView, index); } @@ -212,6 +212,25 @@ void ContentIslandComponentView::prepareForRecycle() noexcept { Super::prepareForRecycle(); } +facebook::react::Tag ContentIslandComponentView::hitTest( + facebook::react::Point pt, + facebook::react::Point &localPt, + bool ignorePointerEvents) const noexcept { + facebook::react::Point ptLocal{pt.x - m_layoutMetrics.frame.origin.x, pt.y - m_layoutMetrics.frame.origin.y}; + + // This is similar to ViewComponentView::hitTest, but we don't want to hit test the children of this node, + // because the child ComponentView is kind of a dummy representation of the XamlElement and doesn't do anything. + // So, we just hit test the ContentIsland itself to make the UIA ElementProviderFromPoint call work. + // TODO: Will this cause a problem -- does this function need to do something different for non-UIA scenarios? + if (ptLocal.x >= 0 && ptLocal.x <= m_layoutMetrics.frame.size.width && ptLocal.y >= 0 && + ptLocal.y <= m_layoutMetrics.frame.size.height) { + localPt = ptLocal; + return Tag(); + } + + return -1; +} + void ContentIslandComponentView::ConfigureChildSiteLinkAutomation() noexcept { // This automation mode must be set before connecting the child ContentIsland. // It puts the child content into a mode where it won't own its own framework root. Instead, the child island's @@ -262,6 +281,12 @@ void ContentIslandComponentView::ConfigureChildSiteLinkAutomation() noexcept { args.AutomationProvider(nullptr); args.Handled(true); }); + + if (m_uiaProvider) { + auto providerImpl = + m_uiaProvider.as(); + providerImpl->SetChildSiteLink(m_childSiteLink); + } } } // namespace winrt::Microsoft::ReactNative::Composition::implementation diff --git a/vnext/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h b/vnext/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h index f530baa3400..d9b374ffbfb 100644 --- a/vnext/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +++ b/vnext/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h @@ -51,6 +51,9 @@ struct ContentIslandComponentView : ContentIslandComponentViewT #include #include "CompositionRootAutomationProvider.h" +#include "CompositionDynamicAutomationProvider.h" #include "ReactNativeIsland.h" #include "Theme.h" @@ -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(ptPixels.x) / m_layoutMetrics.pointScaleFactor, static_cast(ptPixels.y) / m_layoutMetrics.pointScaleFactor}; @@ -295,7 +296,39 @@ winrt::IInspectable RootComponentView::UiaProviderFromPoint(const POINT &ptPixel if (view == nullptr) return nullptr; - return winrt::get_self(view)->EnsureUiaProvider(); + // return winrt::get_self(view)->EnsureUiaProvider(); + auto uiaProvider = + winrt::get_self(view)->EnsureUiaProvider(); + + // HACKHACK: It's ugly to have the RootComponentView know about the CompositionDynamicAutomationProvider type. + // HACKHACK: Can we clean this up? + auto dynamicProvider = + uiaProvider.try_as(); + 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()) { + com_ptr frag; + fragmentRoot->ElementProviderFromPoint( + ptScreen + .x, // Note since we're going through IRawElementProviderFragment the coordinates are in screen space. + ptScreen.y, + frag.put()); + // In the case of WinUI, frag is now the UIA provider for the specific WinUI element that was hit. + // (A Microsoft_UI_Xaml!CUIAWrapper object) + if (frag) { + return frag.as(); + } + } + } + } + + return uiaProvider; } float RootComponentView::FontSizeMultiplier() const noexcept { diff --git a/vnext/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h b/vnext/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h index 3a037fc6d61..83f633d212e 100644 --- a/vnext/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +++ b/vnext/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h @@ -64,7 +64,7 @@ struct RootComponentView : RootComponentViewT Date: Tue, 4 Nov 2025 14:47:48 +0530 Subject: [PATCH 08/31] Cleaned up --- packages/sample-app-fabric/App.tsx | 2 - .../SampleAppFabric/SampleAppFabric.cpp | 3 -- .../SampleAppFabric/SampleAppFabric.vcxproj | 3 +- .../ContentIslandComponentView.cpp | 2 - .../Fabric/Composition/RootComponentView.cpp | 15 ++++---- .../IReactPackageProvider.idl | 8 ++++ vnext/Microsoft.ReactNative/XamlHost.cpp | 37 +------------------ vnext/Microsoft.ReactNative/XamlHost.h | 2 - .../microsoft.reactnative.def | 1 - .../Xaml/XamlHostNativeComponent.js | 1 + 10 files changed, 19 insertions(+), 55 deletions(-) diff --git a/packages/sample-app-fabric/App.tsx b/packages/sample-app-fabric/App.tsx index 7148cb622fa..3ac27a50420 100644 --- a/packages/sample-app-fabric/App.tsx +++ b/packages/sample-app-fabric/App.tsx @@ -8,7 +8,6 @@ import React from 'react'; import {SafeAreaView, StatusBar, useColorScheme} from 'react-native'; import {NewAppScreen} from '@react-native/new-app-screen'; -import XamlHost from 'react-native-windows/Libraries/Components/Xaml/XamlHost'; function App(): React.JSX.Element { const isDarkMode = useColorScheme() === 'dark'; @@ -20,7 +19,6 @@ function App(): React.JSX.Element { backgroundColor="transparent" translucent /> - ); diff --git a/packages/sample-app-fabric/windows/SampleAppFabric/SampleAppFabric.cpp b/packages/sample-app-fabric/windows/SampleAppFabric/SampleAppFabric.cpp index 37e4876c823..2aeaae1397e 100644 --- a/packages/sample-app-fabric/windows/SampleAppFabric/SampleAppFabric.cpp +++ b/packages/sample-app-fabric/windows/SampleAppFabric/SampleAppFabric.cpp @@ -8,15 +8,12 @@ #include "NativeModules.h" -#include "../../../../vnext/Microsoft.ReactNative/XamlHost.h" - // A PackageProvider containing any turbo modules you define within this app project struct CompReactPackageProvider : winrt::implements { public: // IReactPackageProvider void CreatePackage(winrt::Microsoft::ReactNative::IReactPackageBuilder const &packageBuilder) noexcept { AddAttributedModules(packageBuilder, true); - RegisterXamlHostComponentView(packageBuilder); } }; diff --git a/packages/sample-app-fabric/windows/SampleAppFabric/SampleAppFabric.vcxproj b/packages/sample-app-fabric/windows/SampleAppFabric/SampleAppFabric.vcxproj index 72536503782..415ba11b336 100644 --- a/packages/sample-app-fabric/windows/SampleAppFabric/SampleAppFabric.vcxproj +++ b/packages/sample-app-fabric/windows/SampleAppFabric/SampleAppFabric.vcxproj @@ -77,8 +77,7 @@ 4453;28204 - shell32.lib;user32.lib;windowsapp.lib;Microsoft.ReactNative.lib;%(AdditionalDependenices) - ..\..\..\..\vnext\target\x64\Debug\Microsoft.ReactNative\ + shell32.lib;user32.lib;windowsapp.lib;%(AdditionalDependenices) Windows true diff --git a/vnext/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp b/vnext/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp index 44144b69878..1310d8e7b4c 100644 --- a/vnext/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +++ b/vnext/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp @@ -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); } diff --git a/vnext/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp b/vnext/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp index e6f2cfec827..8fc072b80b5 100644 --- a/vnext/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +++ b/vnext/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp @@ -296,17 +296,15 @@ winrt::IUnknown RootComponentView::UiaProviderFromPoint(const POINT &ptPixels, c if (view == nullptr) return nullptr; - // return winrt::get_self(view)->EnsureUiaProvider(); auto uiaProvider = winrt::get_self(view)->EnsureUiaProvider(); - // HACKHACK: It's ugly to have the RootComponentView know about the CompositionDynamicAutomationProvider type. - // HACKHACK: Can we clean this up? + // TODO: Avoid exposing CompositionDynamicAutomationProvider in RootComponentView auto dynamicProvider = uiaProvider.try_as(); if (dynamicProvider) { if (auto childProvider = dynamicProvider->TryGetChildSiteLinkAutomationProvider()) { - // childProvider is the the automation provider from the ChildSiteLink. In the case of WinUI, this + // 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 @@ -314,12 +312,15 @@ winrt::IUnknown RootComponentView::UiaProviderFromPoint(const POINT &ptPixels, c // architecture work). if (auto fragmentRoot = childProvider.try_as()) { com_ptr 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.x, // Note since we're going through IRawElementProviderFragment the coordinates are in screen space. ptScreen.y, frag.put()); - // In the case of WinUI, frag is now the UIA provider for the specific WinUI element that was hit. + // 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(); diff --git a/vnext/Microsoft.ReactNative/IReactPackageProvider.idl b/vnext/Microsoft.ReactNative/IReactPackageProvider.idl index b75369aa3b4..805d74ef23f 100644 --- a/vnext/Microsoft.ReactNative/IReactPackageProvider.idl +++ b/vnext/Microsoft.ReactNative/IReactPackageProvider.idl @@ -17,4 +17,12 @@ namespace Microsoft.ReactNative void CreatePackage(IReactPackageBuilder packageBuilder); }; + [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 diff --git a/vnext/Microsoft.ReactNative/XamlHost.cpp b/vnext/Microsoft.ReactNative/XamlHost.cpp index 1da4c4bbd6e..fc1d1bd5cc5 100644 --- a/vnext/Microsoft.ReactNative/XamlHost.cpp +++ b/vnext/Microsoft.ReactNative/XamlHost.cpp @@ -21,39 +21,6 @@ struct XamlHostComponentView : public winrt::implements(); - - auto string = buttonPeer.GetHelpText(); - - button.IsTabStop(true); - button.TabIndex(0); - - m_xamlIsland.Content(button); - islandView.Connect(m_xamlIsland.ContentIsland()); } @@ -61,13 +28,11 @@ struct XamlHostComponentView : public winrt::implements(); + auto childXamlControl = args.Child().UserData().as(); if (childXamlControl) { auto xamlElement = childXamlControl.GetXamlElement(); m_xamlIsland.Content(xamlElement); } - */ - } void UnmountChildComponentView( diff --git a/vnext/Microsoft.ReactNative/XamlHost.h b/vnext/Microsoft.ReactNative/XamlHost.h index d64bb111f95..e4315a7a460 100644 --- a/vnext/Microsoft.ReactNative/XamlHost.h +++ b/vnext/Microsoft.ReactNative/XamlHost.h @@ -5,6 +5,4 @@ __declspec(dllexport) void RegisterXamlHostComponentView( winrt::Microsoft::ReactNative::IReactPackageBuilder const &packageBuilder); -//void RegisterXamlControl(winrt::Microsoft::ReactNative::IReactPackageBuilder const &packageBuilder); - #endif // defined(RNW_NEW_ARCH) && defined(USE_EXPERIMENTAL_WINUI3) diff --git a/vnext/Microsoft.ReactNative/microsoft.reactnative.def b/vnext/Microsoft.ReactNative/microsoft.reactnative.def index faff126f6c4..d04a02ea81e 100644 --- a/vnext/Microsoft.ReactNative/microsoft.reactnative.def +++ b/vnext/Microsoft.ReactNative/microsoft.reactnative.def @@ -1,4 +1,3 @@ EXPORTS DllCanUnloadNow = WINRT_CanUnloadNow PRIVATE DllGetActivationFactory = WINRT_GetActivationFactory PRIVATE -RegisterXamlHostComponentView diff --git a/vnext/src-win/src/private/specs_DEPRECATED/components/Xaml/XamlHostNativeComponent.js b/vnext/src-win/src/private/specs_DEPRECATED/components/Xaml/XamlHostNativeComponent.js index 9b7b7d07c40..200efd95c09 100644 --- a/vnext/src-win/src/private/specs_DEPRECATED/components/Xaml/XamlHostNativeComponent.js +++ b/vnext/src-win/src/private/specs_DEPRECATED/components/Xaml/XamlHostNativeComponent.js @@ -13,6 +13,7 @@ type XamlHostProps = $ReadOnly<{| ...ViewProps, // Props + // TODO: Remove it if not required. Temporarily used for completeness. label?: string, |}>; From c90b1dae8df67a25727a0a5079a9d8f191a31811 Mon Sep 17 00:00:00 2001 From: Sharath Manchala <10109130+sharath2727@users.noreply.github.com> Date: Tue, 4 Nov 2025 23:43:18 +0530 Subject: [PATCH 09/31] Change files --- ...ative-windows-86668219-62b8-4f50-98cd-ca89397c90ff.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/react-native-windows-86668219-62b8-4f50-98cd-ca89397c90ff.json diff --git a/change/react-native-windows-86668219-62b8-4f50-98cd-ca89397c90ff.json b/change/react-native-windows-86668219-62b8-4f50-98cd-ca89397c90ff.json new file mode 100644 index 00000000000..31db8d104ea --- /dev/null +++ b/change/react-native-windows-86668219-62b8-4f50-98cd-ca89397c90ff.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "Introduce xamlhost component", + "packageName": "react-native-windows", + "email": "10109130+sharath2727@users.noreply.github.com", + "dependentChangeType": "patch" +} From 9357561bb59c10d936999e1a0d3f15718ad9055f Mon Sep 17 00:00:00 2001 From: Sharath Manchala <10109130+sharath2727@users.noreply.github.com> Date: Tue, 4 Nov 2025 23:48:06 +0530 Subject: [PATCH 10/31] yarn format --- .../Fabric/Composition/RootComponentView.cpp | 7 +- .../Microsoft.ReactNative/XamlApplication.cpp | 111 +++++++++--------- vnext/Microsoft.ReactNative/XamlApplication.h | 63 +++++----- vnext/Microsoft.ReactNative/XamlHost.cpp | 4 +- 4 files changed, 87 insertions(+), 98 deletions(-) diff --git a/vnext/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp b/vnext/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp index 8fc072b80b5..2a39c2a28a9 100644 --- a/vnext/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +++ b/vnext/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp @@ -8,8 +8,8 @@ #include #include -#include "CompositionRootAutomationProvider.h" #include "CompositionDynamicAutomationProvider.h" +#include "CompositionRootAutomationProvider.h" #include "ReactNativeIsland.h" #include "Theme.h" @@ -312,9 +312,10 @@ winrt::IUnknown RootComponentView::UiaProviderFromPoint(const POINT &ptPixels, c // architecture work). if (auto fragmentRoot = childProvider.try_as()) { com_ptr frag; - //WinUI then does its own hitTest inside the XAML tree. + // 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 + .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 diff --git a/vnext/Microsoft.ReactNative/XamlApplication.cpp b/vnext/Microsoft.ReactNative/XamlApplication.cpp index 4bc71b863ed..ba207e80e9a 100644 --- a/vnext/Microsoft.ReactNative/XamlApplication.cpp +++ b/vnext/Microsoft.ReactNative/XamlApplication.cpp @@ -4,76 +4,71 @@ #include "winrt/Microsoft.UI.Xaml.XamlTypeInfo.h" -namespace winrt::Microsoft::ReactNative::implementation -{ +namespace winrt::Microsoft::ReactNative::implementation { using namespace ::winrt::Microsoft::UI::Xaml; using namespace ::winrt::Microsoft::UI::Xaml::Markup; using namespace ::winrt::Windows::UI::Xaml::Interop; - XamlApplication::XamlApplication() - { - //m_providers.push_back(winrt::make_self().as()); - s_current = *this; +XamlApplication::XamlApplication() { + // m_providers.push_back(winrt::make_self().as()); + 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"); + // 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(); + this->ResourceManagerRequested([resourceManager](auto &&, ResourceManagerRequestedEventArgs args) { + args.CustomResourceManager(resourceManager); + }); + winrt::Microsoft::UI::Xaml::Hosting::WindowsXamlManager::InitializeForCurrentThread(); - m_providers.push_back( - winrt::make_self() - .as()); // Default generated provider - m_providers.push_back(winrt::Microsoft::UI::Xaml::XamlTypeInfo::XamlControlsXamlMetaDataProvider()); + m_providers.push_back( + winrt::make_self() + .as()); // 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); - } + auto winUIResources = winrt::Microsoft::UI::Xaml::Controls::XamlControlsResources(); + Resources().MergedDictionaries().Append(winUIResources); +} - XamlApplication::~XamlApplication() - { - s_current = nullptr; - } +XamlApplication::~XamlApplication() { + s_current = nullptr; +} - void XamlApplication::AddMetadataProvider(winrt::Microsoft::UI::Xaml::Markup::IXamlMetadataProvider const& otherProvider) - { - m_providers.push_back(otherProvider); - } +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 (auto &&provider : m_providers) { - if (auto result = provider.GetXamlType(type)) { - return result; - } - } - return nullptr; +winrt::Microsoft::UI::Xaml::Markup::IXamlType XamlApplication::GetXamlType( + winrt::Windows::UI::Xaml::Interop::TypeName const &type) { + for (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 (auto &&provider : m_providers) { - if (auto result = provider.GetXamlType(fullName)) { - return result; - } - } - - return nullptr; - } - com_array XamlApplication::GetXmlnsDefinitions() - { - std::vector<::winrt::Microsoft::UI::Xaml::Markup::XmlnsDefinition> allDefinitions; - for (const auto &provider : m_providers) { - auto definitionsCurrentProvider = provider.GetXmlnsDefinitions(); - for (const auto &definition : definitionsCurrentProvider) { - allDefinitions.insert(allDefinitions.begin(), definition); - } - } - return winrt::com_array<::winrt::Microsoft::UI::Xaml::Markup::XmlnsDefinition>( - allDefinitions.begin(), allDefinitions.end()); +winrt::Microsoft::UI::Xaml::Markup::IXamlType XamlApplication::GetXamlType(hstring const &fullName) { + for (auto &&provider : m_providers) { + if (auto result = provider.GetXamlType(fullName)) { + return result; } + } - winrt::Microsoft::ReactNative::XamlApplication XamlApplication::s_current{nullptr}; + return nullptr; } +com_array XamlApplication::GetXmlnsDefinitions() { + std::vector<::winrt::Microsoft::UI::Xaml::Markup::XmlnsDefinition> allDefinitions; + for (const auto &provider : m_providers) { + auto definitionsCurrentProvider = provider.GetXmlnsDefinitions(); + for (const auto &definition : definitionsCurrentProvider) { + allDefinitions.insert(allDefinitions.begin(), definition); + } + } + return winrt::com_array<::winrt::Microsoft::UI::Xaml::Markup::XmlnsDefinition>( + allDefinitions.begin(), allDefinitions.end()); +} + +winrt::Microsoft::ReactNative::XamlApplication XamlApplication::s_current{nullptr}; +} // namespace winrt::Microsoft::ReactNative::implementation diff --git a/vnext/Microsoft.ReactNative/XamlApplication.h b/vnext/Microsoft.ReactNative/XamlApplication.h index 6a9e6d3b7a6..31229a7539f 100644 --- a/vnext/Microsoft.ReactNative/XamlApplication.h +++ b/vnext/Microsoft.ReactNative/XamlApplication.h @@ -10,38 +10,31 @@ #include "XamlMetaDataProvider.h" -namespace winrt::Microsoft::ReactNative::implementation -{ - struct XamlApplication : XamlApplicationT - { - XamlApplication(); - ~XamlApplication(); - - static void EnsureCreated() - { - if (Current() == nullptr) { - s_current = winrt::make(); - } - } - - static winrt::Microsoft::ReactNative::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 GetXmlnsDefinitions(); - - private: - static winrt::Microsoft::ReactNative::XamlApplication s_current; - std::vector m_providers; - }; -} -namespace winrt::Microsoft::ReactNative::factory_implementation -{ - struct XamlApplication : XamlApplicationT - { - }; -} +namespace winrt::Microsoft::ReactNative::implementation { +struct XamlApplication : XamlApplicationT { + XamlApplication(); + ~XamlApplication(); + + static void EnsureCreated() { + if (Current() == nullptr) { + s_current = winrt::make(); + } + } + + static winrt::Microsoft::ReactNative::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 GetXmlnsDefinitions(); + + private: + static winrt::Microsoft::ReactNative::XamlApplication s_current; + std::vector m_providers; +}; +} // namespace winrt::Microsoft::ReactNative::implementation +namespace winrt::Microsoft::ReactNative::factory_implementation { +struct XamlApplication : XamlApplicationT {}; +} // namespace winrt::Microsoft::ReactNative::factory_implementation diff --git a/vnext/Microsoft.ReactNative/XamlHost.cpp b/vnext/Microsoft.ReactNative/XamlHost.cpp index fc1d1bd5cc5..bd171eebc20 100644 --- a/vnext/Microsoft.ReactNative/XamlHost.cpp +++ b/vnext/Microsoft.ReactNative/XamlHost.cpp @@ -2,10 +2,10 @@ // Licensed under the MIT License. #include "pch.h" +#include +#include #include "XamlApplication.h" #include "XamlHost.h" -#include -#include #if defined(RNW_NEW_ARCH) From 805ba4d7792d78dd61f395c7e441bc346038c7a4 Mon Sep 17 00:00:00 2001 From: Sharath Manchala <10109130+sharath2727@users.noreply.github.com> Date: Wed, 5 Nov 2025 00:15:18 +0530 Subject: [PATCH 11/31] yarn lint fix --- vnext/src-win/Libraries/Components/Xaml/XamlHost.d.ts | 2 +- vnext/src-win/Libraries/Components/Xaml/XamlHost.windows.js | 2 +- .../specs_DEPRECATED/components/Xaml/XamlHostNativeComponent.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/vnext/src-win/Libraries/Components/Xaml/XamlHost.d.ts b/vnext/src-win/Libraries/Components/Xaml/XamlHost.d.ts index 42f34d63e58..a69cfafe0be 100644 --- a/vnext/src-win/Libraries/Components/Xaml/XamlHost.d.ts +++ b/vnext/src-win/Libraries/Components/Xaml/XamlHost.d.ts @@ -10,4 +10,4 @@ export interface XamlHostProps extends ViewProps { label: string; } declare const _default: import('react-native/Libraries/Utilities/codegenNativeComponent').NativeComponentType; -export default _default; \ No newline at end of file +export default _default; diff --git a/vnext/src-win/Libraries/Components/Xaml/XamlHost.windows.js b/vnext/src-win/Libraries/Components/Xaml/XamlHost.windows.js index c481f62c8fb..723810b17a4 100644 --- a/vnext/src-win/Libraries/Components/Xaml/XamlHost.windows.js +++ b/vnext/src-win/Libraries/Components/Xaml/XamlHost.windows.js @@ -4,4 +4,4 @@ */ import XamlHost from '../../../src/private/specs_DEPRECATED/components/Xaml/XamlHostNativeComponent'; -export default XamlHost; \ No newline at end of file +export default XamlHost; diff --git a/vnext/src-win/src/private/specs_DEPRECATED/components/Xaml/XamlHostNativeComponent.js b/vnext/src-win/src/private/specs_DEPRECATED/components/Xaml/XamlHostNativeComponent.js index 200efd95c09..9f9ad5a630b 100644 --- a/vnext/src-win/src/private/specs_DEPRECATED/components/Xaml/XamlHostNativeComponent.js +++ b/vnext/src-win/src/private/specs_DEPRECATED/components/Xaml/XamlHostNativeComponent.js @@ -17,4 +17,4 @@ type XamlHostProps = $ReadOnly<{| label?: string, |}>; -export default codegenNativeComponent('XamlHost'); \ No newline at end of file +export default codegenNativeComponent('XamlHost'); From 9889e8c1cbe6f116bbacb074c70403fe8f3dba24 Mon Sep 17 00:00:00 2001 From: Sharath Manchala <10109130+sharath2727@users.noreply.github.com> Date: Thu, 6 Nov 2025 02:01:14 +0530 Subject: [PATCH 12/31] Microsoft.ReactNative.Xaml namespace and lint fixes --- vnext/Microsoft.ReactNative/App.xaml | 5 ++-- .../IReactPackageProvider.idl | 8 ++++--- vnext/Microsoft.ReactNative/Pch/pch.h | 17 -------------- .../Microsoft.ReactNative/XamlApplication.cpp | 11 ++++----- vnext/Microsoft.ReactNative/XamlApplication.h | 23 ++++++++++++------- .../Microsoft.ReactNative/XamlApplication.idl | 4 ++-- vnext/Microsoft.ReactNative/XamlHost.cpp | 6 ++--- .../react/components/rnwcore/Props.cpp | 7 ++---- .../codegen/react/components/rnwcore/Props.h | 2 +- .../react/components/rnwcore/XamlHost.g.h | 5 +--- .../Xaml/XamlHostNativeComponent.js | 10 ++++---- 11 files changed, 40 insertions(+), 58 deletions(-) diff --git a/vnext/Microsoft.ReactNative/App.xaml b/vnext/Microsoft.ReactNative/App.xaml index 3354935ec8d..038e5a57397 100644 --- a/vnext/Microsoft.ReactNative/App.xaml +++ b/vnext/Microsoft.ReactNative/App.xaml @@ -1,6 +1,5 @@ + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> diff --git a/vnext/Microsoft.ReactNative/IReactPackageProvider.idl b/vnext/Microsoft.ReactNative/IReactPackageProvider.idl index 805d74ef23f..5f82ac82d69 100644 --- a/vnext/Microsoft.ReactNative/IReactPackageProvider.idl +++ b/vnext/Microsoft.ReactNative/IReactPackageProvider.idl @@ -16,13 +16,15 @@ namespace Microsoft.ReactNative "Use the @IReactPackageBuilder to register custom native modules and view managers.") void CreatePackage(IReactPackageBuilder packageBuilder); }; +} // namespace Microsoft.ReactNative +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.") + "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 +} // namespace Microsoft.ReactNative.Xaml \ No newline at end of file diff --git a/vnext/Microsoft.ReactNative/Pch/pch.h b/vnext/Microsoft.ReactNative/Pch/pch.h index 9447187a9c1..34b0b02b9be 100644 --- a/vnext/Microsoft.ReactNative/Pch/pch.h +++ b/vnext/Microsoft.ReactNative/Pch/pch.h @@ -77,20 +77,3 @@ #include #include #include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include diff --git a/vnext/Microsoft.ReactNative/XamlApplication.cpp b/vnext/Microsoft.ReactNative/XamlApplication.cpp index ba207e80e9a..d8ee337ba9d 100644 --- a/vnext/Microsoft.ReactNative/XamlApplication.cpp +++ b/vnext/Microsoft.ReactNative/XamlApplication.cpp @@ -1,15 +1,14 @@ #include "pch.h" #include "XamlApplication.h" -#include "XamlApplication.g.cpp" +#include "Xaml.XamlApplication.g.cpp" #include "winrt/Microsoft.UI.Xaml.XamlTypeInfo.h" -namespace winrt::Microsoft::ReactNative::implementation { +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() { - // m_providers.push_back(winrt::make_self().as()); s_current = *this; // TODO: It's probably not a good idea to only load the controls pri file, there are other ones too. @@ -22,7 +21,7 @@ XamlApplication::XamlApplication() { winrt::Microsoft::UI::Xaml::Hosting::WindowsXamlManager::InitializeForCurrentThread(); m_providers.push_back( - winrt::make_self() + winrt::make_self() .as()); // Default generated provider m_providers.push_back(winrt::Microsoft::UI::Xaml::XamlTypeInfo::XamlControlsXamlMetaDataProvider()); @@ -70,5 +69,5 @@ com_array XamlApplication:: allDefinitions.begin(), allDefinitions.end()); } -winrt::Microsoft::ReactNative::XamlApplication XamlApplication::s_current{nullptr}; -} // namespace winrt::Microsoft::ReactNative::implementation +winrt::Microsoft::ReactNative::Xaml::XamlApplication XamlApplication::s_current{nullptr}; +} // namespace winrt::Microsoft::ReactNative::Xaml::implementation diff --git a/vnext/Microsoft.ReactNative/XamlApplication.h b/vnext/Microsoft.ReactNative/XamlApplication.h index 31229a7539f..cb3211ee0e0 100644 --- a/vnext/Microsoft.ReactNative/XamlApplication.h +++ b/vnext/Microsoft.ReactNative/XamlApplication.h @@ -1,5 +1,12 @@ #pragma once -#include "XamlApplication.g.h" +#include "Xaml.XamlApplication.g.h" + +#include +#include +#include +#include +#include +#include #include "winrt/Microsoft.UI.Xaml.Hosting.h" #include "winrt/Microsoft.UI.Xaml.Interop.h" @@ -10,18 +17,18 @@ #include "XamlMetaDataProvider.h" -namespace winrt::Microsoft::ReactNative::implementation { +namespace winrt::Microsoft::ReactNative::Xaml::implementation { struct XamlApplication : XamlApplicationT { XamlApplication(); ~XamlApplication(); static void EnsureCreated() { if (Current() == nullptr) { - s_current = winrt::make(); + s_current = winrt::make(); } } - static winrt::Microsoft::ReactNative::XamlApplication Current() { + static winrt::Microsoft::ReactNative::Xaml::XamlApplication Current() { return s_current; } @@ -31,10 +38,10 @@ struct XamlApplication : XamlApplicationT { com_array GetXmlnsDefinitions(); private: - static winrt::Microsoft::ReactNative::XamlApplication s_current; + static winrt::Microsoft::ReactNative::Xaml::XamlApplication s_current; std::vector m_providers; }; -} // namespace winrt::Microsoft::ReactNative::implementation -namespace winrt::Microsoft::ReactNative::factory_implementation { +} // namespace winrt::Microsoft::ReactNative::Xaml::implementation +namespace winrt::Microsoft::ReactNative::Xaml::factory_implementation { struct XamlApplication : XamlApplicationT {}; -} // namespace winrt::Microsoft::ReactNative::factory_implementation +} // namespace winrt::Microsoft::ReactNative::Xaml::factory_implementation diff --git a/vnext/Microsoft.ReactNative/XamlApplication.idl b/vnext/Microsoft.ReactNative/XamlApplication.idl index 928ac01617f..5a23009d917 100644 --- a/vnext/Microsoft.ReactNative/XamlApplication.idl +++ b/vnext/Microsoft.ReactNative/XamlApplication.idl @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -namespace Microsoft.ReactNative { +namespace Microsoft.ReactNative.Xaml { [webhosthidden][default_interface] runtimeclass XamlApplication : Microsoft.UI.Xaml.Application, Microsoft.UI.Xaml.Markup.IXamlMetadataProvider { XamlApplication(); @@ -14,4 +14,4 @@ namespace Microsoft.ReactNative { void AddMetadataProvider(Microsoft.UI.Xaml.Markup.IXamlMetadataProvider otherProvider); } -} // namespace Microsoft.ReactNative. Xaml +} // namespace Microsoft.ReactNative.Xaml diff --git a/vnext/Microsoft.ReactNative/XamlHost.cpp b/vnext/Microsoft.ReactNative/XamlHost.cpp index bd171eebc20..5b6873b9bbf 100644 --- a/vnext/Microsoft.ReactNative/XamlHost.cpp +++ b/vnext/Microsoft.ReactNative/XamlHost.cpp @@ -2,8 +2,6 @@ // Licensed under the MIT License. #include "pch.h" -#include -#include #include "XamlApplication.h" #include "XamlHost.h" @@ -17,7 +15,7 @@ struct XamlHostComponentView : public winrt::implements { void InitializeContentIsland( const winrt::Microsoft::ReactNative::Composition::ContentIslandComponentView &islandView) noexcept { - winrt::Microsoft::ReactNative::implementation::XamlApplication::EnsureCreated(); + winrt::Microsoft::ReactNative::Xaml::implementation::XamlApplication::EnsureCreated(); m_xamlIsland = winrt::Microsoft::UI::Xaml::XamlIsland{}; @@ -28,7 +26,7 @@ struct XamlHostComponentView : public winrt::implements(); + auto childXamlControl = args.Child().UserData().as(); if (childXamlControl) { auto xamlElement = childXamlControl.GetXamlElement(); m_xamlIsland.Content(xamlElement); diff --git a/vnext/codegen/react/components/rnwcore/Props.cpp b/vnext/codegen/react/components/rnwcore/Props.cpp index 854696d6ae1..051afc01325 100644 --- a/vnext/codegen/react/components/rnwcore/Props.cpp +++ b/vnext/codegen/react/components/rnwcore/Props.cpp @@ -667,9 +667,9 @@ folly::dynamic UnimplementedNativeViewProps::getDiffProps( XamlHostProps::XamlHostProps( const PropsParserContext &context, const XamlHostProps &sourceProps, - const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), + const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) - label(convertRawProp(context, rawProps, "label", sourceProps.label, {})) {} + {} #ifdef RN_SERIALIZABLE_STATE folly::dynamic XamlHostProps::getDiffProps( @@ -683,9 +683,6 @@ folly::dynamic XamlHostProps::getDiffProps( } folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps); - if (label != oldProps->label) { - result["label"] = label; - } return result; } #endif diff --git a/vnext/codegen/react/components/rnwcore/Props.h b/vnext/codegen/react/components/rnwcore/Props.h index 7c86ce7fdb9..10c807375f1 100644 --- a/vnext/codegen/react/components/rnwcore/Props.h +++ b/vnext/codegen/react/components/rnwcore/Props.h @@ -540,7 +540,7 @@ class XamlHostProps final : public ViewProps { #pragma mark - Props - std::string label{}; + #ifdef RN_SERIALIZABLE_STATE folly::dynamic getDiffProps(const Props* prevProps) const override; diff --git a/vnext/codegen/react/components/rnwcore/XamlHost.g.h b/vnext/codegen/react/components/rnwcore/XamlHost.g.h index 26bd059c3c3..9aeb28aecea 100644 --- a/vnext/codegen/react/components/rnwcore/XamlHost.g.h +++ b/vnext/codegen/react/components/rnwcore/XamlHost.g.h @@ -25,7 +25,7 @@ struct XamlHostProps : winrt::implements(); - label = cloneFromProps->label; + } } @@ -33,9 +33,6 @@ struct XamlHostProps : winrt::implements label; - const winrt::Microsoft::ReactNative::ViewProps ViewProps; }; diff --git a/vnext/src-win/src/private/specs_DEPRECATED/components/Xaml/XamlHostNativeComponent.js b/vnext/src-win/src/private/specs_DEPRECATED/components/Xaml/XamlHostNativeComponent.js index 9f9ad5a630b..4b0fc158fd8 100644 --- a/vnext/src-win/src/private/specs_DEPRECATED/components/Xaml/XamlHostNativeComponent.js +++ b/vnext/src-win/src/private/specs_DEPRECATED/components/Xaml/XamlHostNativeComponent.js @@ -7,14 +7,14 @@ 'use strict'; +import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import type {HostComponent} from '../../../../../src/private/types/HostComponent'; type XamlHostProps = $ReadOnly<{| ...ViewProps, - - // Props - // TODO: Remove it if not required. Temporarily used for completeness. - label?: string, |}>; -export default codegenNativeComponent('XamlHost'); +type NativeType = HostComponent; + +export default (codegenNativeComponent('XamlHost'): NativeType); From 522cf317d3d1a4e097fc07a160fc34295e102c3d Mon Sep 17 00:00:00 2001 From: Sharath Manchala <10109130+sharath2727@users.noreply.github.com> Date: Thu, 6 Nov 2025 02:30:11 +0530 Subject: [PATCH 13/31] rework index.windows.js and js.flow --- vnext/codegen/react/components/rnwcore/Props.cpp | 4 ++++ vnext/codegen/react/components/rnwcore/Props.h | 2 ++ vnext/codegen/react/components/rnwcore/States.h | 12 +----------- vnext/src-win/index.windows.js | 3 +++ vnext/src-win/index.windows.js.flow | 1 + 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/vnext/codegen/react/components/rnwcore/Props.cpp b/vnext/codegen/react/components/rnwcore/Props.cpp index 051afc01325..6ee93936951 100644 --- a/vnext/codegen/react/components/rnwcore/Props.cpp +++ b/vnext/codegen/react/components/rnwcore/Props.cpp @@ -672,6 +672,10 @@ XamlHostProps::XamlHostProps( {} #ifdef RN_SERIALIZABLE_STATE +ComponentName XamlHostProps::getDiffPropsImplementationTarget() const { + return "XamlHost"; +} + folly::dynamic XamlHostProps::getDiffProps( const Props* prevProps) const { static const auto defaultProps = XamlHostProps(); diff --git a/vnext/codegen/react/components/rnwcore/Props.h b/vnext/codegen/react/components/rnwcore/Props.h index 10c807375f1..7dc288f82b2 100644 --- a/vnext/codegen/react/components/rnwcore/Props.h +++ b/vnext/codegen/react/components/rnwcore/Props.h @@ -543,6 +543,8 @@ class XamlHostProps final : public ViewProps { #ifdef RN_SERIALIZABLE_STATE + ComponentName getDiffPropsImplementationTarget() const override; + folly::dynamic getDiffProps(const Props* prevProps) const override; #endif }; diff --git a/vnext/codegen/react/components/rnwcore/States.h b/vnext/codegen/react/components/rnwcore/States.h index 3fac724cd2e..fd551073bed 100644 --- a/vnext/codegen/react/components/rnwcore/States.h +++ b/vnext/codegen/react/components/rnwcore/States.h @@ -29,16 +29,6 @@ using SwitchState = StateData; using UnimplementedNativeViewState = StateData; -class XamlHostState { -public: - XamlHostState() = default; - -#ifdef RN_SERIALIZABLE_STATE - XamlHostState(XamlHostState const &previousState, folly::dynamic data){}; - folly::dynamic getDynamic() const { - return {}; - }; -#endif -}; +using XamlHostState = StateData; } // namespace facebook::react \ No newline at end of file diff --git a/vnext/src-win/index.windows.js b/vnext/src-win/index.windows.js index 31ad1071a1c..bfe01b537d7 100644 --- a/vnext/src-win/index.windows.js +++ b/vnext/src-win/index.windows.js @@ -369,6 +369,9 @@ module.exports = { get AppTheme() { return require('./Libraries/AppTheme/AppTheme').AppTheme; }, + get XamlHost() { + return require('./Libraries/Components/Xaml/XamlHost').default; + }, } as ReactNativePublicAPI; if (__DEV__) { diff --git a/vnext/src-win/index.windows.js.flow b/vnext/src-win/index.windows.js.flow index 5c97cd8c792..4f9d38c3bdf 100644 --- a/vnext/src-win/index.windows.js.flow +++ b/vnext/src-win/index.windows.js.flow @@ -467,6 +467,7 @@ export {HandledEventPhase } from './Libraries/Components/View/ViewPropTypes' export {default as ViewWindows} from './Libraries/Components/View/View'; export {AppTheme} from './Libraries/AppTheme/AppTheme'; +export {default as XamlHost} from './Libraries/Components/Xaml/XamlHost'; // End Windows Specific exports // #endregion From 529423b16a34ce019d785674fbbd814cd149df1c Mon Sep 17 00:00:00 2001 From: Sharath Manchala <10109130+sharath2727@users.noreply.github.com> Date: Thu, 6 Nov 2025 12:21:37 +0530 Subject: [PATCH 14/31] Introduce IXamlProvider --- vnext/Microsoft.ReactNative/IReactPackageProvider.idl | 11 ----------- vnext/Microsoft.ReactNative/IXamlProvider.idl | 11 +++++++++++ vnext/Shared/Shared.vcxitems | 1 + 3 files changed, 12 insertions(+), 11 deletions(-) create mode 100644 vnext/Microsoft.ReactNative/IXamlProvider.idl diff --git a/vnext/Microsoft.ReactNative/IReactPackageProvider.idl b/vnext/Microsoft.ReactNative/IReactPackageProvider.idl index 5f82ac82d69..b02b2de9071 100644 --- a/vnext/Microsoft.ReactNative/IReactPackageProvider.idl +++ b/vnext/Microsoft.ReactNative/IReactPackageProvider.idl @@ -17,14 +17,3 @@ namespace Microsoft.ReactNative void CreatePackage(IReactPackageBuilder packageBuilder); }; } // namespace Microsoft.ReactNative - -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 \ No newline at end of file diff --git a/vnext/Microsoft.ReactNative/IXamlProvider.idl b/vnext/Microsoft.ReactNative/IXamlProvider.idl new file mode 100644 index 00000000000..f0040724373 --- /dev/null +++ b/vnext/Microsoft.ReactNative/IXamlProvider.idl @@ -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 diff --git a/vnext/Shared/Shared.vcxitems b/vnext/Shared/Shared.vcxitems index 351cb991836..e539aab359e 100644 --- a/vnext/Shared/Shared.vcxitems +++ b/vnext/Shared/Shared.vcxitems @@ -729,6 +729,7 @@ + From 9b6aa1713a2e2a5126a8015c16af1fd5a113ff7d Mon Sep 17 00:00:00 2001 From: Sharath Manchala <10109130+sharath2727@users.noreply.github.com> Date: Thu, 6 Nov 2025 19:16:03 +0530 Subject: [PATCH 15/31] Yarn issue --- vnext/Shared/Shared.vcxitems | 2 +- vnext/src-win/index.windows.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vnext/Shared/Shared.vcxitems b/vnext/Shared/Shared.vcxitems index e539aab359e..11798c09c41 100644 --- a/vnext/Shared/Shared.vcxitems +++ b/vnext/Shared/Shared.vcxitems @@ -746,6 +746,6 @@ - + diff --git a/vnext/src-win/index.windows.js b/vnext/src-win/index.windows.js index bfe01b537d7..d24464796a1 100644 --- a/vnext/src-win/index.windows.js +++ b/vnext/src-win/index.windows.js @@ -369,7 +369,7 @@ module.exports = { get AppTheme() { return require('./Libraries/AppTheme/AppTheme').AppTheme; }, - get XamlHost() { + get XamlHost() { return require('./Libraries/Components/Xaml/XamlHost').default; }, } as ReactNativePublicAPI; From b9036c33be1d2d121e6538780b135a8d88c8256e Mon Sep 17 00:00:00 2001 From: Sharath Manchala <10109130+sharath2727@users.noreply.github.com> Date: Sat, 8 Nov 2025 02:28:46 +0530 Subject: [PATCH 16/31] Avoid compiling xaml for office solution --- .../Microsoft.ReactNative.vcxproj | 1 + vnext/Microsoft.ReactNative/XamlApplication.cpp | 4 ++-- vnext/Microsoft.ReactNative/XamlHost.h | 2 +- vnext/Shared/Shared.vcxitems | 16 ++++++++-------- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj b/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj index b50fab3cadb..da4943068ae 100644 --- a/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +++ b/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj @@ -18,6 +18,7 @@ true false + true diff --git a/vnext/Microsoft.ReactNative/XamlApplication.cpp b/vnext/Microsoft.ReactNative/XamlApplication.cpp index d8ee337ba9d..74b0d0b3992 100644 --- a/vnext/Microsoft.ReactNative/XamlApplication.cpp +++ b/vnext/Microsoft.ReactNative/XamlApplication.cpp @@ -40,7 +40,7 @@ void XamlApplication::AddMetadataProvider( winrt::Microsoft::UI::Xaml::Markup::IXamlType XamlApplication::GetXamlType( winrt::Windows::UI::Xaml::Interop::TypeName const &type) { - for (auto &&provider : m_providers) { + for (const auto &provider : m_providers) { if (auto result = provider.GetXamlType(type)) { return result; } @@ -49,7 +49,7 @@ winrt::Microsoft::UI::Xaml::Markup::IXamlType XamlApplication::GetXamlType( } winrt::Microsoft::UI::Xaml::Markup::IXamlType XamlApplication::GetXamlType(hstring const &fullName) { - for (auto &&provider : m_providers) { + for (const auto &provider : m_providers) { if (auto result = provider.GetXamlType(fullName)) { return result; } diff --git a/vnext/Microsoft.ReactNative/XamlHost.h b/vnext/Microsoft.ReactNative/XamlHost.h index e4315a7a460..002cab0481d 100644 --- a/vnext/Microsoft.ReactNative/XamlHost.h +++ b/vnext/Microsoft.ReactNative/XamlHost.h @@ -2,7 +2,7 @@ #if defined(RNW_NEW_ARCH) -__declspec(dllexport) void RegisterXamlHostComponentView( +void RegisterXamlHostComponentView( winrt::Microsoft::ReactNative::IReactPackageBuilder const &packageBuilder); #endif // defined(RNW_NEW_ARCH) && defined(USE_EXPERIMENTAL_WINUI3) diff --git a/vnext/Shared/Shared.vcxitems b/vnext/Shared/Shared.vcxitems index 11798c09c41..1ca12ca9596 100644 --- a/vnext/Shared/Shared.vcxitems +++ b/vnext/Shared/Shared.vcxitems @@ -247,12 +247,12 @@ Code - true + true $(ReactNativeWindowsDir)Microsoft.ReactNative\XamlApplication.idl Code - true + true $(ReactNativeWindowsDir)Microsoft.ReactNative\XamlApplication.idl Code @@ -362,12 +362,12 @@ Code - true + true $(MSBuildThisFileDirectory)..\Microsoft.ReactNative\XamlApplication.idl Code - true + true $(MSBuildThisFileDirectory)..\Microsoft.ReactNative\XamlApplication.idl Code @@ -728,8 +728,8 @@ - - + + @@ -745,7 +745,7 @@ NotUsing - - + + From 11c54ea980d5428bb899ac8dc56e469db71fc169 Mon Sep 17 00:00:00 2001 From: Sharath Manchala <10109130+sharath2727@users.noreply.github.com> Date: Sat, 8 Nov 2025 02:30:48 +0530 Subject: [PATCH 17/31] yarn format fix --- vnext/Microsoft.ReactNative/XamlHost.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/vnext/Microsoft.ReactNative/XamlHost.h b/vnext/Microsoft.ReactNative/XamlHost.h index 002cab0481d..7abc42b8241 100644 --- a/vnext/Microsoft.ReactNative/XamlHost.h +++ b/vnext/Microsoft.ReactNative/XamlHost.h @@ -2,7 +2,6 @@ #if defined(RNW_NEW_ARCH) -void RegisterXamlHostComponentView( - winrt::Microsoft::ReactNative::IReactPackageBuilder const &packageBuilder); +void RegisterXamlHostComponentView(winrt::Microsoft::ReactNative::IReactPackageBuilder const &packageBuilder); #endif // defined(RNW_NEW_ARCH) && defined(USE_EXPERIMENTAL_WINUI3) From b179f47cf390524db5138653353e8fd21a11359a Mon Sep 17 00:00:00 2001 From: Sharath Manchala <10109130+sharath2727@users.noreply.github.com> Date: Sat, 8 Nov 2025 03:29:17 +0530 Subject: [PATCH 18/31] Update shared vcxitems filter --- vnext/Shared/Shared.vcxitems.filters | 3 --- 1 file changed, 3 deletions(-) diff --git a/vnext/Shared/Shared.vcxitems.filters b/vnext/Shared/Shared.vcxitems.filters index b742ec8d6a6..f20eb89b198 100644 --- a/vnext/Shared/Shared.vcxitems.filters +++ b/vnext/Shared/Shared.vcxitems.filters @@ -830,7 +830,4 @@ - - - \ No newline at end of file From c2aa6d49c9c2526b8abf3d002002fe399a6f12f1 Mon Sep 17 00:00:00 2001 From: Sharath Manchala <10109130+sharath2727@users.noreply.github.com> Date: Mon, 10 Nov 2025 15:34:27 +0530 Subject: [PATCH 19/31] Fix overrides --- vnext/overrides.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/vnext/overrides.json b/vnext/overrides.json index efa658f0b0b..75ee2f6d834 100644 --- a/vnext/overrides.json +++ b/vnext/overrides.json @@ -688,6 +688,18 @@ "file": "src-win/src/private/specs_DEPRECATED/modules/NativePlatformConstantsWindows.js", "baseFile": "packages/react-native/src/private/specs_DEPRECATED/modules/NativePlatformConstantsAndroid.js", "baseHash": "365c5df75b38b129d364af3f6700cb206ce5bd2a" + }, + { + "type": "platform", + "file": "src-win/Libraries/Components/Xaml/XamlHost.d.ts" + }, + { + "type": "platform", + "file": "src-win/Libraries/Components/Xaml/XamlHost.windows.js" + }, + { + "type": "platform", + "file": "src-win/src/private/specs_DEPRECATED/components/Xaml/XamlHostNativeComponent.js" } ] } \ No newline at end of file From 572a02429a5279f8ed224b5890db67a6e1308dfe Mon Sep 17 00:00:00 2001 From: Sharath Manchala <10109130+sharath2727@users.noreply.github.com> Date: Mon, 10 Nov 2025 16:24:15 +0530 Subject: [PATCH 20/31] Fixed formatting errors --- vnext/.gitignore | 1 + vnext/Shared/Shared.vcxitems | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/vnext/.gitignore b/vnext/.gitignore index 4f9a62a3029..55397b10a73 100644 --- a/vnext/.gitignore +++ b/vnext/.gitignore @@ -87,6 +87,7 @@ ReactUWP/Folly/Generated Files/ *.suo *.nupkg *.swp +/vnext/fmt/packages.lock.json temp diff --git a/vnext/Shared/Shared.vcxitems b/vnext/Shared/Shared.vcxitems index 9c96145beb9..a06ffd9981e 100644 --- a/vnext/Shared/Shared.vcxitems +++ b/vnext/Shared/Shared.vcxitems @@ -740,9 +740,9 @@ - + - + From 8392fc51e275bff1246f9d2e032ae6f38ffbe871 Mon Sep 17 00:00:00 2001 From: Sharath Manchala <10109130+sharath2727@users.noreply.github.com> Date: Mon, 10 Nov 2025 23:09:52 +0530 Subject: [PATCH 21/31] fix winrt document generation error --- vnext/Microsoft.ReactNative/XamlApplication.idl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vnext/Microsoft.ReactNative/XamlApplication.idl b/vnext/Microsoft.ReactNative/XamlApplication.idl index 5a23009d917..dd90d7b28a5 100644 --- a/vnext/Microsoft.ReactNative/XamlApplication.idl +++ b/vnext/Microsoft.ReactNative/XamlApplication.idl @@ -1,17 +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 From 9aa90f60ad99409106817517ccb1fb5bbb113603 Mon Sep 17 00:00:00 2001 From: Sharath Manchala <10109130+sharath2727@users.noreply.github.com> Date: Tue, 11 Nov 2025 01:28:18 +0530 Subject: [PATCH 22/31] Handle winrt document generation failure gracefully --- .ado/jobs/universal.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.ado/jobs/universal.yml b/.ado/jobs/universal.yml index 0287d95c834..21126cd7a07 100644 --- a/.ado/jobs/universal.yml +++ b/.ado/jobs/universal.yml @@ -174,6 +174,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 From b4772349cc574d25baae5183ad5850334f5e5c87 Mon Sep 17 00:00:00 2001 From: Sharath Manchala <10109130+sharath2727@users.noreply.github.com> Date: Tue, 11 Nov 2025 23:53:30 +0530 Subject: [PATCH 23/31] Optimize GetXmlnsDefinitions Implementation --- vnext/.gitignore | 1 - vnext/Microsoft.ReactNative/XamlApplication.cpp | 6 ++---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/vnext/.gitignore b/vnext/.gitignore index 55397b10a73..4f9a62a3029 100644 --- a/vnext/.gitignore +++ b/vnext/.gitignore @@ -87,7 +87,6 @@ ReactUWP/Folly/Generated Files/ *.suo *.nupkg *.swp -/vnext/fmt/packages.lock.json temp diff --git a/vnext/Microsoft.ReactNative/XamlApplication.cpp b/vnext/Microsoft.ReactNative/XamlApplication.cpp index 74b0d0b3992..450cc7ca8d5 100644 --- a/vnext/Microsoft.ReactNative/XamlApplication.cpp +++ b/vnext/Microsoft.ReactNative/XamlApplication.cpp @@ -60,10 +60,8 @@ winrt::Microsoft::UI::Xaml::Markup::IXamlType XamlApplication::GetXamlType(hstri com_array XamlApplication::GetXmlnsDefinitions() { std::vector<::winrt::Microsoft::UI::Xaml::Markup::XmlnsDefinition> allDefinitions; for (const auto &provider : m_providers) { - auto definitionsCurrentProvider = provider.GetXmlnsDefinitions(); - for (const auto &definition : definitionsCurrentProvider) { - allDefinitions.insert(allDefinitions.begin(), definition); - } + 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()); From e0baeb157d905ad1c961036e2fb2cb3ea1a67ad9 Mon Sep 17 00:00:00 2001 From: Sharath Manchala <10109130+sharath2727@users.noreply.github.com> Date: Wed, 12 Nov 2025 22:18:28 +0530 Subject: [PATCH 24/31] Comment out hittest for contentislandcomponentview --- .../Fabric/Composition/ContentIslandComponentView.cpp | 4 ++++ .../Fabric/Composition/ContentIslandComponentView.h | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/vnext/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp b/vnext/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp index 1310d8e7b4c..e356de1e32d 100644 --- a/vnext/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +++ b/vnext/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp @@ -210,6 +210,9 @@ void ContentIslandComponentView::prepareForRecycle() noexcept { Super::prepareForRecycle(); } +/* +* TODO: The base ViewComponentView hitTest implementation hitTest should return the right tag. Commenting this code for reference +* and will be removed once the base implementation is fixed. facebook::react::Tag ContentIslandComponentView::hitTest( facebook::react::Point pt, facebook::react::Point &localPt, @@ -228,6 +231,7 @@ facebook::react::Tag ContentIslandComponentView::hitTest( return -1; } +*/ void ContentIslandComponentView::ConfigureChildSiteLinkAutomation() noexcept { // This automation mode must be set before connecting the child ContentIsland. diff --git a/vnext/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h b/vnext/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h index d9b374ffbfb..1b6a126754a 100644 --- a/vnext/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +++ b/vnext/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h @@ -51,8 +51,9 @@ struct ContentIslandComponentView : ContentIslandComponentViewT Date: Wed, 12 Nov 2025 22:33:14 +0530 Subject: [PATCH 25/31] Remove references to contentislandcomponentview::hittest --- .../ContentIslandComponentView.cpp | 23 ------------------- .../Composition/ContentIslandComponentView.h | 4 ---- 2 files changed, 27 deletions(-) diff --git a/vnext/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp b/vnext/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp index e356de1e32d..6a7685b2877 100644 --- a/vnext/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +++ b/vnext/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp @@ -210,29 +210,6 @@ void ContentIslandComponentView::prepareForRecycle() noexcept { Super::prepareForRecycle(); } -/* -* TODO: The base ViewComponentView hitTest implementation hitTest should return the right tag. Commenting this code for reference -* and will be removed once the base implementation is fixed. -facebook::react::Tag ContentIslandComponentView::hitTest( - facebook::react::Point pt, - facebook::react::Point &localPt, - bool ignorePointerEvents) const noexcept { - facebook::react::Point ptLocal{pt.x - m_layoutMetrics.frame.origin.x, pt.y - m_layoutMetrics.frame.origin.y}; - - // This is similar to ViewComponentView::hitTest, but we don't want to hit test the children of this node, - // because the child ComponentView is kind of a dummy representation of the XamlElement and doesn't do anything. - // So, we just hit test the ContentIsland itself to make the UIA ElementProviderFromPoint call work. - // TODO: Will this cause a problem -- does this function need to do something different for non-UIA scenarios? - if (ptLocal.x >= 0 && ptLocal.x <= m_layoutMetrics.frame.size.width && ptLocal.y >= 0 && - ptLocal.y <= m_layoutMetrics.frame.size.height) { - localPt = ptLocal; - return Tag(); - } - - return -1; -} -*/ - void ContentIslandComponentView::ConfigureChildSiteLinkAutomation() noexcept { // This automation mode must be set before connecting the child ContentIsland. // It puts the child content into a mode where it won't own its own framework root. Instead, the child island's diff --git a/vnext/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h b/vnext/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h index 1b6a126754a..f530baa3400 100644 --- a/vnext/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +++ b/vnext/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h @@ -51,10 +51,6 @@ struct ContentIslandComponentView : ContentIslandComponentViewT Date: Wed, 12 Nov 2025 23:31:58 +0530 Subject: [PATCH 26/31] Restore sampleappfabric.sln --- .../windows/SampleAppFabric.sln | 81 ++++++++++--------- 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/packages/sample-app-fabric/windows/SampleAppFabric.sln b/packages/sample-app-fabric/windows/SampleAppFabric.sln index 66b1574ab2d..1eabd0cabef 100644 --- a/packages/sample-app-fabric/windows/SampleAppFabric.sln +++ b/packages/sample-app-fabric/windows/SampleAppFabric.sln @@ -36,50 +36,62 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Include", "..\..\..\vnext\include\Include.vcxitems", "{EF074BA1-2D54-4D49-A28E-5E040B47CD2E}" EndProject Global + GlobalSection(SharedMSBuildProjectFiles) = preSolution + ..\..\..\vnext\Shared\Shared.vcxitems*{2049dbe9-8d13-42c9-ae4b-413ae38fffd0}*SharedItemsImports = 9 + ..\..\..\vnext\Mso\Mso.vcxitems*{84e05bfa-cbaf-4f0d-bfb6-4ce85742a57e}*SharedItemsImports = 9 + ..\..\..\vnext\Chakra\Chakra.vcxitems*{c38970c0-5fbf-4d69-90d8-cbac225ae895}*SharedItemsImports = 9 + ..\..\..\vnext\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{da8b35b3-da00-4b02-bde6-6a397b3fd46b}*SharedItemsImports = 9 + ..\..\..\vnext\include\Include.vcxitems*{ef074ba1-2d54-4d49-a28e-5e040b47cd2e}*SharedItemsImports = 9 + ..\..\..\vnext\Chakra\Chakra.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4 + ..\..\..\vnext\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4 + ..\..\..\vnext\Mso\Mso.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4 + ..\..\..\vnext\Shared\Shared.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4 + EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|ARM64 = Debug|ARM64 Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 - Release|ARM64 = Release|ARM64 + Debug|ARM64 = Debug|ARM64 Release|x64 = Release|x64 Release|x86 = Release|x86 + Release|ARM64 = Release|ARM64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|ARM64.Build.0 = Debug|ARM64 - {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|ARM64.Deploy.0 = Debug|ARM64 {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|x64.ActiveCfg = Debug|x64 {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|x64.Build.0 = Debug|x64 {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|x64.Deploy.0 = Debug|x64 {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|x86.ActiveCfg = Debug|x86 {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|x86.Build.0 = Debug|x86 {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|x86.Deploy.0 = Debug|x86 - {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|ARM64.ActiveCfg = Release|ARM64 - {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|ARM64.Build.0 = Release|ARM64 - {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|ARM64.Deploy.0 = Release|ARM64 + {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|ARM64.Build.0 = Debug|ARM64 + {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Debug|ARM64.Deploy.0 = Debug|ARM64 {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|x64.ActiveCfg = Release|x64 {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|x64.Build.0 = Release|x64 {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|x64.Deploy.0 = Release|x64 {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|x86.ActiveCfg = Release|x86 {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|x86.Build.0 = Release|x86 {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|x86.Deploy.0 = Release|x86 - {E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|ARM64.Build.0 = Debug|ARM64 - {E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|ARM64.ActiveCfg = Release|ARM64 + {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|ARM64.Build.0 = Release|ARM64 + {7E2B86E3-E6B0-409D-812E-0D81DFFACA9D}.Release|ARM64.Deploy.0 = Release|ARM64 {E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|x64.ActiveCfg = Debug|x64 {E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|x64.Build.0 = Debug|x64 + {E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|x64.Deploy.0 = Debug|x64 {E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|x86.ActiveCfg = Debug|Win32 {E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|x86.Build.0 = Debug|Win32 {E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|x86.Deploy.0 = Debug|Win32 - {E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|ARM64.ActiveCfg = Release|ARM64 - {E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|ARM64.Build.0 = Release|ARM64 - {E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|ARM64.Deploy.0 = Release|ARM64 + {E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|ARM64.Build.0 = Debug|ARM64 + {E278ABE5-5A88-48C5-A949-CA00B489643F}.Debug|ARM64.Deploy.0 = Debug|ARM64 {E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|x64.ActiveCfg = Release|x64 {E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|x64.Build.0 = Release|x64 {E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|x64.Deploy.0 = Release|x64 {E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|x86.ActiveCfg = Release|Win32 {E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|x86.Build.0 = Release|Win32 {E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|x86.Deploy.0 = Release|Win32 + {E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|ARM64.ActiveCfg = Release|ARM64 + {E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|ARM64.Build.0 = Release|ARM64 + {E278ABE5-5A88-48C5-A949-CA00B489643F}.Release|ARM64.Deploy.0 = Release|ARM64 {A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|ARM64.ActiveCfg = Debug|ARM64 {A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|ARM64.Build.0 = Debug|ARM64 {A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|x64.ActiveCfg = Debug|x64 @@ -92,20 +104,6 @@ Global {A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x64.Build.0 = Release|x64 {A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x86.ActiveCfg = Release|Win32 {A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x86.Build.0 = Release|Win32 - {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|ARM64.Build.0 = Debug|ARM64 - {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x64.ActiveCfg = Debug|x64 - {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x64.Build.0 = Debug|x64 - {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x86.ActiveCfg = Debug|Win32 - {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x86.Build.0 = Debug|Win32 - {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x86.Deploy.0 = Debug|Win32 - {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|ARM64.ActiveCfg = Release|ARM64 - {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|ARM64.Build.0 = Release|ARM64 - {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x64.ActiveCfg = Release|x64 - {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x64.Build.0 = Release|x64 - {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x86.ActiveCfg = Release|Win32 - {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x86.Build.0 = Release|Win32 - {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x86.Deploy.0 = Release|Win32 {A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|ARM64.ActiveCfg = Debug|ARM64 {A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|ARM64.Build.0 = Debug|ARM64 {A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|x64.ActiveCfg = Debug|x64 @@ -142,13 +140,26 @@ Global {FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|x64.Build.0 = Release|x64 {FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|x86.ActiveCfg = Release|Win32 {FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|x86.Build.0 = Release|Win32 + {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|ARM64.Build.0 = Debug|ARM64 + {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x64.ActiveCfg = Debug|x64 + {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x64.Build.0 = Debug|x64 + {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x86.ActiveCfg = Debug|Win32 + {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x86.Build.0 = Debug|Win32 + {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Debug|x86.Deploy.0 = Debug|Win32 + {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|ARM64.ActiveCfg = Release|ARM64 + {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|ARM64.Build.0 = Release|ARM64 + {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x64.ActiveCfg = Release|x64 + {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x64.Build.0 = Release|x64 + {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x86.ActiveCfg = Release|Win32 + {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x86.Build.0 = Release|Win32 + {14B93DC8-FD93-4A6D-81CB-8BC96644501C}.Release|x86.Deploy.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {A990658C-CE31-4BCC-976F-0FC6B1AF693D} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1} - {14B93DC8-FD93-4A6D-81CB-8BC96644501C} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1} {A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1} {C38970C0-5FBF-4D69-90D8-CBAC225AE895} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1} {F7D32BD0-2749-483E-9A0D-1635EF7E3136} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1} @@ -157,19 +168,9 @@ Global {2049DBE9-8D13-42C9-AE4B-413AE38FFFD0} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1} {84E05BFA-CBAF-4F0D-BFB6-4CE85742A57E} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1} {EF074BA1-2D54-4D49-A28E-5E040B47CD2E} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1} + {14B93DC8-FD93-4A6D-81CB-8BC96644501C} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {D43FAD39-F619-437D-BB40-04A3982ACB6A} EndGlobalSection - GlobalSection(SharedMSBuildProjectFiles) = preSolution - ..\..\..\vnext\Shared\Shared.vcxitems*{2049dbe9-8d13-42c9-ae4b-413ae38fffd0}*SharedItemsImports = 9 - ..\..\..\vnext\Mso\Mso.vcxitems*{84e05bfa-cbaf-4f0d-bfb6-4ce85742a57e}*SharedItemsImports = 9 - ..\..\..\vnext\Chakra\Chakra.vcxitems*{c38970c0-5fbf-4d69-90d8-cbac225ae895}*SharedItemsImports = 9 - ..\..\..\vnext\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{da8b35b3-da00-4b02-bde6-6a397b3fd46b}*SharedItemsImports = 9 - ..\..\..\vnext\include\Include.vcxitems*{ef074ba1-2d54-4d49-a28e-5e040b47cd2e}*SharedItemsImports = 9 - ..\..\..\vnext\Chakra\Chakra.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4 - ..\..\..\vnext\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4 - ..\..\..\vnext\Mso\Mso.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4 - ..\..\..\vnext\Shared\Shared.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4 - EndGlobalSection EndGlobal From bc345001a995cfc171338377dc0c9f95b22ebab6 Mon Sep 17 00:00:00 2001 From: Sharath Manchala <10109130+sharath2727@users.noreply.github.com> Date: Wed, 12 Nov 2025 23:34:35 +0530 Subject: [PATCH 27/31] Update vnext/Microsoft.ReactNative/IXamlProvider.idl Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- vnext/Microsoft.ReactNative/IXamlProvider.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vnext/Microsoft.ReactNative/IXamlProvider.idl b/vnext/Microsoft.ReactNative/IXamlProvider.idl index f0040724373..eb20e3cc3fb 100644 --- a/vnext/Microsoft.ReactNative/IXamlProvider.idl +++ b/vnext/Microsoft.ReactNative/IXamlProvider.idl @@ -8,4 +8,4 @@ interface IXamlControl { "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 +} // namespace Microsoft.ReactNative.Xaml From d07d6cb4e50421d8082003de45a55a6c295f2020 Mon Sep 17 00:00:00 2001 From: Sundaram Ramaswamy Date: Thu, 13 Nov 2025 10:36:57 +0530 Subject: [PATCH 28/31] Update vnext/Shared/Shared.vcxitems Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- vnext/Shared/Shared.vcxitems | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vnext/Shared/Shared.vcxitems b/vnext/Shared/Shared.vcxitems index 5074cae0f2a..408c0dea86d 100644 --- a/vnext/Shared/Shared.vcxitems +++ b/vnext/Shared/Shared.vcxitems @@ -135,12 +135,12 @@ $(ReactNativeWindowsDir)Microsoft.ReactNative\ReactNativeAppBuilder.idl Code - + true $(ReactNativeWindowsDir)Microsoft.ReactNative\XamlApplication.idl Code - + true $(ReactNativeWindowsDir)Microsoft.ReactNative\XamlApplication.idl Code From 2b9836d3a806bb3ce34e49f047fe680d29518f41 Mon Sep 17 00:00:00 2001 From: Sundaram Ramaswamy Date: Thu, 13 Nov 2025 10:37:55 +0530 Subject: [PATCH 29/31] Update vnext/Shared/Shared.vcxitems Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- vnext/Shared/Shared.vcxitems | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vnext/Shared/Shared.vcxitems b/vnext/Shared/Shared.vcxitems index 408c0dea86d..58f3b3a4643 100644 --- a/vnext/Shared/Shared.vcxitems +++ b/vnext/Shared/Shared.vcxitems @@ -253,7 +253,7 @@ $(MSBuildThisFileDirectory)..\Microsoft.ReactNative\XamlApplication.idl Code - + true $(MSBuildThisFileDirectory)..\Microsoft.ReactNative\XamlApplication.idl Code From 577d5af7cd0030732c12e45f98c0daaa4d39d08b Mon Sep 17 00:00:00 2001 From: Sundaram Ramaswamy Date: Thu, 13 Nov 2025 10:40:35 +0530 Subject: [PATCH 30/31] Update vnext/Shared/Shared.vcxitems Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- vnext/Shared/Shared.vcxitems | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vnext/Shared/Shared.vcxitems b/vnext/Shared/Shared.vcxitems index 58f3b3a4643..d041534fba4 100644 --- a/vnext/Shared/Shared.vcxitems +++ b/vnext/Shared/Shared.vcxitems @@ -142,7 +142,7 @@ true - $(ReactNativeWindowsDir)Microsoft.ReactNative\XamlApplication.idl + $(ReactNativeWindowsDir)Microsoft.ReactNative\XamlHost.idl Code From 7b4cc7afe3450fa6965463148177d6f0b883eaae Mon Sep 17 00:00:00 2001 From: Sharath Manchala <10109130+sharath2727@users.noreply.github.com> Date: Thu, 13 Nov 2025 12:24:59 +0530 Subject: [PATCH 31/31] Xamlhost dependency on xamlapplication.idl --- vnext/Shared/Shared.vcxitems | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vnext/Shared/Shared.vcxitems b/vnext/Shared/Shared.vcxitems index d041534fba4..58f3b3a4643 100644 --- a/vnext/Shared/Shared.vcxitems +++ b/vnext/Shared/Shared.vcxitems @@ -142,7 +142,7 @@ true - $(ReactNativeWindowsDir)Microsoft.ReactNative\XamlHost.idl + $(ReactNativeWindowsDir)Microsoft.ReactNative\XamlApplication.idl Code