diff --git a/change/react-native-windows-c36475ab-b28b-4ff9-b59e-b01c43278e83.json b/change/react-native-windows-c36475ab-b28b-4ff9-b59e-b01c43278e83.json
new file mode 100644
index 00000000000..1604f424a8b
--- /dev/null
+++ b/change/react-native-windows-c36475ab-b28b-4ff9-b59e-b01c43278e83.json
@@ -0,0 +1,7 @@
+{
+ "type": "prerelease",
+ "comment": "Create RootViewPanel",
+ "packageName": "react-native-windows",
+ "email": "lyahdav@users.noreply.github.com",
+ "dependentChangeType": "patch"
+}
diff --git a/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj b/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj
index b1d8373bf17..0622b968765 100644
--- a/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj
+++ b/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj
@@ -194,6 +194,10 @@
Code
+
+ RootViewPanel.idl
+ Code
+
@@ -428,6 +432,10 @@
Code
+
+ RootViewPanel.idl
+ Code
+
@@ -586,6 +594,9 @@
Designer
+
+ Designer
+
@@ -676,4 +687,4 @@
-
\ No newline at end of file
+
diff --git a/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters b/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters
index f6e44c0e498..61c9c5fa383 100644
--- a/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters
+++ b/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters
@@ -713,6 +713,7 @@
+
@@ -769,4 +770,4 @@
-
\ No newline at end of file
+
diff --git a/vnext/Microsoft.ReactNative/RootViewPanel.cpp b/vnext/Microsoft.ReactNative/RootViewPanel.cpp
new file mode 100644
index 00000000000..656b07f42c8
--- /dev/null
+++ b/vnext/Microsoft.ReactNative/RootViewPanel.cpp
@@ -0,0 +1,56 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+#include "pch.h"
+
+#include "RootViewPanel.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "ReactNativeHost.h"
+#include "ReactViewInstance.h"
+#include "TouchEventHandler.h"
+#include "Views/ShadowNodeBase.h"
+#include "XamlUtils.h"
+
+// Needed for latest versions of C++/WinRT
+#if __has_include("RootViewPanel.g.cpp")
+#include "RootViewPanel.g.cpp"
+#endif
+
+namespace winrt::Microsoft::ReactNative::implementation {
+
+RootViewPanel::RootViewPanel(winrt::Microsoft::ReactNative::IReactContext reactContext) noexcept {
+ winrt::Microsoft::ReactNative::ReactContext reactContextImpl = reactContext;
+ auto contextSelf =
+ winrt::get_self(reactContextImpl.Handle());
+
+ m_touchEventHandler = std::make_shared<::Microsoft::ReactNative::TouchEventHandler>(contextSelf->GetInner());
+ m_touchEventHandler->AddTouchHandlers(*this);
+ m_previewKeyboardEventHandlerOnRoot =
+ std::make_shared<::Microsoft::ReactNative::PreviewKeyboardEventHandlerOnRoot>(contextSelf->GetInner());
+ m_previewKeyboardEventHandlerOnRoot->hook(*this);
+}
+
+RootViewPanel::~RootViewPanel() noexcept {
+ if (m_touchEventHandler) {
+ m_touchEventHandler->RemoveTouchHandlers();
+ }
+
+ if (m_previewKeyboardEventHandlerOnRoot) {
+ m_previewKeyboardEventHandlerOnRoot->unhook();
+ }
+
+ // Clear members with a dependency on the reactInstance
+ m_touchEventHandler.reset();
+}
+
+} // namespace winrt::Microsoft::ReactNative::implementation
diff --git a/vnext/Microsoft.ReactNative/RootViewPanel.h b/vnext/Microsoft.ReactNative/RootViewPanel.h
new file mode 100644
index 00000000000..2fb1b011247
--- /dev/null
+++ b/vnext/Microsoft.ReactNative/RootViewPanel.h
@@ -0,0 +1,31 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+#pragma once
+
+#include "RootViewPanel.g.h"
+
+#include "Views/KeyboardEventHandler.h"
+#include "Views/ViewPanel.h"
+
+namespace Microsoft::ReactNative {
+class TouchEventHandler;
+class PreviewKeyboardEventHandlerOnRoot;
+} // namespace Microsoft::ReactNative
+
+namespace winrt::Microsoft::ReactNative::implementation {
+
+struct RootViewPanel : RootViewPanelT {
+ RootViewPanel(winrt::Microsoft::ReactNative::IReactContext reactContext) noexcept;
+ ~RootViewPanel() noexcept;
+
+ private:
+ std::shared_ptr<::Microsoft::ReactNative::TouchEventHandler> m_touchEventHandler;
+ std::shared_ptr<::Microsoft::ReactNative::PreviewKeyboardEventHandlerOnRoot> m_previewKeyboardEventHandlerOnRoot;
+};
+
+} // namespace winrt::Microsoft::ReactNative::implementation
+
+namespace winrt::Microsoft::ReactNative::factory_implementation {
+struct RootViewPanel : RootViewPanelT {};
+} // namespace winrt::Microsoft::ReactNative::factory_implementation
diff --git a/vnext/Microsoft.ReactNative/RootViewPanel.idl b/vnext/Microsoft.ReactNative/RootViewPanel.idl
new file mode 100644
index 00000000000..b5baa84128d
--- /dev/null
+++ b/vnext/Microsoft.ReactNative/RootViewPanel.idl
@@ -0,0 +1,18 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+import "ViewPanel.idl";
+import "IReactContext.idl";
+#include "DocString.h"
+
+namespace Microsoft.ReactNative
+{
+ [default_interface]
+ [webhosthidden]
+ DOC_STRING("A XAML component that manages keyboard/touch inputs.")
+ runtimeclass RootViewPanel : ViewPanel
+ {
+ DOC_STRING("Creates a new instance of @RootViewPanel")
+ RootViewPanel(IReactContext reactContext);
+ }
+} // namespace Microsoft. ReactNative
diff --git a/vnext/Microsoft.ReactNative/Views/cppwinrt/ViewPanel.idl b/vnext/Microsoft.ReactNative/Views/cppwinrt/ViewPanel.idl
index 8c36ba47d50..aa0d71d690e 100644
--- a/vnext/Microsoft.ReactNative/Views/cppwinrt/ViewPanel.idl
+++ b/vnext/Microsoft.ReactNative/Views/cppwinrt/ViewPanel.idl
@@ -8,7 +8,7 @@ namespace Microsoft.ReactNative
{
[default_interface]
[webhosthidden]
- runtimeclass ViewPanel : XAML_NAMESPACE.Controls.Grid
+ unsealed runtimeclass ViewPanel : XAML_NAMESPACE.Controls.Grid
{
// Constructors
ViewPanel();