From 5f392af5260140524b11bbf3f3f657f60ab8f802 Mon Sep 17 00:00:00 2001 From: Eric Rozell Date: Wed, 20 Mar 2024 14:52:07 -0400 Subject: [PATCH 1/3] Support WinAppSDK + cppwinrt 2.240111.5 See https://github.com/microsoft/cppwinrt/issues/1393 We need to first convert the WinUI 3 control to IControlProtected to access GetTemplateChild. --- vnext/Microsoft.ReactNative/Views/TextInputViewManager.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vnext/Microsoft.ReactNative/Views/TextInputViewManager.cpp b/vnext/Microsoft.ReactNative/Views/TextInputViewManager.cpp index ab96cefff02..903c74e8ceb 100644 --- a/vnext/Microsoft.ReactNative/Views/TextInputViewManager.cpp +++ b/vnext/Microsoft.ReactNative/Views/TextInputViewManager.cpp @@ -319,7 +319,11 @@ void TextInputShadowNode::registerEvents() { } } +#ifdef USE_WINUI3 + auto contentElement = control.as().GetTemplateChild(L"ContentElement"); +#else auto contentElement = control.GetTemplateChild(L"ContentElement"); +#endif auto textBoxView = contentElement.as(); if (textBoxView) { m_scrollViewerViewChangingRevoker = textBoxView.ViewChanging( From 23667d052cc415248cee64886cb82ee178c77511 Mon Sep 17 00:00:00 2001 From: Eric Rozell Date: Wed, 20 Mar 2024 14:55:25 -0400 Subject: [PATCH 2/3] Change files --- ...ative-windows-cf526fee-a8ea-4093-a2b9-326406f5c5ac.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/react-native-windows-cf526fee-a8ea-4093-a2b9-326406f5c5ac.json diff --git a/change/react-native-windows-cf526fee-a8ea-4093-a2b9-326406f5c5ac.json b/change/react-native-windows-cf526fee-a8ea-4093-a2b9-326406f5c5ac.json new file mode 100644 index 00000000000..a00fb7b2e17 --- /dev/null +++ b/change/react-native-windows-cf526fee-a8ea-4093-a2b9-326406f5c5ac.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "Support WinAppSDK + cppwinrt 2.240111.5", + "packageName": "react-native-windows", + "email": "erozell@outlook.com", + "dependentChangeType": "patch" +} From a8c53ef9661bb0c41ff1a30365c1ae5310e40933 Mon Sep 17 00:00:00 2001 From: Eric Rozell Date: Thu, 28 Mar 2024 09:56:10 -0400 Subject: [PATCH 3/3] Apply C++/WinRT fix to both UWP and WinAppSDK --- vnext/Microsoft.ReactNative/Views/TextInputViewManager.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/vnext/Microsoft.ReactNative/Views/TextInputViewManager.cpp b/vnext/Microsoft.ReactNative/Views/TextInputViewManager.cpp index 903c74e8ceb..feed6c1e0c3 100644 --- a/vnext/Microsoft.ReactNative/Views/TextInputViewManager.cpp +++ b/vnext/Microsoft.ReactNative/Views/TextInputViewManager.cpp @@ -319,11 +319,7 @@ void TextInputShadowNode::registerEvents() { } } -#ifdef USE_WINUI3 auto contentElement = control.as().GetTemplateChild(L"ContentElement"); -#else - auto contentElement = control.GetTemplateChild(L"ContentElement"); -#endif auto textBoxView = contentElement.as(); if (textBoxView) { m_scrollViewerViewChangingRevoker = textBoxView.ViewChanging(