react-native-windows 0.69.0-preview.5 → 0.69.0

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.
@@ -13,5 +13,5 @@ exports.version = {
13
13
  major: 0,
14
14
  minor: 69,
15
15
  patch: 0,
16
- prerelease: 'rc.3',
16
+ prerelease: null,
17
17
  };
@@ -141,12 +141,12 @@ namespace Microsoft.ReactNative
141
141
  IReactSettingsSnapshot SettingsSnapshot { get; };
142
142
 
143
143
  DOC_STRING(
144
- "Gets @IReactPropertyBag shared with the @ReactInstanceSettings.Properties.\n"
144
+ "Gets the @IReactPropertyBag shared with the @ReactInstanceSettings.Properties.\n"
145
145
  "It can be used to share values and state between components and the applications.")
146
146
  IReactPropertyBag Properties { get; };
147
147
 
148
148
  DOC_STRING(
149
- "Gets @IReactNotificationService shared with the @ReactInstanceSettings.Notifications.\n"
149
+ "Gets the @IReactNotificationService shared with the @ReactInstanceSettings.Notifications.\n"
150
150
  "It can be used to send notifications events between components and the application.\n"
151
151
  "All notification subscriptions added to the @IReactContext.Notifications are automatically removed "
152
152
  "after the @IReactContext is destroyed.\n"
@@ -91,8 +91,8 @@ namespace Microsoft.ReactNative
91
91
 
92
92
  [webhosthidden]
93
93
  DOC_STRING(
94
- "Enables view managers to track when views are"
95
- "removed from their shadow trees. "
94
+ "Enables view managers to track when views are "
95
+ "removed from the shadow tree. "
96
96
  )
97
97
  interface IViewManagerWithDropViewInstance {
98
98
  DOC_STRING(
@@ -182,10 +182,10 @@ namespace Microsoft.ReactNative
182
182
  "This can be an `ms-appx://` or `ms-appdata://` URI (if the app is UWP or packaged using MSIX), "
183
183
  "a filesystem path, or a URI pointing at an embedded resource.\n"
184
184
  "Examples:\n\n"
185
- "- `ms-appx:///Bundle` - locates the bundle in the MSIX package. See [URI schemes](https://docs.microsoft.com/windows/uwp/app-resources/uri-schemes) for other UWP/MSIX valid URI formats."
186
- "- `C:\\foo\\bar` - locates the bundle in the local filesystem. Note [UWP app file access permissions](https://docs.microsoft.com/windows/uwp/files/file-access-permissions)."
187
- "- `resource://moduleName` - locates the bundle as an embedded RCDATA resource in moduleName. Specify the resource ID in @.JavaScriptBundleFile."
188
- "- `resource://` - locates the bundle as an embedded RCDATA resource in the running process's module. Specify the resource ID in @.JavaScriptBundleFile."
185
+ "- `ms-appx:///Bundle` - locates the bundle in the MSIX package. See [URI schemes](https://docs.microsoft.com/windows/uwp/app-resources/uri-schemes) for other UWP/MSIX valid URI formats.\n"
186
+ "- `C:\\foo\\bar` - locates the bundle in the local filesystem. Note [UWP app file access permissions](https://docs.microsoft.com/windows/uwp/files/file-access-permissions).\n"
187
+ "- `resource://moduleName` - locates the bundle as an embedded RCDATA resource in moduleName. Specify the resource ID in @.JavaScriptBundleFile.\n"
188
+ "- `resource://` - locates the bundle as an embedded RCDATA resource in the running process's module. Specify the resource ID in @.JavaScriptBundleFile.\n"
189
189
  )
190
190
  DOC_DEFAULT("ms-appx:///Bundle/")
191
191
  String BundleRootPath { get; set; };
@@ -115,6 +115,12 @@ inline float ToRadians(const winrt::Microsoft::ReactNative::JSValue &value) {
115
115
  return static_cast<float>(num); // assume suffix is "rad"
116
116
  }
117
117
 
118
+ static void MultiplyInto(
119
+ winrt::Windows::Foundation::Numerics::float4x4 &m,
120
+ winrt::Windows::Foundation::Numerics::float4x4 o) {
121
+ m = o * m;
122
+ }
123
+
118
124
  void FrameworkElementViewManager::GetNativeProps(const winrt::Microsoft::ReactNative::IJSValueWriter &writer) const {
119
125
  Super::GetNativeProps(writer);
120
126
 
@@ -181,52 +187,60 @@ bool FrameworkElementViewManager::UpdateProperty(
181
187
  innerMatrix.m42 = static_cast<float>(innerValue[13].AsDouble());
182
188
  innerMatrix.m43 = static_cast<float>(innerValue[14].AsDouble());
183
189
  innerMatrix.m44 = static_cast<float>(innerValue[15].AsDouble());
184
- transformMatrix = transformMatrix * innerMatrix;
190
+ MultiplyInto(transformMatrix, innerMatrix);
185
191
  } else if (transformType == "perspective") {
186
192
  auto innerMatrix = winrt::Windows::Foundation::Numerics::float4x4::identity();
187
193
  innerMatrix.m34 = -1 / innerValue.AsSingle();
188
- transformMatrix = transformMatrix * innerMatrix;
194
+ MultiplyInto(transformMatrix, innerMatrix);
189
195
  } else if (transformType == "rotateX") {
190
- transformMatrix = transformMatrix *
191
- winrt::Windows::Foundation::Numerics::make_float4x4_rotation_x(ToRadians(innerValue));
196
+ MultiplyInto(
197
+ transformMatrix,
198
+ winrt::Windows::Foundation::Numerics::make_float4x4_rotation_x(ToRadians(innerValue)));
192
199
  } else if (transformType == "rotateY") {
193
- transformMatrix = transformMatrix *
194
- winrt::Windows::Foundation::Numerics::make_float4x4_rotation_y(ToRadians(innerValue));
200
+ MultiplyInto(
201
+ transformMatrix,
202
+ winrt::Windows::Foundation::Numerics::make_float4x4_rotation_y(ToRadians(innerValue)));
195
203
  } else if (transformType == "rotate" || transformType == "rotateZ") {
196
- transformMatrix = transformMatrix *
197
- winrt::Windows::Foundation::Numerics::make_float4x4_rotation_z(ToRadians(innerValue));
204
+ MultiplyInto(
205
+ transformMatrix,
206
+ winrt::Windows::Foundation::Numerics::make_float4x4_rotation_z(ToRadians(innerValue)));
198
207
  } else if (transformType == "scale") {
199
- transformMatrix = transformMatrix *
208
+ MultiplyInto(
209
+ transformMatrix,
200
210
  winrt::Windows::Foundation::Numerics::make_float4x4_scale(
201
- innerValue.AsSingle(), innerValue.AsSingle(), 1);
211
+ innerValue.AsSingle(), innerValue.AsSingle(), 1));
202
212
  } else if (transformType == "scaleX") {
203
- transformMatrix = transformMatrix *
204
- winrt::Windows::Foundation::Numerics::make_float4x4_scale(innerValue.AsSingle(), 1, 1);
213
+ MultiplyInto(
214
+ transformMatrix,
215
+ winrt::Windows::Foundation::Numerics::make_float4x4_scale(innerValue.AsSingle(), 1, 1));
205
216
  } else if (transformType == "scaleY") {
206
- transformMatrix = transformMatrix *
207
- winrt::Windows::Foundation::Numerics::make_float4x4_scale(1, innerValue.AsSingle(), 1);
217
+ MultiplyInto(
218
+ transformMatrix,
219
+ winrt::Windows::Foundation::Numerics::make_float4x4_scale(1, innerValue.AsSingle(), 1));
208
220
  } else if (transformType == "translate") {
209
221
  auto &params = innerValue.AsArray();
210
- transformMatrix =
211
- transformMatrix *
222
+ MultiplyInto(
223
+ transformMatrix,
212
224
  winrt::Windows::Foundation::Numerics::make_float4x4_translation(
213
- params[0].AsSingle(), params[1].AsSingle(), params.size() > 2 ? params[2].AsSingle() : 0.f);
225
+ params[0].AsSingle(), params[1].AsSingle(), params.size() > 2 ? params[2].AsSingle() : 0.f));
214
226
  } else if (transformType == "translateX") {
215
- transformMatrix = transformMatrix *
216
- winrt::Windows::Foundation::Numerics::make_float4x4_translation(innerValue.AsSingle(), 0.f, 0.f);
227
+ MultiplyInto(
228
+ transformMatrix,
229
+ winrt::Windows::Foundation::Numerics::make_float4x4_translation(innerValue.AsSingle(), 0.f, 0.f));
217
230
  } else if (transformType == "translateY") {
218
- transformMatrix = transformMatrix *
219
- winrt::Windows::Foundation::Numerics::make_float4x4_translation(0.f, innerValue.AsSingle(), 0.f);
231
+ MultiplyInto(
232
+ transformMatrix,
233
+ winrt::Windows::Foundation::Numerics::make_float4x4_translation(0.f, innerValue.AsSingle(), 0.f));
220
234
  } else if (transformType == "skewX") {
221
- transformMatrix =
222
- transformMatrix *
235
+ MultiplyInto(
236
+ transformMatrix,
223
237
  winrt::Windows::Foundation::Numerics::float4x4(
224
- winrt::Windows::Foundation::Numerics::make_float3x2_skew(innerValue.AsSingle(), 0.f));
238
+ winrt::Windows::Foundation::Numerics::make_float3x2_skew(innerValue.AsSingle(), 0.f)));
225
239
  } else if (transformType == "skewY") {
226
- transformMatrix =
227
- transformMatrix *
240
+ MultiplyInto(
241
+ transformMatrix,
228
242
  winrt::Windows::Foundation::Numerics::float4x4(
229
- winrt::Windows::Foundation::Numerics::make_float3x2_skew(0.f, innerValue.AsSingle()));
243
+ winrt::Windows::Foundation::Numerics::make_float3x2_skew(0.f, innerValue.AsSingle())));
230
244
  }
231
245
  }
232
246
  }
@@ -10,16 +10,19 @@ extern "C" IMAGE_DOS_HEADER __ImageBase;
10
10
 
11
11
  namespace winrt::Microsoft::ReactNative {
12
12
 
13
- // Get JSI Runtime from the current JS dispatcher thread.
14
- // If it is not found, then create it and store it in the context.Properties().
15
- // Make sure that the JSI runtime holder is removed when the instance is unloaded.
16
- facebook::jsi::Runtime &GetOrCreateContextRuntime(ReactContext const &context) noexcept {
13
+ // Try to get JSI Runtime for the current JS dispatcher thread.
14
+ // If it is not found, then create it based on context JSI runtime and store it in the context.Properties().
15
+ // The function returns nullptr if the current context does not have JSI runtime.
16
+ // It makes sure that the JSI runtime holder is removed when the instance is unloaded.
17
+ facebook::jsi::Runtime *TryGetOrCreateContextRuntime(ReactContext const &context) noexcept {
17
18
  ReactDispatcher jsDispatcher = context.JSDispatcher();
18
19
  VerifyElseCrashSz(jsDispatcher.HasThreadAccess(), "Must be in JS thread");
19
20
 
20
21
  // The JSI runtime is not available if we do Web debugging when JS is running in web browser.
21
22
  JsiRuntime abiJsiRuntime = context.Handle().JSRuntime().as<JsiRuntime>();
22
- VerifyElseCrashSz(abiJsiRuntime, "JSI runtime is not available");
23
+ if (!abiJsiRuntime) {
24
+ return nullptr;
25
+ }
23
26
 
24
27
  // See if the JSI runtime was previously created.
25
28
  JsiAbiRuntime *runtime = JsiAbiRuntime::GetFromJsiRuntime(abiJsiRuntime);
@@ -51,6 +54,15 @@ facebook::jsi::Runtime &GetOrCreateContextRuntime(ReactContext const &context) n
51
54
  });
52
55
  }
53
56
 
57
+ return runtime;
58
+ }
59
+
60
+ // Calls TryGetOrCreateContextRuntime to get JSI runtime.
61
+ // It crashes when TryGetOrCreateContextRuntime returns null.
62
+ // Note: deprecated in favor of TryGetOrCreateContextRuntime.
63
+ [[deprecated]] facebook::jsi::Runtime &GetOrCreateContextRuntime(ReactContext const &context) noexcept {
64
+ facebook::jsi::Runtime *runtime = TryGetOrCreateContextRuntime(context);
65
+ VerifyElseCrashSz(runtime, "JSI runtime is not available");
54
66
  return *runtime;
55
67
  }
56
68
 
@@ -7,26 +7,55 @@
7
7
 
8
8
  #include "../ReactContext.h"
9
9
  #include "JsiAbiApi.h"
10
+ #include "ReactPromise.h"
10
11
 
11
12
  namespace winrt::Microsoft::ReactNative {
12
13
 
13
- // Get JSI Runtime from the current JS dispatcher thread.
14
- // If it is not found, then create it and store it in the context.Properties().
15
- // Make sure that the JSI runtime holder is removed when the instance is unloaded.
16
- facebook::jsi::Runtime &GetOrCreateContextRuntime(ReactContext const &context) noexcept;
14
+ // Try to get JSI Runtime for the current JS dispatcher thread.
15
+ // If it is not found, then create it based on context JSI runtime and store it in the context.Properties().
16
+ // The function returns nullptr if the current context does not have JSI runtime.
17
+ // It makes sure that the JSI runtime holder is removed when the instance is unloaded.
18
+ facebook::jsi::Runtime *TryGetOrCreateContextRuntime(ReactContext const &context) noexcept;
19
+
20
+ // Calls TryGetOrCreateContextRuntime to get JSI runtime.
21
+ // It crashes when TryGetOrCreateContextRuntime returns null.
22
+ // Note: deprecated in favor of TryGetOrCreateContextRuntime.
23
+ [[deprecated]] facebook::jsi::Runtime &GetOrCreateContextRuntime(ReactContext const &context) noexcept;
17
24
 
18
25
  // Call provided lambda with the facebook::jsi::Runtime& parameter.
19
26
  // For example: ExecuteJsi(context, [](facebook::jsi::Runtime& runtime){...})
20
27
  // The code is executed synchronously if it is already in JSDispatcher, or asynchronously otherwise.
21
28
  template <class TCodeWithRuntime>
22
- void ExecuteJsi(ReactContext const &context, TCodeWithRuntime const &code) {
29
+ void ExecuteJsi(ReactContext const &context, TCodeWithRuntime const &code, ReactPromise<void> *callStatus = nullptr) {
23
30
  ReactDispatcher jsDispatcher = context.JSDispatcher();
31
+ auto callCode = [](ReactContext const &context, TCodeWithRuntime const &code, ReactPromise<void> *callStatus) {
32
+ facebook::jsi::Runtime *runtime = TryGetOrCreateContextRuntime(context);
33
+ if (runtime) {
34
+ code(*runtime);
35
+ }
36
+
37
+ // Report status of the call
38
+ if (callStatus) {
39
+ if (runtime) {
40
+ callStatus->Resolve();
41
+ } else {
42
+ callStatus->Reject("No JSI runtime");
43
+ }
44
+ }
45
+ };
46
+
24
47
  if (jsDispatcher.HasThreadAccess()) {
25
48
  // Execute immediately if we are in JS thread.
26
- code(GetOrCreateContextRuntime(context));
49
+ callCode(context, code, callStatus);
27
50
  } else {
28
51
  // Otherwise, schedule work in JS thread.
29
- jsDispatcher.Post([context, code]() noexcept { code(GetOrCreateContextRuntime(context)); });
52
+ jsDispatcher.Post([callCode,
53
+ context,
54
+ code,
55
+ callStatus = callStatus ? std::make_unique<ReactPromise<void>>(*callStatus)
56
+ : std::unique_ptr<ReactPromise<void>>(nullptr)]() noexcept {
57
+ callCode(context, code, callStatus.get());
58
+ });
30
59
  }
31
60
  }
32
61
 
@@ -287,7 +287,7 @@ inline JSValueArgWriter MakeJSValueWriter(T &&argWriter) noexcept {
287
287
 
288
288
  template <class... TArgs>
289
289
  inline JSValueArgWriter MakeJSValueWriter(TArgs &&...args) noexcept {
290
- return [&args...](IJSValueWriter const &[[maybe_unused]] writer) noexcept { (WriteValue(writer, args), ...); };
290
+ return [&args...]([[maybe_unused]] IJSValueWriter const &writer) noexcept { (WriteValue(writer, args), ...); };
291
291
  }
292
292
 
293
293
  } // namespace winrt::Microsoft::ReactNative
@@ -27,7 +27,7 @@
27
27
  <ClCompile Include="$(MSBuildThisFileDirectory)JSI\NodeApiJsiRuntime.cpp">
28
28
  <Filter>JSI</Filter>
29
29
  </ClCompile>
30
- <ClCompile Include="$(TurboModule_SourcePath)\..\..\bridging\LongLivedObject.cpp" />
30
+ <ClCompile Include="$(Bridging_SourcePath)\LongLivedObject.cpp" />
31
31
  </ItemGroup>
32
32
  <ItemGroup>
33
33
  <ClInclude Include="$(MSBuildThisFileDirectory)Crash.h" />
@@ -166,4 +166,4 @@
166
166
  <ItemGroup>
167
167
  <None Include="$(MSBuildThisFileDirectory)README.md" />
168
168
  </ItemGroup>
169
- </Project>
169
+ </Project>
@@ -6,7 +6,6 @@
6
6
 
7
7
  #include "pch.h"
8
8
  #include "ReactPromise.h"
9
- #include "JSValueWriter.h"
10
9
 
11
10
  namespace winrt::Microsoft::ReactNative {
12
11
 
@@ -105,6 +104,27 @@ bool ReactPromiseBase::TrySetState(State newState) const noexcept {
105
104
  return false;
106
105
  }
107
106
 
107
+ /*static*/ MethodResultCallback ReactPromiseBase::GetRejectResultCallback(
108
+ std::function<void(ReactError const &)> const &reject) noexcept {
109
+ return [reject](IJSValueWriter const &outputWriter) noexcept {
110
+ winrt::com_ptr<JSValueTreeWriter> writer = outputWriter.as<JSValueTreeWriter>();
111
+ JSValue jsValue = writer->TakeValue();
112
+ ReactError err{};
113
+ err.Code = jsValue.AsArray()[0].AsObject()[ErrorMapKeyCode].AsString();
114
+ err.Message = jsValue.AsArray()[0].AsObject()[ErrorMapKeyMessage].AsString();
115
+ err.UserInfo = jsValue.AsArray()[0].AsObject()[ErrorMapKeyUserInfo].AsObject().Copy();
116
+ reject(err);
117
+ };
118
+ }
119
+
120
+ ReactPromise<void>::ReactPromise(
121
+ std::function<void()> const &resolve,
122
+ std::function<void(ReactError const &)> const &reject) noexcept
123
+ : ReactPromiseBase(
124
+ winrt::make<JSValueTreeWriter>(),
125
+ [resolve](IJSValueWriter const & /*outputWriter*/) noexcept { resolve(); },
126
+ GetRejectResultCallback(reject)) {}
127
+
108
128
  // Successfully resolve the ReactPromise<void>.
109
129
  void ReactPromise<void>::Resolve() const noexcept {
110
130
  if (TrySetState(State::Resolved) && m_resolve) {
@@ -5,6 +5,11 @@
5
5
  // vnext/Microsoft.ReactNative.Cxx/README.md
6
6
 
7
7
  #pragma once
8
+ #include <functional>
9
+ #include "JSValueReader.h"
10
+ #include "JSValueTreeReader.h"
11
+ #include "JSValueTreeWriter.h"
12
+ #include "JSValueWriter.h"
8
13
  #include "ReactError.h"
9
14
  #include "winrt/Microsoft.ReactNative.h"
10
15
 
@@ -35,6 +40,7 @@ struct ReactPromiseBase {
35
40
 
36
41
  protected:
37
42
  bool TrySetState(State newState) const noexcept;
43
+ static MethodResultCallback GetRejectResultCallback(std::function<void(ReactError const &)> const &reject) noexcept;
38
44
 
39
45
  protected:
40
46
  const std::shared_ptr<std::atomic<State>> m_state;
@@ -47,6 +53,10 @@ template <class T>
47
53
  struct ReactPromise : ReactPromiseBase {
48
54
  using ReactPromiseBase::ReactPromiseBase;
49
55
 
56
+ ReactPromise(
57
+ std::function<void(T const &)> const &resolve,
58
+ std::function<void(ReactError const &)> const &reject) noexcept;
59
+
50
60
  // Successfully resolve the IReactPromise with an optional value.
51
61
  void Resolve(T const &value) const noexcept;
52
62
  };
@@ -55,10 +65,27 @@ template <>
55
65
  struct ReactPromise<void> : ReactPromiseBase {
56
66
  using ReactPromiseBase::ReactPromiseBase;
57
67
 
68
+ ReactPromise(std::function<void()> const &resolve, std::function<void(ReactError const &)> const &reject) noexcept;
69
+
58
70
  // Successfully resolve the IReactPromise with an optional value.
59
71
  void Resolve() const noexcept;
60
72
  };
61
73
 
74
+ template <class T>
75
+ ReactPromise<T>::ReactPromise(
76
+ std::function<void(T const &)> const &resolve,
77
+ std::function<void(ReactError const &)> const &reject) noexcept
78
+ : ReactPromiseBase(
79
+ winrt::make<JSValueTreeWriter>(),
80
+ [resolve](IJSValueWriter const &outputWriter) noexcept {
81
+ winrt::com_ptr<JSValueTreeWriter> writer = outputWriter.as<JSValueTreeWriter>();
82
+ auto reader = winrt::make<JSValueTreeReader>(writer->TakeValue());
83
+ T result{};
84
+ ReadArgs(reader, result);
85
+ resolve(result);
86
+ },
87
+ GetRejectResultCallback(reject)) {}
88
+
62
89
  // Successfully resolve the ReactPromise with an optional value.
63
90
  template <class T>
64
91
  void ReactPromise<T>::Resolve(T const &value) const noexcept {
@@ -23,7 +23,7 @@ void AddTurboModuleProvider(IReactPackageBuilder const &packageBuilder, std::wst
23
23
  IJsiHostObject abiTurboModule{nullptr};
24
24
  // We expect the initializer to be called immediately for TurboModules
25
25
  moduleBuilder.AddInitializer([&abiTurboModule](IReactContext const &context) mutable {
26
- GetOrCreateContextRuntime(ReactContext{context}); // Ensure the JSI runtime is created.
26
+ TryGetOrCreateContextRuntime(ReactContext{context}); // Ensure the JSI runtime is created.
27
27
  auto callInvoker = MakeAbiCallInvoker(context.JSDispatcher());
28
28
  auto turboModule = std::make_shared<TTurboModule>(callInvoker);
29
29
  abiTurboModule = winrt::make<JsiHostObjectWrapper>(std::move(turboModule));
@@ -24,11 +24,6 @@
24
24
  "Microsoft.SourceLink.Common": "1.0.0"
25
25
  }
26
26
  },
27
- "boost": {
28
- "type": "Transitive",
29
- "resolved": "1.76.0",
30
- "contentHash": "p+w3YvNdXL8Cu9Fzrmexssu0tZbWxuf6ywsQqHjDlKFE5ojXHof1HIyMC3zDLfLnh80dIeFcEUAuR2Asg/XHRA=="
31
- },
32
27
  "Microsoft.Build.Tasks.Git": {
33
28
  "type": "Transitive",
34
29
  "resolved": "1.0.0",
@@ -65,34 +60,14 @@
65
60
  "resolved": "1.0.0",
66
61
  "contentHash": "G8DuQY8/DK5NN+3jm5wcMcd9QYD90UV7MiLmdljSJixi3U/vNaeBKmmXUqI4DJCOeWizIUEh4ALhSt58mR+5eg=="
67
62
  },
68
- "Microsoft.UI.Xaml": {
69
- "type": "Transitive",
70
- "resolved": "2.7.0",
71
- "contentHash": "dB4im13tfmMgL/V3Ei+3kD2rUF+/lTxAmR4gjJ45l577eljHfdo/KUrxpq/3I1Vp6e5GCDG1evDaEGuDxypLMg=="
72
- },
73
- "Microsoft.Windows.CppWinRT": {
74
- "type": "Transitive",
75
- "resolved": "2.0.211028.7",
76
- "contentHash": "JBGI0c3WLoU6aYJRy9Qo0MLDQfObEp+d4nrhR95iyzf7+HOgjRunHDp/6eGFREd7xq3OI1mll9ecJrMfzBvlyg=="
77
- },
78
- "Microsoft.Windows.SDK.BuildTools": {
79
- "type": "Transitive",
80
- "resolved": "10.0.22000.194",
81
- "contentHash": "4L0P3zqut466SIqT3VBeLTNUQTxCBDOrTRymRuROCRJKazcK7ibLz9yAO1nKWRt50ttCj39oAa2Iuz9ZTDmLlg=="
82
- },
83
63
  "NETStandard.Library": {
84
64
  "type": "Transitive",
85
65
  "resolved": "2.0.3",
86
- "contentHash": "548M6mnBSJWxsIlkQHfbzoYxpiYFXZZSL00p4GHYv8PkiqFBnnT68mW5mGEsA/ch9fDO9GkPgkFQpWiXZN7mAQ==",
66
+ "contentHash": "st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==",
87
67
  "dependencies": {
88
68
  "Microsoft.NETCore.Platforms": "1.1.0"
89
69
  }
90
70
  },
91
- "ReactNative.Hermes.Windows": {
92
- "type": "Transitive",
93
- "resolved": "0.11.0-ms.6",
94
- "contentHash": "WAVLsSZBV4p/3hNC3W67su7xu3f/ZMSKxu0ON7g2GaKRbkJmH0Qyif1IlzcJwtvR48kuOdfgPu7Bgtz3AY+gqg=="
95
- },
96
71
  "runtime.win10-arm.Microsoft.Net.Native.Compiler": {
97
72
  "type": "Transitive",
98
73
  "resolved": "2.2.7-rel-27913-00",
@@ -160,38 +135,8 @@
160
135
  "resolved": "2.2.9",
161
136
  "contentHash": "qF6RRZKaflI+LR1YODNyWYjq5YoX8IJ2wx5y8O+AW2xO+1t/Q6Mm+jQ38zJbWnmXbrcOqUYofn7Y3/KC6lTLBQ=="
162
137
  },
163
- "common": {
164
- "type": "Project"
165
- },
166
- "fmt": {
167
- "type": "Project"
168
- },
169
- "folly": {
170
- "type": "Project",
171
- "dependencies": {
172
- "boost": "1.76.0",
173
- "fmt": "1.0.0"
174
- }
175
- },
176
138
  "microsoft.reactnative": {
177
- "type": "Project",
178
- "dependencies": {
179
- "Common": "1.0.0",
180
- "Folly": "1.0.0",
181
- "Microsoft.UI.Xaml": "2.7.0",
182
- "Microsoft.Windows.CppWinRT": "2.0.211028.7",
183
- "Microsoft.Windows.SDK.BuildTools": "10.0.22000.194",
184
- "ReactCommon": "1.0.0",
185
- "ReactNative.Hermes.Windows": "0.11.0-ms.6",
186
- "boost": "1.76.0"
187
- }
188
- },
189
- "reactcommon": {
190
- "type": "Project",
191
- "dependencies": {
192
- "Folly": "1.0.0",
193
- "boost": "1.76.0"
194
- }
139
+ "type": "Project"
195
140
  }
196
141
  },
197
142
  "UAP,Version=v10.0.16299/win10-arm": {
@@ -10,7 +10,7 @@
10
10
  -->
11
11
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
12
12
  <PropertyGroup>
13
- <ReactNativeWindowsVersion>0.69.0-preview.5</ReactNativeWindowsVersion>
13
+ <ReactNativeWindowsVersion>0.69.0</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>69</ReactNativeWindowsMinor>
16
16
  <ReactNativeWindowsPatch>0</ReactNativeWindowsPatch>
@@ -8,7 +8,7 @@
8
8
  <!-- Enabling this will (1) Include hermes glues in the Microsoft.ReactNative binaries AND (2) Make hermes the default engine -->
9
9
  <UseHermes Condition="'$(UseHermes)' == ''">false</UseHermes>
10
10
  <!-- This will be true if (1) the client want to use hermes by setting UseHermes to true OR (2) We are building for UWP where dynamic switching is enabled -->
11
- <HermesVersion Condition="'$(HermesVersion)' == ''">0.11.0-ms.6</HermesVersion>
11
+ <HermesVersion Condition="'$(HermesVersion)' == ''">0.12.1</HermesVersion>
12
12
  <HermesPackage Condition="'$(HermesPackage)' == '' And Exists('$(PkgReactNative_Hermes_Windows)')">$(PkgReactNative_Hermes_Windows)</HermesPackage>
13
13
  <HermesPackage Condition="'$(HermesPackage)' == ''">$(NuGetPackageRoot)\ReactNative.Hermes.Windows\$(HermesVersion)</HermesPackage>
14
14
  <EnableHermesInspectorInReleaseFlavor Condition="'$(EnableHermesInspectorInReleaseFlavor)' == ''">false</EnableHermesInspectorInReleaseFlavor>
@@ -72,10 +72,6 @@
72
72
  <DisableSpecificWarnings>4715;4251;4800;4804;4305;4722;%(DisableSpecificWarnings)</DisableSpecificWarnings>
73
73
  <PreprocessToFile>false</PreprocessToFile>
74
74
  <ForcedIncludeFiles>pch.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
75
- <!--
76
- Using Strict FloatingPointModel on x64 to workaround a compiler issue, See https://github.com/microsoft/react-native-windows/issues/4122
77
- -->
78
- <FloatingPointModel Condition="'$(Platform)' == 'x64'">Strict</FloatingPointModel>
79
75
  </ClCompile>
80
76
  <Link>
81
77
  <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
@@ -0,0 +1,204 @@
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
+ #pragma once
9
+
10
+ #ifdef __cplusplus
11
+
12
+ #ifdef __cpp_lib_bit_cast
13
+ #include <bit>
14
+ #endif
15
+ #include "YGValue.h"
16
+ #include "YGMacros.h"
17
+ #include <cmath>
18
+ #include <cstdint>
19
+ #include <limits>
20
+
21
+ static_assert(
22
+ std::numeric_limits<float>::is_iec559,
23
+ "facebook::yoga::detail::CompactValue only works with IEEE754 floats");
24
+
25
+ #ifdef YOGA_COMPACT_VALUE_TEST
26
+ #define VISIBLE_FOR_TESTING public:
27
+ #else
28
+ #define VISIBLE_FOR_TESTING private:
29
+ #endif
30
+
31
+ namespace facebook {
32
+ namespace yoga {
33
+ namespace detail {
34
+
35
+ // This class stores YGValue in 32 bits.
36
+ // - The value does not matter for Undefined and Auto. NaNs are used for their
37
+ // representation.
38
+ // - To differentiate between Point and Percent, one exponent bit is used.
39
+ // Supported the range [0x40, 0xbf] (0xbf is inclusive for point, but
40
+ // exclusive for percent).
41
+ // - Value ranges:
42
+ // points: 1.08420217e-19f to 36893485948395847680
43
+ // 0x00000000 0x3fffffff
44
+ // percent: 1.08420217e-19f to 18446742974197923840
45
+ // 0x40000000 0x7f7fffff
46
+ // - Zero is supported, negative zero is not
47
+ // - values outside of the representable range are clamped
48
+ class YOGA_EXPORT CompactValue {
49
+ friend constexpr bool operator==(CompactValue, CompactValue) noexcept;
50
+
51
+ public:
52
+ static constexpr auto LOWER_BOUND = 1.08420217e-19f;
53
+ static constexpr auto UPPER_BOUND_POINT = 36893485948395847680.0f;
54
+ static constexpr auto UPPER_BOUND_PERCENT = 18446742974197923840.0f;
55
+
56
+ template <YGUnit Unit>
57
+ static CompactValue of(float value) noexcept {
58
+ if (value == 0.0f || (value < LOWER_BOUND && value > -LOWER_BOUND)) {
59
+ constexpr auto zero =
60
+ Unit == YGUnitPercent ? ZERO_BITS_PERCENT : ZERO_BITS_POINT;
61
+ return {zero};
62
+ }
63
+
64
+ constexpr auto upperBound = Unit == YGUnitPercent ? UPPER_BOUND_PERCENT : UPPER_BOUND_POINT;
65
+ if (value > upperBound || value < -upperBound) {
66
+ value = copysignf(upperBound, value);
67
+ }
68
+
69
+ uint32_t unitBit = Unit == YGUnitPercent ? PERCENT_BIT : 0;
70
+ auto data = asU32(value);
71
+ data -= BIAS;
72
+ data |= unitBit;
73
+ return {data};
74
+ }
75
+
76
+ template <YGUnit Unit>
77
+ static CompactValue ofMaybe(float value) noexcept {
78
+ return std::isnan(value) || std::isinf(value) ? ofUndefined() : of<Unit>(value);
79
+ }
80
+
81
+ static constexpr CompactValue ofZero() noexcept {
82
+ return CompactValue{ZERO_BITS_POINT};
83
+ }
84
+
85
+ static constexpr CompactValue ofUndefined() noexcept {
86
+ return CompactValue{};
87
+ }
88
+
89
+ static constexpr CompactValue ofAuto() noexcept {
90
+ return CompactValue{AUTO_BITS};
91
+ }
92
+
93
+ constexpr CompactValue() noexcept : repr_(0x7FC00000) {}
94
+
95
+ CompactValue(const YGValue &x) noexcept : repr_(uint32_t{0}) {
96
+ switch (x.unit) {
97
+ case YGUnitUndefined:
98
+ *this = ofUndefined();
99
+ break;
100
+ case YGUnitAuto:
101
+ *this = ofAuto();
102
+ break;
103
+ case YGUnitPoint:
104
+ *this = of<YGUnitPoint>(x.value);
105
+ break;
106
+ case YGUnitPercent:
107
+ *this = of<YGUnitPercent>(x.value);
108
+ break;
109
+ }
110
+ }
111
+
112
+ operator YGValue() const noexcept {
113
+ switch (repr_) {
114
+ case AUTO_BITS:
115
+ return YGValueAuto;
116
+ case ZERO_BITS_POINT:
117
+ return YGValue{0.0f, YGUnitPoint};
118
+ case ZERO_BITS_PERCENT:
119
+ return YGValue{0.0f, YGUnitPercent};
120
+ }
121
+
122
+ if (std::isnan(asFloat(repr_))) {
123
+ return YGValueUndefined;
124
+ }
125
+
126
+ auto data = repr_;
127
+ data &= ~PERCENT_BIT;
128
+ data += BIAS;
129
+
130
+ return YGValue{asFloat(data), repr_ & 0x40000000 ? YGUnitPercent : YGUnitPoint};
131
+ }
132
+
133
+ bool isUndefined() const noexcept {
134
+ return (repr_ != AUTO_BITS && repr_ != ZERO_BITS_POINT && repr_ != ZERO_BITS_PERCENT && std::isnan(asFloat(repr_)));
135
+ }
136
+
137
+ bool isAuto() const noexcept {
138
+ return repr_ == AUTO_BITS;
139
+ }
140
+
141
+ private:
142
+ uint32_t repr_;
143
+
144
+ static constexpr uint32_t BIAS = 0x20000000;
145
+ static constexpr uint32_t PERCENT_BIT = 0x40000000;
146
+
147
+ // these are signaling NaNs with specific bit pattern as payload they will be
148
+ // silenced whenever going through an FPU operation on ARM + x86
149
+ static constexpr uint32_t AUTO_BITS = 0x7faaaaaa;
150
+ static constexpr uint32_t ZERO_BITS_POINT = 0x7f8f0f0f;
151
+ static constexpr uint32_t ZERO_BITS_PERCENT = 0x7f80f0f0;
152
+
153
+ constexpr CompactValue(uint32_t data) noexcept : repr_(data) {}
154
+
155
+ VISIBLE_FOR_TESTING uint32_t repr() {
156
+ return repr_;
157
+ }
158
+
159
+ static uint32_t asU32(float f) {
160
+ #ifdef __cpp_lib_bit_cast
161
+ return std::bit_cast<uint32_t>(f);
162
+ #else
163
+ uint32_t u;
164
+ static_assert(sizeof(u) == sizeof(f));
165
+ std::memcpy(&u, &f, sizeof(f));
166
+ return u;
167
+ #endif
168
+ }
169
+
170
+ static float asFloat(uint32_t u) {
171
+ #ifdef __cpp_lib_bit_cast
172
+ return std::bit_cast<float>(data);
173
+ #else
174
+ float f;
175
+ static_assert(sizeof(f) == sizeof(u));
176
+ std::memcpy(&f, &u, sizeof(u));
177
+ return f;
178
+ #endif
179
+ }
180
+ };
181
+
182
+
183
+ template <>
184
+ CompactValue CompactValue::of<YGUnitUndefined>(float) noexcept = delete;
185
+ template <>
186
+ CompactValue CompactValue::of<YGUnitAuto>(float) noexcept = delete;
187
+ template <>
188
+ CompactValue CompactValue::ofMaybe<YGUnitUndefined>(float) noexcept = delete;
189
+ template <>
190
+ CompactValue CompactValue::ofMaybe<YGUnitAuto>(float) noexcept = delete;
191
+
192
+ constexpr bool operator==(CompactValue a, CompactValue b) noexcept {
193
+ return a.repr_ == b.repr_;
194
+ }
195
+
196
+ constexpr bool operator!=(CompactValue a, CompactValue b) noexcept {
197
+ return !(a == b);
198
+ }
199
+
200
+ } // namespace detail
201
+ } // namespace yoga
202
+ } // namespace facebook
203
+
204
+ #endif
@@ -86,8 +86,8 @@ struct InspectorProtocol {
86
86
  for (const facebook::react::InspectorPage2 &page : pages) {
87
87
  folly::dynamic pageDyn = folly::dynamic::object;
88
88
  pageDyn["id"] = page.id;
89
- pageDyn["title"] = std::string(page.title);
90
- pageDyn["vm"] = std::string(page.vm);
89
+ pageDyn["title"] = page.title;
90
+ pageDyn["vm"] = page.vm;
91
91
 
92
92
  pageDyn["isLastBundleDownloadSuccess"] = bundleStatus.m_isLastDownloadSucess;
93
93
  pageDyn["bundleUpdateTimestamp"] = bundleStatus.m_updateTimestamp;
@@ -68,7 +68,7 @@ void WinRTHttpResource::SendRequest(
68
68
  bool withCredentials,
69
69
  std::function<void(int64_t)> &&callback) noexcept /*override*/ {
70
70
  // Enforce supported args
71
- assert(responseType == "text" || responseType == "base64" | responseType == "blob");
71
+ assert(responseType == "text" || responseType == "base64" || responseType == "blob");
72
72
 
73
73
  if (callback) {
74
74
  callback(requestId);
@@ -619,17 +619,20 @@ std::vector<std::unique_ptr<NativeModule>> InstanceImpl::GetDefaultNativeModules
619
619
  []() { return std::make_unique<StatusBarManagerModule>(); },
620
620
  nativeQueue));
621
621
 
622
- modules.push_back(std::make_unique<CxxNativeModule>(
623
- m_innerInstance,
624
- Microsoft::React::GetBlobModuleName(),
625
- [transitionalProps]() { return Microsoft::React::CreateBlobModule(transitionalProps); },
626
- nativeQueue));
622
+ // #10036 - Blob module not supported in UWP. Need to define property bag lifetime and onwership.
623
+ if (Microsoft::React::GetRuntimeOptionBool("Blob.EnableModule")) {
624
+ modules.push_back(std::make_unique<CxxNativeModule>(
625
+ m_innerInstance,
626
+ Microsoft::React::GetBlobModuleName(),
627
+ [transitionalProps]() { return Microsoft::React::CreateBlobModule(transitionalProps); },
628
+ nativeQueue));
627
629
 
628
- modules.push_back(std::make_unique<CxxNativeModule>(
629
- m_innerInstance,
630
- Microsoft::React::GetFileReaderModuleName(),
631
- [transitionalProps]() { return Microsoft::React::CreateFileReaderModule(transitionalProps); },
632
- nativeQueue));
630
+ modules.push_back(std::make_unique<CxxNativeModule>(
631
+ m_innerInstance,
632
+ Microsoft::React::GetFileReaderModuleName(),
633
+ [transitionalProps]() { return Microsoft::React::CreateFileReaderModule(transitionalProps); },
634
+ nativeQueue));
635
+ }
633
636
 
634
637
  return modules;
635
638
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-windows",
3
- "version": "0.69.0-preview.5",
3
+ "version": "0.69.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,8 +26,8 @@
26
26
  "@react-native-community/cli": "^8.0.0",
27
27
  "@react-native-community/cli-platform-android": "^8.0.0",
28
28
  "@react-native-community/cli-platform-ios": "^8.0.0",
29
- "@react-native-windows/cli": "0.69.0-preview.1",
30
- "@react-native-windows/virtualized-list": "0.69.0-preview.2",
29
+ "@react-native-windows/cli": "0.69.0",
30
+ "@react-native-windows/virtualized-list": "0.69.0",
31
31
  "@react-native/assets": "1.0.0",
32
32
  "@react-native/normalize-color": "2.0.0",
33
33
  "@react-native/polyfills": "2.0.0",
@@ -61,7 +61,7 @@
61
61
  "ws": "^6.1.4"
62
62
  },
63
63
  "devDependencies": {
64
- "@react-native-windows/codegen": "0.69.0-preview.1",
64
+ "@react-native-windows/codegen": "0.69.0",
65
65
  "@rnw-scripts/eslint-config": "1.1.12",
66
66
  "@rnw-scripts/jest-out-of-tree-snapshot-resolver": "^1.0.6",
67
67
  "@rnw-scripts/metro-dev-config": "0.0.0",
@@ -77,7 +77,7 @@
77
77
  "metro-config": "^0.70.1",
78
78
  "prettier": "^2.4.1",
79
79
  "react": "18.0.0",
80
- "react-native": "0.69.0-rc.3",
80
+ "react-native": "^0.69.0",
81
81
  "react-native-platform-override": "^1.6.11",
82
82
  "react-refresh": "^0.4.0",
83
83
  "react-shallow-renderer": "16.14.1",
@@ -85,15 +85,15 @@
85
85
  },
86
86
  "peerDependencies": {
87
87
  "react": "18.0.0",
88
- "react-native": "0.69.0-rc.3"
88
+ "react-native": "^0.69.0"
89
89
  },
90
90
  "beachball": {
91
- "defaultNpmTag": "preview",
91
+ "defaultNpmTag": "latest",
92
92
  "gitTags": true,
93
93
  "disallowedChangeTypes": [
94
94
  "major",
95
95
  "minor",
96
- "patch"
96
+ "prerelease"
97
97
  ]
98
98
  },
99
99
  "files": [