react-native-windows 0.76.11 → 0.76.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Libraries/Components/Button.windows.js +3 -0
- package/Libraries/Components/ScrollView/ScrollView.windows.js +1959 -0
- package/Libraries/Components/View/View.windows.js +107 -56
- package/Libraries/Image/Image.windows.js +42 -21
- package/Libraries/Text/Text.d.ts +16 -1
- package/Microsoft.ReactNative/CompositionComponentView.idl +0 -5
- package/Microsoft.ReactNative/CompositionSwitcher.idl +4 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +32 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +159 -4
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +11 -4
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +0 -4
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +22 -17
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +1 -27
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +0 -2
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +36 -11
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.h +3 -0
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +50 -125
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +9 -6
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +31 -12
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +6 -1
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +2 -2
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +145 -19
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +13 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentDescriptor.h +0 -2
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +134 -11
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +6 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputEventEmitter.cpp +31 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputEventEmitter.h +14 -1
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputProps.cpp +6 -2
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputProps.h +4 -1
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +127 -109
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.h +28 -25
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.cpp +8 -18
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.h +12 -35
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +53 -11
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +10 -2
- package/Microsoft.ReactNative/Fabric/ImageRequestParams.cpp +26 -0
- package/Microsoft.ReactNative/Fabric/WindowsImageManager.cpp +38 -8
- package/Microsoft.ReactNative/Fabric/WindowsImageManager.h +3 -1
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.cpp +206 -41
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.h +14 -0
- package/Microsoft.ReactNative/Modules/Animated/AnimationDriver.cpp +2 -1
- package/Microsoft.ReactNative/ReactNativeIsland.idl +3 -0
- package/Microsoft.ReactNative/Utils/ImageUtils.h +1 -0
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/PropertySheets/NuGet.LockFile.props +1 -1
- package/PropertySheets/WebView2.props +1 -1
- package/PropertySheets/WinUI.props +1 -1
- package/Shared/Networking/WinRTWebSocketResource.cpp +82 -101
- package/Shared/Networking/WinRTWebSocketResource.h +91 -7
- package/Shared/Shared.vcxitems +3 -1
- package/Shared/Shared.vcxitems.filters +1 -0
- package/package.json +1 -1
package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp
CHANGED
|
@@ -35,33 +35,23 @@ struct ModalHostState
|
|
|
35
35
|
struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::Foundation::IInspectable>,
|
|
36
36
|
::Microsoft::ReactNativeSpecs::BaseModalHostView<ModalHostView> {
|
|
37
37
|
~ModalHostView() {
|
|
38
|
-
if (m_window && m_window.IsVisible()) {
|
|
39
|
-
CloseWindow();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
38
|
if (m_reactNativeIsland) {
|
|
43
39
|
m_reactNativeIsland.Island().Close();
|
|
44
40
|
}
|
|
45
41
|
|
|
46
|
-
if (
|
|
47
|
-
if (m_departFocusToken && !
|
|
48
|
-
|
|
42
|
+
if (m_popUp) {
|
|
43
|
+
if (m_departFocusToken && !m_popUp.IsClosed()) {
|
|
44
|
+
// WASDK BUG: InputFocusNavigationHost::GetForSiteBridge fails on a DesktopPopupSiteBridge
|
|
45
|
+
// https://github.com/microsoft/react-native-windows/issues/14604
|
|
46
|
+
/*
|
|
47
|
+
auto navHost =
|
|
48
|
+
winrt::Microsoft::UI::Input::InputFocusNavigationHost::GetForSiteBridge(m_popUp.as<winrt::Microsoft::UI::Content::IContentSiteBridge>());
|
|
49
49
|
navHost.DepartFocusRequested(m_departFocusToken);
|
|
50
|
+
*/
|
|
50
51
|
}
|
|
51
|
-
m_bridge.Close();
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (m_window) {
|
|
55
|
-
m_window.Destroy();
|
|
56
|
-
m_window = nullptr;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
60
|
-
if (m_popUp) {
|
|
61
52
|
m_popUp.Close();
|
|
62
53
|
m_popUp = nullptr;
|
|
63
54
|
}
|
|
64
|
-
#endif
|
|
65
55
|
}
|
|
66
56
|
|
|
67
57
|
void InitializePortalViewComponent(
|
|
@@ -80,16 +70,37 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
80
70
|
const winrt::com_ptr<::Microsoft::ReactNativeSpecs::ModalHostViewProps> &oldProps) noexcept override {
|
|
81
71
|
if (!oldProps || newProps->visible != oldProps->visible) {
|
|
82
72
|
if (newProps->visible.value_or(true)) {
|
|
73
|
+
m_visible = true;
|
|
83
74
|
// We do not immediately show the window, since we want to resize/position
|
|
84
75
|
// the window based on the layout metrics before we show it
|
|
85
|
-
|
|
76
|
+
QueueShow(view);
|
|
86
77
|
} else {
|
|
78
|
+
m_visible = false;
|
|
87
79
|
CloseWindow();
|
|
88
80
|
}
|
|
89
81
|
}
|
|
90
82
|
::Microsoft::ReactNativeSpecs::BaseModalHostView<ModalHostView>::UpdateProps(view, newProps, oldProps);
|
|
91
83
|
}
|
|
92
84
|
|
|
85
|
+
void QueueShow(const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
|
|
86
|
+
if (m_showQueued)
|
|
87
|
+
return;
|
|
88
|
+
m_showQueued = true;
|
|
89
|
+
|
|
90
|
+
m_reactContext.UIDispatcher().Post([wkThis = get_weak(), wkView = winrt::weak_ref(view)]() {
|
|
91
|
+
if (auto strongThis = wkThis.get()) {
|
|
92
|
+
strongThis->m_showQueued = false;
|
|
93
|
+
|
|
94
|
+
if (!strongThis->m_visible) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (auto v = wkView.get()) {
|
|
98
|
+
strongThis->ShowOnUIThread(v);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
93
104
|
void UpdateState(
|
|
94
105
|
const winrt::Microsoft::ReactNative::ComponentView & /*view*/,
|
|
95
106
|
const winrt::Microsoft::ReactNative::IComponentState &newState) noexcept override {
|
|
@@ -118,19 +129,11 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
118
129
|
m_childLayoutMetricsToken.value = 0;
|
|
119
130
|
}
|
|
120
131
|
|
|
121
|
-
void FinalizeUpdate(
|
|
122
|
-
const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
123
|
-
winrt::Microsoft::ReactNative::ComponentViewUpdateMask /*mask*/) noexcept override {
|
|
124
|
-
if (m_showQueued) {
|
|
125
|
-
ShowOnUIThread(view);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
132
|
private:
|
|
130
133
|
void OnMounted(const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
|
|
131
134
|
m_mounted = true;
|
|
132
|
-
if (
|
|
133
|
-
|
|
135
|
+
if (m_visible) {
|
|
136
|
+
QueueShow(view);
|
|
134
137
|
}
|
|
135
138
|
}
|
|
136
139
|
|
|
@@ -139,11 +142,7 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
139
142
|
}
|
|
140
143
|
|
|
141
144
|
void AdjustWindowSize(const winrt::Microsoft::ReactNative::LayoutMetrics &layoutMetrics) noexcept {
|
|
142
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
143
145
|
if (!m_popUp) {
|
|
144
|
-
#else
|
|
145
|
-
if (!m_window) {
|
|
146
|
-
#endif
|
|
147
146
|
return;
|
|
148
147
|
}
|
|
149
148
|
|
|
@@ -159,57 +158,31 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
159
158
|
int32_t yCor = static_cast<int32_t>(
|
|
160
159
|
(parentRC.top + parentRC.bottom - layoutMetrics.Frame.Height * layoutMetrics.PointScaleFactor) / 2);
|
|
161
160
|
|
|
162
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
163
161
|
winrt::Windows::Graphics::RectInt32 rect2{
|
|
164
162
|
(int)xCor,
|
|
165
163
|
(int)yCor,
|
|
166
164
|
static_cast<int32_t>(layoutMetrics.Frame.Width * (layoutMetrics.PointScaleFactor)),
|
|
167
165
|
static_cast<int32_t>(layoutMetrics.Frame.Height * (layoutMetrics.PointScaleFactor))};
|
|
168
166
|
m_popUp.MoveAndResize(rect2);
|
|
169
|
-
#else
|
|
170
|
-
// Fix for https://github.com/microsoft/microsoft-ui-xaml/issues/9529
|
|
171
|
-
auto titleBarHeight = m_window.TitleBar().Height();
|
|
172
|
-
|
|
173
|
-
// Adjust window position and size
|
|
174
|
-
m_window.ResizeClient(
|
|
175
|
-
{static_cast<int32_t>(layoutMetrics.Frame.Width * (layoutMetrics.PointScaleFactor)),
|
|
176
|
-
static_cast<int32_t>(layoutMetrics.Frame.Height * (layoutMetrics.PointScaleFactor)) - titleBarHeight});
|
|
177
|
-
m_window.Move({xCor, yCor});
|
|
178
|
-
#endif
|
|
179
167
|
};
|
|
180
168
|
|
|
181
169
|
void ShowOnUIThread(const winrt::Microsoft::ReactNative::ComponentView &view) {
|
|
182
170
|
if (!m_mounted)
|
|
183
171
|
return;
|
|
184
172
|
|
|
185
|
-
m_showQueued = false;
|
|
186
173
|
EnsureModalCreated(view);
|
|
187
174
|
|
|
188
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
189
175
|
if (m_popUp) {
|
|
190
|
-
m_bridge.Enable();
|
|
191
176
|
m_popUp.Show();
|
|
192
177
|
|
|
178
|
+
// WASDK BUG: InputFocusNavigationHost::GetForSiteBridge fails on a DesktopPopupSiteBridge
|
|
179
|
+
// https://github.com/microsoft/react-native-windows/issues/14604
|
|
180
|
+
/*
|
|
193
181
|
auto navHost = winrt::Microsoft::UI::Input::InputFocusNavigationHost::GetForSiteBridge(
|
|
194
182
|
m_popUp.as<winrt::Microsoft::UI::Content::IContentSiteBridge>());
|
|
195
183
|
auto result = navHost.NavigateFocus(winrt::Microsoft::UI::Input::FocusNavigationRequest::Create(
|
|
196
184
|
winrt::Microsoft::UI::Input::FocusNavigationReason::First));
|
|
197
|
-
|
|
198
|
-
// dispatch onShow event
|
|
199
|
-
if (auto eventEmitter = EventEmitter()) {
|
|
200
|
-
::Microsoft::ReactNativeSpecs::ModalHostViewEventEmitter::OnShow eventArgs;
|
|
201
|
-
eventEmitter->onShow(eventArgs);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
#endif
|
|
205
|
-
|
|
206
|
-
if (m_window && !m_window.IsVisible()) {
|
|
207
|
-
m_bridge.Enable();
|
|
208
|
-
m_window.Show(true);
|
|
209
|
-
|
|
210
|
-
auto navHost = winrt::Microsoft::UI::Input::InputFocusNavigationHost::GetForSiteBridge(m_bridge);
|
|
211
|
-
auto result = navHost.NavigateFocus(winrt::Microsoft::UI::Input::FocusNavigationRequest::Create(
|
|
212
|
-
winrt::Microsoft::UI::Input::FocusNavigationReason::First));
|
|
185
|
+
*/
|
|
213
186
|
|
|
214
187
|
// dispatch onShow event
|
|
215
188
|
if (auto eventEmitter = EventEmitter()) {
|
|
@@ -222,16 +195,9 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
222
195
|
void CloseWindow() noexcept {
|
|
223
196
|
// enable input to parent before closing the modal window, so focus can return back to the parent window
|
|
224
197
|
EnableWindow(m_parentHwnd, true);
|
|
225
|
-
|
|
226
|
-
if (m_window) {
|
|
227
|
-
m_window.Hide();
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
231
198
|
if (m_popUp) {
|
|
232
199
|
m_popUp.Hide();
|
|
233
200
|
}
|
|
234
|
-
#endif
|
|
235
201
|
|
|
236
202
|
// dispatch onDismiss event
|
|
237
203
|
if (auto eventEmitter = EventEmitter()) {
|
|
@@ -245,21 +211,13 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
245
211
|
m_reactContext.Properties().Handle(), m_prevWindowID);
|
|
246
212
|
m_prevWindowID = 0;
|
|
247
213
|
}
|
|
248
|
-
|
|
249
|
-
m_bridge.Disable();
|
|
250
214
|
}
|
|
251
215
|
|
|
252
216
|
// creates a new modal window
|
|
253
217
|
void EnsureModalCreated(const winrt::Microsoft::ReactNative::ComponentView &view) {
|
|
254
|
-
if (m_window) {
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
259
218
|
if (m_popUp) {
|
|
260
219
|
return;
|
|
261
220
|
}
|
|
262
|
-
#endif
|
|
263
221
|
// get the root hwnd
|
|
264
222
|
m_prevWindowID =
|
|
265
223
|
winrt::Microsoft::ReactNative::ReactCoreInjection::GetTopLevelWindowId(view.ReactContext().Properties());
|
|
@@ -268,15 +226,16 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
268
226
|
view.as<::Microsoft::ReactNative::Composition::Experimental::IComponentViewInterop>()->GetHwndForParenting();
|
|
269
227
|
|
|
270
228
|
auto portal = view.as<winrt::Microsoft::ReactNative::Composition::PortalComponentView>();
|
|
271
|
-
|
|
272
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
273
|
-
m_bridge = winrt::Microsoft::UI::Content::DesktopChildSiteBridge::Create(
|
|
274
|
-
view.Parent().as<winrt::Microsoft::ReactNative::Composition::ComponentView>().Compositor(),
|
|
275
|
-
winrt::Microsoft::UI::GetWindowIdFromWindow(m_parentHwnd));
|
|
276
229
|
m_reactNativeIsland = winrt::Microsoft::ReactNative::ReactNativeIsland::CreatePortal(portal);
|
|
277
230
|
auto contentIsland = m_reactNativeIsland.Island();
|
|
278
231
|
|
|
279
|
-
m_popUp =
|
|
232
|
+
m_popUp = winrt::Microsoft::UI::Content::DesktopPopupSiteBridge::Create(
|
|
233
|
+
portal.Parent()
|
|
234
|
+
.Parent()
|
|
235
|
+
.as<winrt::Microsoft::ReactNative::Composition::ComponentView>()
|
|
236
|
+
.Root()
|
|
237
|
+
.ReactNativeIsland()
|
|
238
|
+
.Island());
|
|
280
239
|
m_popUp.Connect(contentIsland);
|
|
281
240
|
|
|
282
241
|
// set the top-level windows as the new hwnd
|
|
@@ -284,6 +243,9 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
284
243
|
view.ReactContext().Properties(),
|
|
285
244
|
reinterpret_cast<uint64_t>(winrt::Microsoft::UI::GetWindowFromWindowId(m_popUp.WindowId())));
|
|
286
245
|
|
|
246
|
+
// WASDK BUG: InputFocusNavigationHost::GetForSiteBridge fails on a DesktopPopupSiteBridge
|
|
247
|
+
// https://github.com/microsoft/react-native-windows/issues/14604
|
|
248
|
+
/*
|
|
287
249
|
auto navHost = winrt::Microsoft::UI::Input::InputFocusNavigationHost::GetForSiteBridge(
|
|
288
250
|
m_popUp.as<winrt::Microsoft::UI::Content::IContentSiteBridge>());
|
|
289
251
|
m_departFocusToken = navHost.DepartFocusRequested(
|
|
@@ -293,39 +255,7 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
293
255
|
TrySetFocus(strongView.Parent());
|
|
294
256
|
}
|
|
295
257
|
});
|
|
296
|
-
|
|
297
|
-
#else
|
|
298
|
-
auto presenter = winrt::Microsoft::UI::Windowing::OverlappedPresenter::CreateForDialog();
|
|
299
|
-
presenter.SetBorderAndTitleBar(true, false);
|
|
300
|
-
presenter.IsModal(true);
|
|
301
|
-
|
|
302
|
-
m_window = winrt::Microsoft::UI::Windowing::AppWindow::Create(
|
|
303
|
-
presenter, winrt::Microsoft::UI::GetWindowIdFromWindow(m_parentHwnd));
|
|
304
|
-
|
|
305
|
-
// set the top-level windows as the new hwnd
|
|
306
|
-
winrt::Microsoft::ReactNative::ReactCoreInjection::SetTopLevelWindowId(
|
|
307
|
-
view.ReactContext().Properties(),
|
|
308
|
-
reinterpret_cast<uint64_t>(winrt::Microsoft::UI::GetWindowFromWindowId(m_window.Id())));
|
|
309
|
-
|
|
310
|
-
// create a react native island - code taken from CompositionHwndHost
|
|
311
|
-
m_bridge = winrt::Microsoft::UI::Content::DesktopChildSiteBridge::Create(
|
|
312
|
-
view.Parent().as<winrt::Microsoft::ReactNative::Composition::ComponentView>().Compositor(), m_window.Id());
|
|
313
|
-
m_reactNativeIsland = winrt::Microsoft::ReactNative::ReactNativeIsland::CreatePortal(portal);
|
|
314
|
-
auto contentIsland = m_reactNativeIsland.Island();
|
|
315
|
-
|
|
316
|
-
auto navHost = winrt::Microsoft::UI::Input::InputFocusNavigationHost::GetForSiteBridge(m_bridge);
|
|
317
|
-
m_departFocusToken = navHost.DepartFocusRequested(
|
|
318
|
-
[wkView = winrt::make_weak(view)](
|
|
319
|
-
const auto &sender, const winrt::Microsoft::UI::Input::FocusNavigationRequestEventArgs &args) {
|
|
320
|
-
if (auto strongView = wkView.get()) {
|
|
321
|
-
TrySetFocus(strongView.Parent());
|
|
322
|
-
}
|
|
323
|
-
});
|
|
324
|
-
m_bridge.Connect(contentIsland);
|
|
325
|
-
|
|
326
|
-
#endif
|
|
327
|
-
|
|
328
|
-
m_bridge.ResizePolicy(winrt::Microsoft::UI::Content::ContentSizePolicy::ResizeContentToParentWindow);
|
|
258
|
+
*/
|
|
329
259
|
|
|
330
260
|
m_islandStateChangedToken =
|
|
331
261
|
contentIsland.StateChanged([weakThis = get_weak()](
|
|
@@ -343,12 +273,11 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
343
273
|
if (portal.ContentRoot().Children().Size()) {
|
|
344
274
|
AdjustWindowSize(portal.ContentRoot().Children().GetAt(0).LayoutMetrics());
|
|
345
275
|
}
|
|
346
|
-
m_bridge.Show();
|
|
347
276
|
}
|
|
348
277
|
|
|
349
278
|
void UpdateConstraints() noexcept {
|
|
350
279
|
auto displayArea = winrt::Microsoft::UI::Windowing::DisplayArea::GetFromDisplayId(
|
|
351
|
-
|
|
280
|
+
m_popUp.SiteView().EnvironmentView().DisplayId());
|
|
352
281
|
auto workArea = displayArea.WorkArea();
|
|
353
282
|
|
|
354
283
|
float scale = m_reactNativeIsland.Island().RasterizationScale();
|
|
@@ -381,21 +310,17 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
381
310
|
|
|
382
311
|
ReactContext m_reactContext{nullptr};
|
|
383
312
|
HWND m_parentHwnd{nullptr};
|
|
384
|
-
winrt::Microsoft::UI::Windowing::AppWindow m_window{nullptr};
|
|
385
313
|
uint64_t m_prevWindowID;
|
|
386
|
-
bool m_showTitleBar{false};
|
|
387
314
|
bool m_showQueued{false};
|
|
315
|
+
bool m_visible{false};
|
|
388
316
|
bool m_mounted{false};
|
|
389
317
|
winrt::event_token m_islandStateChangedToken;
|
|
390
318
|
winrt::Microsoft::UI::Input::InputFocusNavigationHost::DepartFocusRequested_revoker m_departFocusRevoker;
|
|
391
319
|
winrt::event_token m_departFocusToken;
|
|
392
320
|
winrt::event_token m_childLayoutMetricsToken;
|
|
393
321
|
winrt::Microsoft::ReactNative::IComponentState m_state{nullptr};
|
|
394
|
-
winrt::Microsoft::UI::Content::DesktopChildSiteBridge m_bridge{nullptr};
|
|
395
322
|
winrt::Microsoft::ReactNative::ReactNativeIsland m_reactNativeIsland{nullptr};
|
|
396
|
-
|
|
397
|
-
winrt::Microsoft::UI::Content::PopupWindowSiteBridge m_popUp{nullptr};
|
|
398
|
-
#endif
|
|
323
|
+
winrt::Microsoft::UI::Content::DesktopPopupSiteBridge m_popUp{nullptr};
|
|
399
324
|
};
|
|
400
325
|
|
|
401
326
|
void RegisterWindowsModalHostNativeComponent(
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
// Copyright (c) Microsoft Corporation.
|
|
3
2
|
// Licensed under the MIT License.
|
|
4
3
|
|
|
@@ -32,14 +31,12 @@ ParagraphComponentView::ParagraphComponentView(
|
|
|
32
31
|
void ParagraphComponentView::MountChildComponentView(
|
|
33
32
|
const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
|
|
34
33
|
uint32_t index) noexcept {
|
|
35
|
-
assert(false);
|
|
36
34
|
base_type::MountChildComponentView(childComponentView, index);
|
|
37
35
|
}
|
|
38
36
|
|
|
39
37
|
void ParagraphComponentView::UnmountChildComponentView(
|
|
40
38
|
const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
|
|
41
39
|
uint32_t index) noexcept {
|
|
42
|
-
assert(false);
|
|
43
40
|
base_type::UnmountChildComponentView(childComponentView, index);
|
|
44
41
|
}
|
|
45
42
|
|
|
@@ -64,6 +61,10 @@ void ParagraphComponentView::updateProps(
|
|
|
64
61
|
updateTextAlignment(newViewProps.textAttributes.alignment);
|
|
65
62
|
}
|
|
66
63
|
|
|
64
|
+
if (oldViewProps.paragraphAttributes.adjustsFontSizeToFit != newViewProps.paragraphAttributes.adjustsFontSizeToFit) {
|
|
65
|
+
m_requireRedraw = true;
|
|
66
|
+
}
|
|
67
|
+
|
|
67
68
|
Super::updateProps(props, oldProps);
|
|
68
69
|
}
|
|
69
70
|
|
|
@@ -73,7 +74,7 @@ void ParagraphComponentView::updateState(
|
|
|
73
74
|
const auto &newState = *std::static_pointer_cast<facebook::react::ParagraphShadowNode::ConcreteState const>(state);
|
|
74
75
|
|
|
75
76
|
m_attributedStringBox = facebook::react::AttributedStringBox(newState.getData().attributedString);
|
|
76
|
-
m_paragraphAttributes =
|
|
77
|
+
m_paragraphAttributes = facebook::react::ParagraphAttributes(newState.getData().paragraphAttributes);
|
|
77
78
|
|
|
78
79
|
m_textLayout = nullptr;
|
|
79
80
|
}
|
|
@@ -168,7 +169,9 @@ void ParagraphComponentView::updateVisualBrush() noexcept {
|
|
|
168
169
|
constraints.maximumSize.height =
|
|
169
170
|
m_layoutMetrics.frame.size.height - m_layoutMetrics.contentInsets.top - m_layoutMetrics.contentInsets.bottom;
|
|
170
171
|
|
|
171
|
-
facebook::react::TextLayoutManager::GetTextLayout(
|
|
172
|
+
facebook::react::TextLayoutManager::GetTextLayout(
|
|
173
|
+
m_attributedStringBox, m_paragraphAttributes, constraints, m_textLayout);
|
|
174
|
+
|
|
172
175
|
requireNewBrush = true;
|
|
173
176
|
}
|
|
174
177
|
|
|
@@ -199,6 +202,7 @@ void ParagraphComponentView::updateVisualBrush() noexcept {
|
|
|
199
202
|
// The surfaceBrush's size is based on the size the text takes up, which maybe smaller than the total visual
|
|
200
203
|
// So we need to align the brush within the visual to match the text alignment.
|
|
201
204
|
float horizAlignment{0.f};
|
|
205
|
+
|
|
202
206
|
/*
|
|
203
207
|
const auto &props = paragraphProps()
|
|
204
208
|
if (props.textAttributes.alignment) {
|
|
@@ -227,7 +231,6 @@ void ParagraphComponentView::updateVisualBrush() noexcept {
|
|
|
227
231
|
// TODO Using brush alignment to align the text makes it blurry...
|
|
228
232
|
if (m_drawingSurface) {
|
|
229
233
|
m_drawingSurface.HorizontalAlignmentRatio(horizAlignment);
|
|
230
|
-
m_drawingSurface.VerticalAlignmentRatio(0.f);
|
|
231
234
|
m_drawingSurface.Stretch(winrt::Microsoft::ReactNative::Composition::Experimental::CompositionStretch::None);
|
|
232
235
|
}
|
|
233
236
|
Visual().as<Experimental::ISpriteVisual>().Brush(m_drawingSurface);
|
|
@@ -195,6 +195,8 @@ void ReactNativeIsland::ReactViewHost(winrt::Microsoft::ReactNative::IReactViewH
|
|
|
195
195
|
return;
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
+
m_props = nullptr;
|
|
199
|
+
|
|
198
200
|
if (m_reactViewHost) {
|
|
199
201
|
UninitRootView();
|
|
200
202
|
m_reactViewHost.DetachViewInstance();
|
|
@@ -374,7 +376,14 @@ winrt::IInspectable ReactNativeIsland::GetUiaProvider() noexcept {
|
|
|
374
376
|
if (m_uiaProvider == nullptr) {
|
|
375
377
|
m_uiaProvider =
|
|
376
378
|
winrt::make<winrt::Microsoft::ReactNative::implementation::CompositionRootAutomationProvider>(*this);
|
|
377
|
-
if (
|
|
379
|
+
if (m_island) {
|
|
380
|
+
auto pRootProvider =
|
|
381
|
+
static_cast<winrt::Microsoft::ReactNative::implementation::CompositionRootAutomationProvider *>(
|
|
382
|
+
m_uiaProvider.as<IRawElementProviderSimple>().get());
|
|
383
|
+
if (pRootProvider != nullptr) {
|
|
384
|
+
pRootProvider->SetIsland(m_island);
|
|
385
|
+
}
|
|
386
|
+
} else if (m_hwnd) {
|
|
378
387
|
auto pRootProvider =
|
|
379
388
|
static_cast<winrt::Microsoft::ReactNative::implementation::CompositionRootAutomationProvider *>(
|
|
380
389
|
m_uiaProvider.as<IRawElementProviderSimple>().get());
|
|
@@ -577,7 +586,9 @@ void ReactNativeIsland::ShowInstanceLoaded() noexcept {
|
|
|
577
586
|
winrt::Microsoft::ReactNative::ReactPropertyBag(m_context.Properties()));
|
|
578
587
|
|
|
579
588
|
m_rootTag = ::Microsoft::ReactNative::getNextRootViewTag();
|
|
580
|
-
|
|
589
|
+
|
|
590
|
+
auto initProps =
|
|
591
|
+
m_props.isNull() ? m_props : DynamicWriter::ToDynamic(Mso::Copy(m_reactViewOptions.InitialProps()));
|
|
581
592
|
if (initProps.isNull()) {
|
|
582
593
|
initProps = folly::dynamic::object();
|
|
583
594
|
}
|
|
@@ -900,16 +911,6 @@ winrt::Microsoft::UI::Content::ContentIsland ReactNativeIsland::Island() {
|
|
|
900
911
|
if (args.DidLayoutDirectionChange()) {
|
|
901
912
|
pThis->Arrange(pThis->m_layoutConstraints, pThis->m_viewportOffset);
|
|
902
913
|
}
|
|
903
|
-
#ifndef USE_EXPERIMENTAL_WINUI3 // Use this in place of Connected/Disconnected events for now. -- Its not quite what we
|
|
904
|
-
// want, but it will do for now.
|
|
905
|
-
if (args.DidSiteVisibleChange()) {
|
|
906
|
-
if (island.IsSiteVisible()) {
|
|
907
|
-
pThis->OnMounted();
|
|
908
|
-
} else {
|
|
909
|
-
pThis->OnUnmounted();
|
|
910
|
-
}
|
|
911
|
-
}
|
|
912
|
-
#endif
|
|
913
914
|
}
|
|
914
915
|
});
|
|
915
916
|
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
@@ -965,6 +966,24 @@ void ReactNativeIsland::OnUnmounted() noexcept {
|
|
|
965
966
|
}
|
|
966
967
|
}
|
|
967
968
|
|
|
969
|
+
void ReactNativeIsland::SetProperties(winrt::Microsoft::ReactNative::JSValueArgWriter props) noexcept {
|
|
970
|
+
auto initProps = DynamicWriter::ToDynamic(props);
|
|
971
|
+
if (initProps.isNull()) {
|
|
972
|
+
initProps = folly::dynamic::object();
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
if (m_isJSViewAttached) {
|
|
976
|
+
if (auto fabricuiManager = ::Microsoft::ReactNative::FabricUIManager::FromProperties(
|
|
977
|
+
winrt::Microsoft::ReactNative::ReactPropertyBag(m_context.Properties()))) {
|
|
978
|
+
initProps["concurrentRoot"] = true;
|
|
979
|
+
fabricuiManager->setProps(static_cast<facebook::react::SurfaceId>(m_rootTag), initProps);
|
|
980
|
+
return;
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
m_props = initProps;
|
|
985
|
+
}
|
|
986
|
+
|
|
968
987
|
winrt::com_ptr<winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView>
|
|
969
988
|
ReactNativeIsland::GetComponentView() noexcept {
|
|
970
989
|
if (auto portal = m_portal.get()) {
|
|
@@ -76,6 +76,8 @@ struct ReactNativeIsland
|
|
|
76
76
|
float ScaleFactor() noexcept;
|
|
77
77
|
void ScaleFactor(float value) noexcept;
|
|
78
78
|
|
|
79
|
+
void SetProperties(winrt::Microsoft::ReactNative::JSValueArgWriter props) noexcept;
|
|
80
|
+
|
|
79
81
|
float FontSizeMultiplier() const noexcept;
|
|
80
82
|
|
|
81
83
|
winrt::event_token SizeChanged(
|
|
@@ -154,11 +156,14 @@ struct ReactNativeIsland
|
|
|
154
156
|
bool m_isJSViewAttached{false};
|
|
155
157
|
bool m_hasRenderedVisual{false};
|
|
156
158
|
bool m_showingLoadingUI{false};
|
|
157
|
-
bool m_mounted{
|
|
159
|
+
bool m_mounted{true};
|
|
158
160
|
winrt::weak_ref<winrt::Microsoft::ReactNative::Composition::PortalComponentView> m_portal{nullptr};
|
|
159
161
|
IReactDispatcher m_uiDispatcher{nullptr};
|
|
160
162
|
winrt::IInspectable m_uiaProvider{nullptr};
|
|
161
163
|
|
|
164
|
+
// If SetProps is called before the surface is loaded, store it locally to use on start
|
|
165
|
+
folly::dynamic m_props;
|
|
166
|
+
|
|
162
167
|
// This is the surfaceId that this island belongs to.
|
|
163
168
|
// In the case of portal content root, this will be the surfaceId that contains the portal.
|
|
164
169
|
int64_t m_rootTag{-1};
|
|
@@ -76,6 +76,7 @@ void RootComponentView::updateLayoutMetrics(
|
|
|
76
76
|
winrt::Microsoft::ReactNative::ComponentView RootComponentView::GetFocusedComponent() noexcept {
|
|
77
77
|
return m_focusedComponent;
|
|
78
78
|
}
|
|
79
|
+
|
|
79
80
|
void RootComponentView::SetFocusedComponent(
|
|
80
81
|
const winrt::Microsoft::ReactNative::ComponentView &value,
|
|
81
82
|
winrt::Microsoft::ReactNative::FocusNavigationDirection direction) noexcept {
|
|
@@ -92,11 +93,10 @@ void RootComponentView::SetFocusedComponent(
|
|
|
92
93
|
if (auto rootView = m_wkRootView.get()) {
|
|
93
94
|
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactNativeIsland>(rootView)->TrySetFocus();
|
|
94
95
|
}
|
|
96
|
+
m_focusedComponent = value;
|
|
95
97
|
auto args = winrt::make<winrt::Microsoft::ReactNative::implementation::GotFocusEventArgs>(value, direction);
|
|
96
98
|
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(value)->onGotFocus(args);
|
|
97
99
|
}
|
|
98
|
-
|
|
99
|
-
m_focusedComponent = value;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
bool RootComponentView::NavigateFocus(const winrt::Microsoft::ReactNative::FocusNavigationRequest &request) noexcept {
|