Skip to content

Commit af10f99

Browse files
authored
Renaming CompositionRootView as ReactNativeIsland (#13304)
* Rename CompositionRootView files * Fix format * Fix build errors in playground-composition * Change files * Fix build issues
1 parent 5dcfa75 commit af10f99

24 files changed

+151
-145
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "Rename CompositionRootView to ReactNativeIsland",
4+
"packageName": "react-native-windows",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}

packages/e2e-test-app-fabric/windows/RNTesterApp-Fabric/RNTesterApp-Fabric.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ constexpr PCWSTR mainComponentName = L"RNTesterApp";
2828
std::vector<std::string> g_Errors;
2929
std::vector<std::string> g_Warnings;
3030
HWND global_hwnd;
31-
winrt::Microsoft::ReactNative::CompositionRootView *global_rootView{nullptr};
31+
winrt::Microsoft::ReactNative::ReactNativeIsland *global_rootView{nullptr};
3232
winrt::Microsoft::ReactNative::IReactContext global_reactContext{nullptr};
3333

3434
// Forward declarations of functions included in this code module:
@@ -41,7 +41,7 @@ float ScaleFactor(HWND hwnd) noexcept {
4141
}
4242

4343
void UpdateRootViewSizeToAppWindow(
44-
winrt::Microsoft::ReactNative::CompositionRootView const &rootView,
44+
winrt::Microsoft::ReactNative::ReactNativeIsland const &rootView,
4545
winrt::Microsoft::UI::Windowing::AppWindow const &window) {
4646
auto hwnd = winrt::Microsoft::UI::GetWindowFromWindowId(window.Id());
4747
auto scaleFactor = ScaleFactor(hwnd);
@@ -146,7 +146,7 @@ _Use_decl_annotations_ int CALLBACK WinMain(HINSTANCE instance, HINSTANCE, PSTR
146146
// Create a RootView which will present a react-native component
147147
winrt::Microsoft::ReactNative::ReactViewOptions viewOptions;
148148
viewOptions.ComponentName(mainComponentName);
149-
auto rootView = winrt::Microsoft::ReactNative::CompositionRootView(compositor);
149+
auto rootView = winrt::Microsoft::ReactNative::ReactNativeIsland(compositor);
150150
rootView.ReactViewHost(winrt::Microsoft::ReactNative::ReactCoreInjection::MakeViewHost(host, viewOptions));
151151

152152
// Update the size of the RootView when the AppWindow changes size

packages/playground/windows/playground-composition/Playground-Composition.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ struct WindowData {
122122
static constexpr uint16_t defaultDebuggerPort = 9229;
123123

124124
std::wstring m_bundleFile;
125-
winrt::Microsoft::ReactNative::CompositionRootView m_compRootView{nullptr};
125+
winrt::Microsoft::ReactNative::ReactNativeIsland m_compRootView{nullptr};
126126
winrt::Microsoft::ReactNative::ReactNativeHost m_host{nullptr};
127127
winrt::Microsoft::ReactNative::ReactInstanceSettings m_instanceSettings{nullptr};
128128
bool m_useLiftedComposition{true};
@@ -240,9 +240,9 @@ struct WindowData {
240240

241241
if (!m_compRootView) {
242242
if (windowData->m_useLiftedComposition) {
243-
m_compRootView = winrt::Microsoft::ReactNative::CompositionRootView(g_liftedCompositor);
243+
m_compRootView = winrt::Microsoft::ReactNative::ReactNativeIsland(g_liftedCompositor);
244244
} else {
245-
m_compRootView = winrt::Microsoft::ReactNative::CompositionRootView();
245+
m_compRootView = winrt::Microsoft::ReactNative::ReactNativeIsland();
246246
}
247247

248248
if (windowData->m_useLiftedComposition) {

packages/sample-app-fabric/windows/SampleAppFabric.Package/packages.lock.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
},
1010
"Microsoft.JavaScript.Hermes": {
1111
"type": "Transitive",
12-
"resolved": "0.1.18",
13-
"contentHash": "5K8rRihGwIs2XNOTP2Jsw3T6cegxCBQXcpPS4optONU/AmFElGAfnA6XBQJ4UqlCFCl9Nf9zQrgvCUPBWYHiag=="
12+
"resolved": "0.1.21",
13+
"contentHash": "5njCh+3eXTLOv7+8nOnp6nJ5C0r6it5ze54c0nuWleeDptuK8t3dEDB79XTU4D5DKNvAPlqJpgXRDOak5nYIug=="
1414
},
1515
"Microsoft.VCRTForwarders.140": {
1616
"type": "Transitive",
@@ -51,7 +51,7 @@
5151
"dependencies": {
5252
"Common": "[1.0.0, )",
5353
"Folly": "[1.0.0, )",
54-
"Microsoft.JavaScript.Hermes": "[0.1.18, )",
54+
"Microsoft.JavaScript.Hermes": "[0.1.21, )",
5555
"Microsoft.WindowsAppSDK": "[1.5.240227000, )",
5656
"ReactCommon": "[1.0.0, )",
5757
"boost": "[1.76.0, )"
@@ -67,7 +67,7 @@
6767
"sampleappfabric": {
6868
"type": "Project",
6969
"dependencies": {
70-
"Microsoft.JavaScript.Hermes": "[0.1.18, )",
70+
"Microsoft.JavaScript.Hermes": "[0.1.21, )",
7171
"Microsoft.ReactNative": "[1.0.0, )",
7272
"Microsoft.VCRTForwarders.140": "[1.0.2-rc, )",
7373
"Microsoft.WindowsAppSDK": "[1.5.240227000, )",

packages/sample-app-fabric/windows/SampleAppFabric/SampleAppFabric.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ float ScaleFactor(HWND hwnd) noexcept {
2525
}
2626

2727
void UpdateRootViewSizeToAppWindow(
28-
winrt::Microsoft::ReactNative::CompositionRootView const &rootView,
28+
winrt::Microsoft::ReactNative::ReactNativeIsland const &rootView,
2929
winrt::Microsoft::UI::Windowing::AppWindow const &window) {
3030
auto hwnd = winrt::Microsoft::UI::GetWindowFromWindowId(window.Id());
3131
auto scaleFactor = ScaleFactor(hwnd);
@@ -110,7 +110,7 @@ _Use_decl_annotations_ int CALLBACK WinMain(HINSTANCE instance, HINSTANCE, PSTR
110110
// Create a RootView which will present a react-native component
111111
winrt::Microsoft::ReactNative::ReactViewOptions viewOptions;
112112
viewOptions.ComponentName(mainComponentName);
113-
auto rootView = winrt::Microsoft::ReactNative::CompositionRootView(compositor);
113+
auto rootView = winrt::Microsoft::ReactNative::ReactNativeIsland(compositor);
114114
rootView.ReactViewHost(winrt::Microsoft::ReactNative::ReactCoreInjection::MakeViewHost(host, viewOptions));
115115

116116
// Update the size of the RootView when the AppWindow changes size

vnext/Desktop/module.g.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4-
// WARNING: Please don't edit this file. It was generated by C++/WinRT v2.0.200615.7
4+
55

66
#include "pch.h"
77
#include "winrt/base.h"
88
void* winrt_make_Microsoft_Internal_TestController();
9-
void* winrt_make_Microsoft_ReactNative_CompositionRootView();
9+
void* winrt_make_Microsoft_ReactNative_ReactNativeIsland();
1010
#ifdef USE_WINUI3
1111
void *winrt_make_Microsoft_ReactNative_Composition_Experimental_MicrosoftCompositionContextHelper();
1212
#endif
@@ -28,7 +28,7 @@ void* winrt_make_facebook_react_NativeLogEventSource();
2828
void* winrt_make_facebook_react_NativeTraceEventSource();
2929

3030
#ifndef USE_FABRIC
31-
void* winrt_make_Microsoft_ReactNative_CompositionRootView() {
31+
void* winrt_make_Microsoft_ReactNative_ReactNativeIsland() {
3232
winrt::throw_hresult(E_NOTIMPL);
3333
}
3434
void* winrt_make_Microsoft_ReactNative_Composition_ViewComponentView() {
@@ -61,8 +61,8 @@ void* __stdcall winrt_get_activation_factory([[maybe_unused]] std::wstring_view
6161
{
6262
return winrt_make_Microsoft_Internal_TestController();
6363
}
64-
if (requal(name, L"Microsoft.ReactNative.CompositionRootView")) {
65-
return winrt_make_Microsoft_ReactNative_CompositionRootView();
64+
if (requal(name, L"Microsoft.ReactNative.ReactNativeIsland")) {
65+
return winrt_make_Microsoft_ReactNative_ReactNativeIsland();
6666
}
6767
#ifdef USE_WINUI3
6868
if (requal(name, L"Microsoft.ReactNative.Composition.Experimental.MicrosoftCompositionContextHelper")) {

vnext/Microsoft.ReactNative/CompositionHwndHost.idl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import "IJSValueWriter.idl";
55
import "ReactCoreInjection.idl";
66
import "ReactNativeHost.idl";
7-
import "CompositionRootView.idl";
7+
import "ReactNativeIsland.idl";
88
#include "NamespaceRedirect.h"
99
#include "DocString.h"
1010

vnext/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
#include <windowsx.h>
1515
#include <winrt/Windows.UI.Input.h>
1616
#include "Composition.Input.h"
17-
#include "CompositionRootView.h"
1817
#include "CompositionViewComponentView.h"
18+
#include "ReactNativeIsland.h"
1919
#include "RootComponentView.h"
2020

2121
#ifdef USE_WINUI3
@@ -151,10 +151,10 @@ struct CompositionInputKeyboardSource : winrt::implements<
151151

152152
CompositionEventHandler::CompositionEventHandler(
153153
const winrt::Microsoft::ReactNative::ReactContext &context,
154-
const winrt::Microsoft::ReactNative::CompositionRootView &CompositionRootView)
155-
: m_context(context), m_wkRootView(CompositionRootView) {
154+
const winrt::Microsoft::ReactNative::ReactNativeIsland &reactNativeIsland)
155+
: m_context(context), m_wkRootView(reactNativeIsland) {
156156
#ifdef USE_WINUI3
157-
if (auto island = CompositionRootView.Island()) {
157+
if (auto island = reactNativeIsland.Island()) {
158158
auto pointerSource = winrt::Microsoft::UI::Input::InputPointerSource::GetForIsland(island);
159159

160160
m_pointerPressedToken =
@@ -241,7 +241,7 @@ CompositionEventHandler::CompositionEventHandler(
241241
focusedComponent
242242
? focusedComponent.Tag()
243243
: static_cast<facebook::react::Tag>(
244-
winrt::get_self<winrt::Microsoft::ReactNative::implementation::CompositionRootView>(
244+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactNativeIsland>(
245245
strongRootView)
246246
->RootTag()),
247247
args);
@@ -264,7 +264,7 @@ CompositionEventHandler::CompositionEventHandler(
264264
focusedComponent
265265
? focusedComponent.Tag()
266266
: static_cast<facebook::react::Tag>(
267-
winrt::get_self<winrt::Microsoft::ReactNative::implementation::CompositionRootView>(
267+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactNativeIsland>(
268268
strongRootView)
269269
->RootTag()),
270270
args);
@@ -288,7 +288,7 @@ CompositionEventHandler::CompositionEventHandler(
288288
focusedComponent
289289
? focusedComponent.Tag()
290290
: static_cast<facebook::react::Tag>(
291-
winrt::get_self<winrt::Microsoft::ReactNative::implementation::CompositionRootView>(
291+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactNativeIsland>(
292292
strongRootView)
293293
->RootTag()),
294294
args);
@@ -323,7 +323,7 @@ CompositionEventHandler::~CompositionEventHandler() {
323323
facebook::react::SurfaceId CompositionEventHandler::SurfaceId() const noexcept {
324324
if (auto strongRootView = m_wkRootView.get()) {
325325
return static_cast<facebook::react::SurfaceId>(
326-
winrt::get_self<winrt::Microsoft::ReactNative::implementation::CompositionRootView>(strongRootView)->RootTag());
326+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactNativeIsland>(strongRootView)->RootTag());
327327
}
328328
return -1;
329329
}
@@ -456,11 +456,11 @@ int64_t CompositionEventHandler::SendMessage(HWND hwnd, uint32_t msg, uint64_t w
456456
auto focusedComponent = RootComponentView().GetFocusedComponent();
457457
auto args = winrt::make<
458458
winrt::Microsoft::ReactNative::Composition::Input::implementation::CharacterReceivedRoutedEventArgs>(
459-
focusedComponent ? focusedComponent.Tag()
460-
: static_cast<facebook::react::Tag>(
461-
winrt::get_self<winrt::Microsoft::ReactNative::implementation::CompositionRootView>(
462-
strongRootView)
463-
->RootTag()),
459+
focusedComponent
460+
? focusedComponent.Tag()
461+
: static_cast<facebook::react::Tag>(
462+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactNativeIsland>(strongRootView)
463+
->RootTag()),
464464
msg,
465465
wParam,
466466
lParam);
@@ -477,11 +477,11 @@ int64_t CompositionEventHandler::SendMessage(HWND hwnd, uint32_t msg, uint64_t w
477477
if (auto strongRootView = m_wkRootView.get()) {
478478
auto focusedComponent = RootComponentView().GetFocusedComponent();
479479
auto args = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::KeyRoutedEventArgs>(
480-
focusedComponent ? focusedComponent.Tag()
481-
: static_cast<facebook::react::Tag>(
482-
winrt::get_self<winrt::Microsoft::ReactNative::implementation::CompositionRootView>(
483-
strongRootView)
484-
->RootTag()),
480+
focusedComponent
481+
? focusedComponent.Tag()
482+
: static_cast<facebook::react::Tag>(
483+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactNativeIsland>(strongRootView)
484+
->RootTag()),
485485
msg,
486486
wParam,
487487
lParam);

vnext/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class CompositionEventHandler {
3131
public:
3232
CompositionEventHandler(
3333
const winrt::Microsoft::ReactNative::ReactContext &context,
34-
const winrt::Microsoft::ReactNative::CompositionRootView &CompositionRootView);
34+
const winrt::Microsoft::ReactNative::ReactNativeIsland &ReactNativeIsland);
3535
virtual ~CompositionEventHandler();
3636

3737
int64_t SendMessage(HWND hwnd, uint32_t msg, uint64_t wParam, int64_t lParam) noexcept;
@@ -154,7 +154,7 @@ class CompositionEventHandler {
154154
PointerId m_touchId = 0;
155155

156156
std::map<PointerId, std::vector<ReactTaggedView>> m_currentlyHoveredViewsPerPointer;
157-
winrt::weak_ref<winrt::Microsoft::ReactNative::CompositionRootView> m_wkRootView;
157+
winrt::weak_ref<winrt::Microsoft::ReactNative::ReactNativeIsland> m_wkRootView;
158158
winrt::Microsoft::ReactNative::ReactContext m_context;
159159

160160
facebook::react::Tag m_pointerCapturingComponentTag{-1}; // Component that has captured input

vnext/Microsoft.ReactNative/Fabric/Composition/CompositionHwndHost.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#include <winrt/Microsoft.ReactNative.Composition.Experimental.h>
1818
#include "CompositionRootAutomationProvider.h"
19-
#include "CompositionRootView.h"
19+
#include "ReactNativeIsland.h"
2020

2121
#if USE_WINUI3
2222
#include <winrt/Microsoft.UI.Content.h>
@@ -39,7 +39,7 @@ void CompositionHwndHost::Initialize(uint64_t hwnd) noexcept {
3939
if (auto liftedCompositor =
4040
winrt::Microsoft::ReactNative::Composition::Experimental::MicrosoftCompositionContextHelper::InnerCompositor(
4141
compositionContext)) {
42-
m_compRootView = winrt::Microsoft::ReactNative::CompositionRootView(liftedCompositor);
42+
m_compRootView = winrt::Microsoft::ReactNative::ReactNativeIsland(liftedCompositor);
4343

4444
auto bridge = winrt::Microsoft::UI::Content::DesktopChildSiteBridge::Create(
4545
liftedCompositor, winrt::Microsoft::UI::GetWindowIdFromWindow(m_hwnd));
@@ -52,7 +52,7 @@ void CompositionHwndHost::Initialize(uint64_t hwnd) noexcept {
5252
m_compRootView.ScaleFactor(ScaleFactor());
5353
bridge.ResizePolicy(winrt::Microsoft::UI::Content::ContentSizePolicy::ResizeContentToParentWindow);
5454
} else {
55-
m_compRootView = winrt::Microsoft::ReactNative::CompositionRootView();
55+
m_compRootView = winrt::Microsoft::ReactNative::ReactNativeIsland();
5656
m_compRootView.as<winrt::Microsoft::ReactNative::Composition::Experimental::IInternalCompositionRootView>()
5757
.SetWindow(reinterpret_cast<uint64_t>(m_hwnd));
5858

@@ -149,7 +149,7 @@ void CompositionHwndHost::ReactViewHost(ReactNative::IReactViewHost const &value
149149
}
150150

151151
IInspectable CompositionHwndHost::UiaProvider() noexcept {
152-
auto compRootView = winrt::get_self<implementation::CompositionRootView>(m_compRootView);
152+
auto compRootView = winrt::get_self<implementation::ReactNativeIsland>(m_compRootView);
153153
auto provider = compRootView->GetUiaProvider();
154154
auto pRootProvider = static_cast<CompositionRootAutomationProvider *>(provider.as<IRawElementProviderSimple>().get());
155155
if (pRootProvider != nullptr) {

0 commit comments

Comments
 (0)