react-native-windows 0.77.0-preview.1 → 0.77.0-preview.3

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.
@@ -106,17 +106,17 @@ export function allowTransformProp(prop: string): void {
106
106
  }
107
107
 
108
108
  export function isSupportedColorStyleProp(prop: string): boolean {
109
- return Object.hasOwn(SUPPORTED_COLOR_STYLES, prop);
109
+ return SUPPORTED_COLOR_STYLES.hasOwnProperty(prop);
110
110
  }
111
111
 
112
112
  export function isSupportedInterpolationParam(param: string): boolean {
113
- return Object.hasOwn(SUPPORTED_INTERPOLATION_PARAMS, param);
113
+ return SUPPORTED_INTERPOLATION_PARAMS.hasOwnProperty(param);
114
114
  }
115
115
 
116
116
  export function isSupportedStyleProp(prop: string): boolean {
117
- return Object.hasOwn(SUPPORTED_STYLES, prop);
117
+ return SUPPORTED_STYLES.hasOwnProperty(prop);
118
118
  }
119
119
 
120
120
  export function isSupportedTransformProp(prop: string): boolean {
121
- return Object.hasOwn(SUPPORTED_TRANSFORMS, prop);
121
+ return SUPPORTED_TRANSFORMS.hasOwnProperty(prop);
122
122
  }
@@ -165,7 +165,7 @@ export default class Animation {
165
165
  const callback = this.#onEnd;
166
166
  if (callback != null) {
167
167
  this.#onEnd = null;
168
- queueMicrotask(() => callback(result));
168
+ callback(result);
169
169
  }
170
170
  }
171
171
  }
@@ -37,7 +37,7 @@ function createAnimatedProps(
37
37
  const key = keys[ii];
38
38
  const value = inputProps[key];
39
39
 
40
- if (allowlist == null || Object.hasOwn(allowlist, key)) {
40
+ if (allowlist == null || hasOwn(allowlist, key)) {
41
41
  let node;
42
42
  if (key === 'style') {
43
43
  node = AnimatedStyle.from(value, allowlist?.style);
@@ -271,3 +271,11 @@ export default class AnimatedProps extends AnimatedNode {
271
271
  };
272
272
  }
273
273
  }
274
+
275
+ // Supported versions of JSC do not implement the newer Object.hasOwn. Remove
276
+ // this shim when they do.
277
+ // $FlowIgnore[method-unbinding]
278
+ const _hasOwnProp = Object.prototype.hasOwnProperty;
279
+ const hasOwn: (obj: $ReadOnly<{...}>, prop: string) => boolean =
280
+ // $FlowIgnore[method-unbinding]
281
+ Object.hasOwn ?? ((obj, prop) => _hasOwnProp.call(obj, prop));
@@ -35,7 +35,7 @@ function createAnimatedStyle(
35
35
  const key = keys[ii];
36
36
  const value = inputStyle[key];
37
37
 
38
- if (allowlist == null || Object.hasOwn(allowlist, key)) {
38
+ if (allowlist == null || hasOwn(allowlist, key)) {
39
39
  let node;
40
40
  if (value != null && key === 'transform') {
41
41
  node = ReactNativeFeatureFlags.shouldUseAnimatedObjectForTransform()
@@ -241,3 +241,11 @@ export default class AnimatedStyle extends AnimatedWithChildren {
241
241
  };
242
242
  }
243
243
  }
244
+
245
+ // Supported versions of JSC do not implement the newer Object.hasOwn. Remove
246
+ // this shim when they do.
247
+ // $FlowIgnore[method-unbinding]
248
+ const _hasOwnProp = Object.prototype.hasOwnProperty;
249
+ const hasOwn: (obj: $ReadOnly<{...}>, prop: string) => boolean =
250
+ // $FlowIgnore[method-unbinding]
251
+ Object.hasOwn ?? ((obj, prop) => _hasOwnProp.call(obj, prop));
@@ -17,7 +17,7 @@ const version: $ReadOnly<{
17
17
  major: 0,
18
18
  minor: 77,
19
19
  patch: 0,
20
- prerelease: 'rc.0',
20
+ prerelease: 'rc.6',
21
21
  };
22
22
 
23
23
  module.exports = {version};
@@ -28,6 +28,15 @@ type FormDataPart =
28
28
  ...
29
29
  };
30
30
 
31
+ /**
32
+ * Encode a FormData filename compliant with RFC 2183
33
+ *
34
+ * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition#directives
35
+ */
36
+ function encodeFilename(filename: string): string {
37
+ return encodeURIComponent(filename.replace(/\//g, '_'));
38
+ }
39
+
31
40
  /**
32
41
  * Polyfill for XMLHttpRequest2 FormData API, allowing multipart POST requests
33
42
  * with mixed data (string, native files) to be submitted via XMLHttpRequest.
@@ -82,9 +91,8 @@ class FormData {
82
91
  // content type (cf. web Blob interface.)
83
92
  if (typeof value === 'object' && !Array.isArray(value) && value) {
84
93
  if (typeof value.name === 'string') {
85
- headers['content-disposition'] += `; filename="${
86
- value.name
87
- }"; filename*=utf-8''${encodeURI(value.name)}`;
94
+ headers['content-disposition'] +=
95
+ `; filename="${encodeFilename(value.name)}"`;
88
96
  }
89
97
  if (typeof value.type === 'string') {
90
98
  headers['content-type'] = value.type;
@@ -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"
@@ -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.1</ReactNativeWindowsVersion>
13
+ <ReactNativeWindowsVersion>0.77.0-preview.3</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>77</ReactNativeWindowsMinor>
16
16
  <ReactNativeWindowsPatch>0</ReactNativeWindowsPatch>
17
17
  <ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
18
- <ReactNativeWindowsCommitId>feb40d59f360b84675288a1a317b4fae1d1259f4</ReactNativeWindowsCommitId>
18
+ <ReactNativeWindowsCommitId>7dfbce2ee69ca8bffc4e93d0018fa461fc229aaa</ReactNativeWindowsCommitId>
19
19
  </PropertyGroup>
20
20
  </Project>
@@ -66,6 +66,12 @@
66
66
  <PreprocessorDefinitions Condition="'$(UseV8)'=='true'">USE_V8;%(PreprocessorDefinitions)</PreprocessorDefinitions>
67
67
  <PreprocessorDefinitions Condition="'$(UseFabric)'=='true'">USE_FABRIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
68
68
  <PreprocessorDefinitions>JSI_VERSION=11;%(PreprocessorDefinitions)</PreprocessorDefinitions>
69
+ <!--
70
+ To address the crash on the first call to std::mutex::lock.
71
+ See: https://github.com/microsoft/STL/wiki/Changelog#vs-2022-1710
72
+ https://stackoverflow.com/questions/78598141/first-stdmutexlock-crashes-in-application-built-with-latest-visual-studio
73
+ -->
74
+ <PreprocessorDefinitions>_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR;%(PreprocessorDefinitions)</PreprocessorDefinitions>
69
75
  </ClCompile>
70
76
  </ItemDefinitionGroup>
71
77
 
@@ -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
@@ -235,47 +235,51 @@ std::string simpleBasename(const std::string& path) {
235
235
  */
236
236
  void ReactInstance::loadScript(
237
237
  std::unique_ptr<const JSBigString> script,
238
- const std::string& sourceURL) {
238
+ const std::string& sourceURL,
239
+ std::function<void(jsi::Runtime& runtime)>&& completion) {
239
240
  auto buffer = std::make_shared<BigStringBuffer>(std::move(script));
240
241
  std::string scriptName = simpleBasename(sourceURL);
241
242
 
242
- runtimeScheduler_->scheduleWork(
243
- [this,
244
- scriptName,
245
- sourceURL,
246
- buffer = std::move(buffer),
247
- weakBufferedRuntimeExecuter = std::weak_ptr<BufferedRuntimeExecutor>(
248
- bufferedRuntimeExecutor_)](jsi::Runtime& runtime) {
249
- SystraceSection s("ReactInstance::loadScript");
250
- bool hasLogger(ReactMarker::logTaggedMarkerBridgelessImpl);
251
- if (hasLogger) {
252
- ReactMarker::logTaggedMarkerBridgeless(
253
- ReactMarker::RUN_JS_BUNDLE_START, scriptName.c_str());
254
- }
243
+ runtimeScheduler_->scheduleWork([this,
244
+ scriptName,
245
+ sourceURL,
246
+ buffer = std::move(buffer),
247
+ weakBufferedRuntimeExecuter =
248
+ std::weak_ptr<BufferedRuntimeExecutor>(
249
+ bufferedRuntimeExecutor_),
250
+ completion](jsi::Runtime& runtime) {
251
+ SystraceSection s("ReactInstance::loadScript");
252
+ bool hasLogger(ReactMarker::logTaggedMarkerBridgelessImpl);
253
+ if (hasLogger) {
254
+ ReactMarker::logTaggedMarkerBridgeless(
255
+ ReactMarker::RUN_JS_BUNDLE_START, scriptName.c_str());
256
+ }
255
257
 
256
- runtime.evaluateJavaScript(buffer, sourceURL);
258
+ runtime.evaluateJavaScript(buffer, sourceURL);
257
259
 
258
- /**
259
- * TODO(T183610671): We need a safe/reliable way to enable the js
260
- * pipeline from javascript. Remove this after we figure that out, or
261
- * after we just remove the js pipeline.
262
- */
263
- if (!jsErrorHandler_->hasHandledFatalError()) {
264
- jsErrorHandler_->setRuntimeReady();
265
- }
260
+ /**
261
+ * TODO(T183610671): We need a safe/reliable way to enable the js
262
+ * pipeline from javascript. Remove this after we figure that out, or
263
+ * after we just remove the js pipeline.
264
+ */
265
+ if (!jsErrorHandler_->hasHandledFatalError()) {
266
+ jsErrorHandler_->setRuntimeReady();
267
+ }
266
268
 
267
- if (hasLogger) {
268
- ReactMarker::logTaggedMarkerBridgeless(
269
- ReactMarker::RUN_JS_BUNDLE_STOP, scriptName.c_str());
270
- ReactMarker::logMarkerBridgeless(
271
- ReactMarker::INIT_REACT_RUNTIME_STOP);
272
- ReactMarker::logMarkerBridgeless(ReactMarker::APP_STARTUP_STOP);
273
- }
274
- if (auto strongBufferedRuntimeExecuter =
275
- weakBufferedRuntimeExecuter.lock()) {
276
- strongBufferedRuntimeExecuter->flush();
277
- }
278
- });
269
+ if (hasLogger) {
270
+ ReactMarker::logTaggedMarkerBridgeless(
271
+ ReactMarker::RUN_JS_BUNDLE_STOP, scriptName.c_str());
272
+ ReactMarker::logMarkerBridgeless(ReactMarker::INIT_REACT_RUNTIME_STOP);
273
+ ReactMarker::logMarkerBridgeless(ReactMarker::APP_STARTUP_STOP);
274
+ }
275
+ if (auto strongBufferedRuntimeExecuter =
276
+ weakBufferedRuntimeExecuter.lock()) {
277
+ strongBufferedRuntimeExecuter->flush();
278
+ }
279
+ if (completion) {
280
+ completion(runtime);
281
+ }
282
+ });
279
283
  }
280
284
 
281
285
  /*
@@ -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.1",
3
+ "version": "0.77.0-preview.3",
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.0",
32
- "@react-native/codegen": "0.77.0-rc.0",
33
- "@react-native/community-cli-plugin": "0.77.0-rc.0",
34
- "@react-native/gradle-plugin": "0.77.0-rc.0",
35
- "@react-native/js-polyfills": "0.77.0-rc.0",
36
- "@react-native/normalize-colors": "0.77.0-rc.0",
37
- "@react-native/virtualized-lists": "0.77.0-rc.0",
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.0",
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.0"
96
+ "react-native": "0.77.0-rc.6"
97
97
  },
98
98
  "beachball": {
99
99
  "defaultNpmTag": "preview",