react-native-windows 0.77.0-preview.2 → 0.77.0-preview.4

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.
@@ -17,7 +17,7 @@ const version: $ReadOnly<{
17
17
  major: 0,
18
18
  minor: 77,
19
19
  patch: 0,
20
- prerelease: 'rc.4',
20
+ prerelease: 'rc.6',
21
21
  };
22
22
 
23
23
  module.exports = {version};
@@ -13,7 +13,7 @@
13
13
  #include "CompositionViewComponentView.h"
14
14
 
15
15
  #pragma warning(push)
16
- #pragma warning(disable : 4244 4305)
16
+ #pragma warning(disable : 4305)
17
17
  #include <react/renderer/components/view/ViewProps.h>
18
18
  #pragma warning(pop)
19
19
  #include "Composition.ContentIslandComponentView.g.h"
@@ -17,7 +17,7 @@
17
17
  #include "ImageResponseImage.h"
18
18
 
19
19
  #pragma warning(push)
20
- #pragma warning(disable : 4244 4305)
20
+ #pragma warning(disable : 4305)
21
21
  #include <react/renderer/components/view/ViewProps.h>
22
22
  #pragma warning(pop)
23
23
  #include "Composition.ImageComponentView.g.h"
@@ -25,6 +25,7 @@
25
25
  #include "DynamicAutomationProperties.h"
26
26
 
27
27
  #include <Views/ViewPanel.h>
28
+ #include "FrameworkElementViewManager.h"
28
29
  #include "Unicode.h"
29
30
  #include "cdebug.h"
30
31
 
@@ -422,13 +423,24 @@ bool FrameworkElementViewManager::UpdateProperty(
422
423
  else if (role == "toolbar")
423
424
  DynamicAutomationProperties::SetAccessibilityRole(
424
425
  element, winrt::Microsoft::ReactNative::AccessibilityRoles::ToolBar);
425
- else if (role == "list")
426
+ else if (role == "list") {
426
427
  DynamicAutomationProperties::SetAccessibilityRole(
427
428
  element, winrt::Microsoft::ReactNative::AccessibilityRoles::List);
428
- else if (role == "listitem")
429
+ if (propertyValue.Type() == winrt::Microsoft::ReactNative::JSValueType::String) {
430
+ winrt::hstring controlType = FrameworkElementViewManager::getControlTypeFromAccessibilityRole(
431
+ winrt::Microsoft::ReactNative::AccessibilityRoles::List);
432
+ FrameworkElementViewManager::setLocalizedControlTypeFromAccessibilityRole(element, controlType);
433
+ }
434
+ } else if (role == "listitem") {
429
435
  DynamicAutomationProperties::SetAccessibilityRole(
430
436
  element, winrt::Microsoft::ReactNative::AccessibilityRoles::ListItem);
431
- else
437
+ if (propertyValue.Type() ==
438
+ winrt::Microsoft::ReactNative::JSValueType::String) { // Set localized control type
439
+ winrt::hstring controlType = FrameworkElementViewManager::getControlTypeFromAccessibilityRole(
440
+ winrt::Microsoft::ReactNative::AccessibilityRoles::ListItem);
441
+ FrameworkElementViewManager::setLocalizedControlTypeFromAccessibilityRole(element, controlType);
442
+ }
443
+ } else
432
444
  DynamicAutomationProperties::SetAccessibilityRole(
433
445
  element, winrt::Microsoft::ReactNative::AccessibilityRoles::Unknown);
434
446
  } else if (propertyValue.IsNull()) {
@@ -823,6 +835,71 @@ bool FrameworkElementViewManager::UpdateProperty(
823
835
  return true;
824
836
  }
825
837
 
838
+ winrt::hstring FrameworkElementViewManager::getControlTypeFromAccessibilityRole(
839
+ winrt::Microsoft::ReactNative::AccessibilityRoles role) {
840
+ switch (role) {
841
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::Button:
842
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::ImageButton:
843
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::Switch:
844
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::ToggleButton:
845
+ return winrt::to_hstring("button");
846
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::Link:
847
+ return winrt::to_hstring("link");
848
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::Image:
849
+ return winrt::to_hstring("image");
850
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::KeyboardKey:
851
+ return winrt::to_hstring("custom");
852
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::Text:
853
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::Header:
854
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::Summary:
855
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::Alert:
856
+ return winrt::to_hstring("text");
857
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::Adjustable:
858
+ return winrt::to_hstring("slider");
859
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::CheckBox:
860
+ return winrt::to_hstring("checkbox");
861
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::ComboBox:
862
+ return winrt::to_hstring("combobox");
863
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::Menu:
864
+ return winrt::to_hstring("menu");
865
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::MenuBar:
866
+ return winrt::to_hstring("menubar");
867
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::MenuItem:
868
+ return winrt::to_hstring("menuitem");
869
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::ProgressBar:
870
+ return winrt::to_hstring("progressbar");
871
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::Radio:
872
+ return winrt::to_hstring("radiobutton");
873
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::ScrollBar:
874
+ return winrt::to_hstring("scrollbar");
875
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::SpinButton:
876
+ return winrt::to_hstring("spinner");
877
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::Tab:
878
+ return winrt::to_hstring("tabitem");
879
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::TabList:
880
+ return winrt::to_hstring("tab");
881
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::ToolBar:
882
+ return winrt::to_hstring("toolbar");
883
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::List:
884
+ return winrt::to_hstring("list");
885
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::ListItem:
886
+ return winrt::to_hstring("listitem");
887
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::None:
888
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::Search:
889
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::RadioGroup:
890
+ case winrt::Microsoft::ReactNative::AccessibilityRoles::Timer:
891
+ return winrt::to_hstring("group");
892
+ }
893
+ return winrt::to_hstring("custom");
894
+ }
895
+
896
+ void FrameworkElementViewManager::setLocalizedControlTypeFromAccessibilityRole(
897
+ xaml::UIElement element,
898
+ winrt::hstring value) {
899
+ auto controlTypeBoxedValue = winrt::Windows::Foundation::PropertyValue::CreateString(value);
900
+ element.SetValue(xaml::Automation::AutomationProperties::LocalizedControlTypeProperty(), controlTypeBoxedValue);
901
+ }
902
+
826
903
  // Applies a TransformMatrix to the backing UIElement.
827
904
  // In react-native, rotates and scales are applied about the center of the
828
905
  // component, unlike XAML. Since the javascript layer sends a non-centered
@@ -13,6 +13,10 @@ class REACTWINDOWS_EXPORT FrameworkElementViewManager : public ViewManagerBase {
13
13
  public:
14
14
  FrameworkElementViewManager(const Mso::React::IReactContext &context);
15
15
 
16
+ static winrt::hstring getControlTypeFromAccessibilityRole(winrt::Microsoft::ReactNative::AccessibilityRoles role);
17
+
18
+ void setLocalizedControlTypeFromAccessibilityRole(xaml::UIElement element, winrt::hstring value);
19
+
16
20
  void GetNativeProps(const winrt::Microsoft::ReactNative::IJSValueWriter &writer) const override;
17
21
 
18
22
  // Helper functions related to setting/updating TransformMatrix
@@ -10,11 +10,11 @@
10
10
  -->
11
11
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
12
12
  <PropertyGroup>
13
- <ReactNativeWindowsVersion>0.77.0-preview.2</ReactNativeWindowsVersion>
13
+ <ReactNativeWindowsVersion>0.77.0-preview.4</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>77</ReactNativeWindowsMinor>
16
16
  <ReactNativeWindowsPatch>0</ReactNativeWindowsPatch>
17
17
  <ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
18
- <ReactNativeWindowsCommitId>e70d4987c0929e4eb4125342c53cf6566e19af00</ReactNativeWindowsCommitId>
18
+ <ReactNativeWindowsCommitId>d443628909cc7973410fa18a457710512bac78d7</ReactNativeWindowsCommitId>
19
19
  </PropertyGroup>
20
20
  </Project>
@@ -0,0 +1,358 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #include "NativeDOM.h"
9
+ #include <react/renderer/components/root/RootShadowNode.h>
10
+ #include <react/renderer/dom/DOM.h>
11
+ #include <react/renderer/uimanager/PointerEventsProcessor.h>
12
+ #include <react/renderer/uimanager/UIManagerBinding.h>
13
+
14
+ #ifdef RN_DISABLE_OSS_PLUGIN_HEADER
15
+ #include "Plugins.h"
16
+ #endif
17
+
18
+ std::shared_ptr<facebook::react::TurboModule> NativeDOMModuleProvider(
19
+ std::shared_ptr<facebook::react::CallInvoker> jsInvoker) {
20
+ return std::make_shared<facebook::react::NativeDOM>(std::move(jsInvoker));
21
+ }
22
+
23
+ namespace facebook::react {
24
+
25
+ #pragma mark - Private helpers
26
+
27
+ static RootShadowNode::Shared getCurrentShadowTreeRevision(
28
+ facebook::jsi::Runtime& runtime,
29
+ SurfaceId surfaceId) {
30
+ auto& uiManager =
31
+ facebook::react::UIManagerBinding::getBinding(runtime)->getUIManager();
32
+ auto shadowTreeRevisionProvider = uiManager.getShadowTreeRevisionProvider();
33
+ return shadowTreeRevisionProvider->getCurrentRevision(surfaceId);
34
+ }
35
+
36
+ static facebook::react::PointerEventsProcessor&
37
+ getPointerEventsProcessorFromRuntime(facebook::jsi::Runtime& runtime) {
38
+ return facebook::react::UIManagerBinding::getBinding(runtime)
39
+ ->getPointerEventsProcessor();
40
+ }
41
+
42
+ static std::vector<facebook::jsi::Value>
43
+ getArrayOfInstanceHandlesFromShadowNodes(
44
+ const ShadowNode::ListOfShared& nodes,
45
+ facebook::jsi::Runtime& runtime) {
46
+ // JSI doesn't support adding elements to an array after creation,
47
+ // so we need to accumulate the values in a vector and then create
48
+ // the array when we know the size.
49
+ std::vector<facebook::jsi::Value> nonNullInstanceHandles;
50
+ nonNullInstanceHandles.reserve(nodes.size());
51
+ for (const auto& shadowNode : nodes) {
52
+ auto instanceHandle = (*shadowNode).getInstanceHandle(runtime);
53
+ if (!instanceHandle.isNull()) {
54
+ nonNullInstanceHandles.push_back(std::move(instanceHandle));
55
+ }
56
+ }
57
+
58
+ return nonNullInstanceHandles;
59
+ }
60
+
61
+ #pragma mark - NativeDOM
62
+
63
+ NativeDOM::NativeDOM(std::shared_ptr<CallInvoker> jsInvoker)
64
+ : NativeDOMCxxSpec(std::move(jsInvoker)) {}
65
+
66
+ jsi::Value NativeDOM::getParentNode(
67
+ jsi::Runtime& rt,
68
+ jsi::Value shadowNodeValue) {
69
+ auto shadowNode = shadowNodeFromValue(rt, shadowNodeValue);
70
+ auto currentRevision =
71
+ getCurrentShadowTreeRevision(rt, shadowNode->getSurfaceId());
72
+ if (currentRevision == nullptr) {
73
+ return jsi::Value::undefined();
74
+ }
75
+
76
+ auto parentShadowNode = dom::getParentNode(currentRevision, *shadowNode);
77
+ if (parentShadowNode == nullptr) {
78
+ return jsi::Value::undefined();
79
+ }
80
+
81
+ return parentShadowNode->getInstanceHandle(rt);
82
+ }
83
+
84
+ std::vector<jsi::Value> NativeDOM::getChildNodes(
85
+ jsi::Runtime& rt,
86
+ jsi::Value shadowNodeValue) {
87
+ auto shadowNode = shadowNodeFromValue(rt, shadowNodeValue);
88
+ auto currentRevision =
89
+ getCurrentShadowTreeRevision(rt, shadowNode->getSurfaceId());
90
+ if (currentRevision == nullptr) {
91
+ return std::vector<jsi::Value>{};
92
+ }
93
+
94
+ auto childNodes = dom::getChildNodes(currentRevision, *shadowNode);
95
+ return getArrayOfInstanceHandlesFromShadowNodes(childNodes, rt);
96
+ }
97
+
98
+ bool NativeDOM::isConnected(jsi::Runtime& rt, jsi::Value shadowNodeValue) {
99
+ auto shadowNode = shadowNodeFromValue(rt, shadowNodeValue);
100
+ auto currentRevision =
101
+ getCurrentShadowTreeRevision(rt, shadowNode->getSurfaceId());
102
+ if (currentRevision == nullptr) {
103
+ return false;
104
+ }
105
+
106
+ return dom::isConnected(currentRevision, *shadowNode);
107
+ }
108
+
109
+ double NativeDOM::compareDocumentPosition(
110
+ jsi::Runtime& rt,
111
+ jsi::Value shadowNodeValue,
112
+ jsi::Value otherShadowNodeValue) {
113
+ auto shadowNode = shadowNodeFromValue(rt, shadowNodeValue);
114
+ auto otherShadowNode = shadowNodeFromValue(rt, otherShadowNodeValue);
115
+ auto currentRevision =
116
+ getCurrentShadowTreeRevision(rt, shadowNode->getSurfaceId());
117
+ if (otherShadowNode == nullptr || currentRevision == nullptr) {
118
+ return 0;
119
+ }
120
+
121
+ return dom::compareDocumentPosition(
122
+ currentRevision, *shadowNode, *otherShadowNode);
123
+ }
124
+
125
+ std::string NativeDOM::getTextContent(
126
+ jsi::Runtime& rt,
127
+ jsi::Value shadowNodeValue) {
128
+ auto shadowNode = shadowNodeFromValue(rt, shadowNodeValue);
129
+ auto currentRevision =
130
+ getCurrentShadowTreeRevision(rt, shadowNode->getSurfaceId());
131
+ if (currentRevision == nullptr) {
132
+ return "";
133
+ }
134
+
135
+ return dom::getTextContent(currentRevision, *shadowNode);
136
+ }
137
+
138
+ std::tuple<
139
+ /* x: */ double,
140
+ /* y: */ double,
141
+ /* width: */ double,
142
+ /* height: */ double>
143
+ NativeDOM::getBoundingClientRect(
144
+ jsi::Runtime& rt,
145
+ jsi::Value shadowNodeValue,
146
+ bool includeTransform) {
147
+ auto shadowNode = shadowNodeFromValue(rt, shadowNodeValue);
148
+ auto currentRevision =
149
+ getCurrentShadowTreeRevision(rt, shadowNode->getSurfaceId());
150
+ if (currentRevision == nullptr) {
151
+ return {0, 0, 0, 0};
152
+ }
153
+
154
+ auto domRect = dom::getBoundingClientRect(
155
+ currentRevision, *shadowNode, includeTransform);
156
+
157
+ return std::tuple{domRect.x, domRect.y, domRect.width, domRect.height};
158
+ }
159
+
160
+ std::tuple<
161
+ /* offsetParent: */ jsi::Value,
162
+ /* top: */ double,
163
+ /* left: */ double>
164
+ NativeDOM::getOffset(jsi::Runtime& rt, jsi::Value shadowNodeValue) {
165
+ auto shadowNode = shadowNodeFromValue(rt, shadowNodeValue);
166
+ auto currentRevision =
167
+ getCurrentShadowTreeRevision(rt, shadowNode->getSurfaceId());
168
+ if (currentRevision == nullptr) {
169
+ return {jsi::Value::undefined(), 0, 0};
170
+ }
171
+
172
+ auto domOffset = dom::getOffset(currentRevision, *shadowNode);
173
+
174
+ return std::tuple{
175
+ domOffset.offsetParent == nullptr
176
+ ? jsi::Value::undefined()
177
+ : domOffset.offsetParent->getInstanceHandle(rt),
178
+ domOffset.top,
179
+ domOffset.left};
180
+ }
181
+
182
+ std::tuple</* scrollLeft: */ double, /* scrollTop: */ double>
183
+ NativeDOM::getScrollPosition(jsi::Runtime& rt, jsi::Value shadowNodeValue) {
184
+ auto shadowNode = shadowNodeFromValue(rt, shadowNodeValue);
185
+ auto currentRevision =
186
+ getCurrentShadowTreeRevision(rt, shadowNode->getSurfaceId());
187
+ if (currentRevision == nullptr) {
188
+ return {0, 0};
189
+ }
190
+
191
+ auto domPoint = dom::getScrollPosition(currentRevision, *shadowNode);
192
+ return std::tuple{domPoint.x, domPoint.y};
193
+ }
194
+
195
+ std::tuple</* scrollWidth: */ int, /* scrollHeight */ int>
196
+ NativeDOM::getScrollSize(jsi::Runtime& rt, jsi::Value shadowNodeValue) {
197
+ auto shadowNode = shadowNodeFromValue(rt, shadowNodeValue);
198
+ auto currentRevision =
199
+ getCurrentShadowTreeRevision(rt, shadowNode->getSurfaceId());
200
+ if (currentRevision == nullptr) {
201
+ return {0, 0};
202
+ }
203
+
204
+ auto scrollSize = dom::getScrollSize(currentRevision, *shadowNode);
205
+ return std::tuple{scrollSize.width, scrollSize.height};
206
+ }
207
+
208
+ std::tuple</* width: */ int, /* height: */ int> NativeDOM::getInnerSize(
209
+ jsi::Runtime& rt,
210
+ jsi::Value shadowNodeValue) {
211
+ auto shadowNode = shadowNodeFromValue(rt, shadowNodeValue);
212
+ auto currentRevision =
213
+ getCurrentShadowTreeRevision(rt, shadowNode->getSurfaceId());
214
+ if (currentRevision == nullptr) {
215
+ return {0, 0};
216
+ }
217
+
218
+ auto innerSize = dom::getInnerSize(currentRevision, *shadowNode);
219
+ return std::tuple{innerSize.width, innerSize.height};
220
+ }
221
+
222
+ std::tuple<
223
+ /* topWidth: */ int,
224
+ /* rightWidth: */ int,
225
+ /* bottomWidth: */ int,
226
+ /* leftWidth: */ int>
227
+ NativeDOM::getBorderWidth(jsi::Runtime& rt, jsi::Value shadowNodeValue) {
228
+ auto shadowNode = shadowNodeFromValue(rt, shadowNodeValue);
229
+ auto currentRevision =
230
+ getCurrentShadowTreeRevision(rt, shadowNode->getSurfaceId());
231
+ if (currentRevision == nullptr) {
232
+ return {0, 0, 0, 0};
233
+ }
234
+
235
+ auto borderWidth = dom::getBorderWidth(currentRevision, *shadowNode);
236
+ return std::tuple{
237
+ borderWidth.top, borderWidth.right, borderWidth.bottom, borderWidth.left};
238
+ }
239
+
240
+ std::string NativeDOM::getTagName(
241
+ jsi::Runtime& rt,
242
+ jsi::Value shadowNodeValue) {
243
+ auto shadowNode = shadowNodeFromValue(rt, shadowNodeValue);
244
+ return dom::getTagName(*shadowNode);
245
+ }
246
+
247
+ #pragma mark - Pointer events
248
+
249
+ bool NativeDOM::hasPointerCapture(
250
+ jsi::Runtime& rt,
251
+ jsi::Value shadowNodeValue,
252
+ double pointerId) {
253
+ bool isCapturing = getPointerEventsProcessorFromRuntime(rt).hasPointerCapture(
254
+ // [Windows] Cast to fix https://github.com/microsoft/react-native-windows/issues/14251
255
+ static_cast<PointerIdentifier>(pointerId), shadowNodeFromValue(rt, shadowNodeValue).get());
256
+ return isCapturing;
257
+ }
258
+
259
+ void NativeDOM::setPointerCapture(
260
+ jsi::Runtime& rt,
261
+ jsi::Value shadowNodeValue,
262
+ double pointerId) {
263
+ getPointerEventsProcessorFromRuntime(rt).setPointerCapture(
264
+ // [Windows] Cast to fix https://github.com/microsoft/react-native-windows/issues/14251
265
+ static_cast<PointerIdentifier>(pointerId), shadowNodeFromValue(rt, shadowNodeValue));
266
+ }
267
+
268
+ void NativeDOM::releasePointerCapture(
269
+ jsi::Runtime& rt,
270
+ jsi::Value shadowNodeValue,
271
+ double pointerId) {
272
+ getPointerEventsProcessorFromRuntime(rt).releasePointerCapture(
273
+ // [Windows] Cast to fix https://github.com/microsoft/react-native-windows/issues/14251
274
+ static_cast<PointerIdentifier>(pointerId), shadowNodeFromValue(rt, shadowNodeValue).get());
275
+ }
276
+
277
+ #pragma mark - Legacy RN layout APIs
278
+
279
+ void NativeDOM::measure(
280
+ jsi::Runtime& rt,
281
+ jsi::Value shadowNodeValue,
282
+ jsi::Function callback) {
283
+ auto shadowNode = shadowNodeFromValue(rt, shadowNodeValue);
284
+ auto currentRevision =
285
+ getCurrentShadowTreeRevision(rt, shadowNode->getSurfaceId());
286
+ if (currentRevision == nullptr) {
287
+ callback.call(rt, {0, 0, 0, 0, 0, 0});
288
+ return;
289
+ }
290
+
291
+ auto measureRect = dom::measure(currentRevision, *shadowNode);
292
+
293
+ callback.call(
294
+ rt,
295
+ {jsi::Value{rt, measureRect.x},
296
+ jsi::Value{rt, measureRect.y},
297
+ jsi::Value{rt, measureRect.width},
298
+ jsi::Value{rt, measureRect.height},
299
+ jsi::Value{rt, measureRect.pageX},
300
+ jsi::Value{rt, measureRect.pageY}});
301
+ }
302
+
303
+ void NativeDOM::measureInWindow(
304
+ jsi::Runtime& rt,
305
+ jsi::Value shadowNodeValue,
306
+ jsi::Function callback) {
307
+ auto shadowNode = shadowNodeFromValue(rt, shadowNodeValue);
308
+ auto currentRevision =
309
+ getCurrentShadowTreeRevision(rt, shadowNode->getSurfaceId());
310
+ if (currentRevision == nullptr) {
311
+ callback.call(rt, {0, 0, 0, 0});
312
+ return;
313
+ }
314
+
315
+ auto rect = dom::measureInWindow(currentRevision, *shadowNode);
316
+ callback.call(
317
+ rt,
318
+ {jsi::Value{rt, rect.x},
319
+ jsi::Value{rt, rect.y},
320
+ jsi::Value{rt, rect.width},
321
+ jsi::Value{rt, rect.height}});
322
+ }
323
+
324
+ void NativeDOM::measureLayout(
325
+ jsi::Runtime& rt,
326
+ jsi::Value shadowNodeValue,
327
+ jsi::Value relativeToShadowNodeValue,
328
+ jsi::Function onFail,
329
+ jsi::Function onSuccess) {
330
+ auto shadowNode = shadowNodeFromValue(rt, shadowNodeValue);
331
+ auto relativeToShadowNode =
332
+ shadowNodeFromValue(rt, relativeToShadowNodeValue);
333
+ auto currentRevision =
334
+ getCurrentShadowTreeRevision(rt, shadowNode->getSurfaceId());
335
+ if (currentRevision == nullptr) {
336
+ onFail.call(rt);
337
+ return;
338
+ }
339
+
340
+ auto maybeRect =
341
+ dom::measureLayout(currentRevision, *shadowNode, *relativeToShadowNode);
342
+
343
+ if (!maybeRect) {
344
+ onFail.call(rt);
345
+ return;
346
+ }
347
+
348
+ auto rect = maybeRect.value();
349
+
350
+ onSuccess.call(
351
+ rt,
352
+ {jsi::Value{rt, rect.x},
353
+ jsi::Value{rt, rect.y},
354
+ jsi::Value{rt, rect.width},
355
+ jsi::Value{rt, rect.height}});
356
+ }
357
+
358
+ } // namespace facebook::react
@@ -559,7 +559,7 @@
559
559
  <!-- Uncomment this when we move to a newer JSI -->
560
560
  <!-- <CLCompile Include="$(ReactNativeDir)\ReactCommon\react\nativemodule\microtasks\NativeMicrotasks.cpp" /> -->
561
561
  <CLCompile Include="$(ReactNativeDir)\ReactCommon\react\nativemodule\featureflags\NativeReactNativeFeatureFlags.cpp" />
562
- <CLCompile Include="$(ReactNativeDir)\ReactCommon\react\nativemodule\dom\NativeDOM.cpp" DisableSpecificWarnings="4244;4715;%(DisableSpecificWarnings)" />
562
+ <CLCompile Include="$(ReactNativeDir)\ReactCommon\react\nativemodule\dom\NativeDOM.cpp" DisableSpecificWarnings="4715;%(DisableSpecificWarnings)" />
563
563
  <CLCompile Include="$(ReactNativeDir)\ReactCommon\react\nativemodule\idlecallbacks\NativeIdleCallbacks.cpp" />
564
564
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\react\renderer\attributedstring\AttributedString.cpp" />
565
565
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\react\renderer\attributedstring\AttributedStringBox.cpp" DisableSpecificWarnings="4715;%(DisableSpecificWarnings)" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-windows",
3
- "version": "0.77.0-preview.2",
3
+ "version": "0.77.0-preview.4",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,15 +26,15 @@
26
26
  "@react-native-community/cli": "15.0.0-alpha.2",
27
27
  "@react-native-community/cli-platform-android": "15.0.0-alpha.2",
28
28
  "@react-native-community/cli-platform-ios": "15.0.0-alpha.2",
29
- "@react-native-windows/cli": "0.77.0-preview.1",
29
+ "@react-native-windows/cli": "0.77.0-preview.2",
30
30
  "@react-native/assets": "1.0.0",
31
- "@react-native/assets-registry": "0.77.0-rc.4",
32
- "@react-native/codegen": "0.77.0-rc.4",
33
- "@react-native/community-cli-plugin": "0.77.0-rc.4",
34
- "@react-native/gradle-plugin": "0.77.0-rc.4",
35
- "@react-native/js-polyfills": "0.77.0-rc.4",
36
- "@react-native/normalize-colors": "0.77.0-rc.4",
37
- "@react-native/virtualized-lists": "0.77.0-rc.4",
31
+ "@react-native/assets-registry": "0.77.0-rc.6",
32
+ "@react-native/codegen": "0.77.0-rc.6",
33
+ "@react-native/community-cli-plugin": "0.77.0-rc.6",
34
+ "@react-native/gradle-plugin": "0.77.0-rc.6",
35
+ "@react-native/js-polyfills": "0.77.0-rc.6",
36
+ "@react-native/normalize-colors": "0.77.0-rc.6",
37
+ "@react-native/virtualized-lists": "0.77.0-rc.6",
38
38
  "abort-controller": "^3.0.0",
39
39
  "anser": "^1.4.9",
40
40
  "ansi-regex": "^5.0.0",
@@ -85,7 +85,7 @@
85
85
  "just-scripts": "^1.3.3",
86
86
  "prettier": "2.8.8",
87
87
  "react": "18.3.1",
88
- "react-native": "0.77.0-rc.4",
88
+ "react-native": "0.77.0-rc.6",
89
89
  "react-native-platform-override": "^1.9.49",
90
90
  "react-refresh": "^0.14.0",
91
91
  "typescript": "5.0.4"
@@ -93,7 +93,7 @@
93
93
  "peerDependencies": {
94
94
  "@types/react": "^18.2.6",
95
95
  "react": "^18.2.0",
96
- "react-native": "0.77.0-rc.4"
96
+ "react-native": "0.77.0-rc.6"
97
97
  },
98
98
  "beachball": {
99
99
  "defaultNpmTag": "preview",