react-native-windows 0.73.0-preview.1 → 0.73.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.
@@ -13,5 +13,5 @@ exports.version = {
13
13
  major: 0,
14
14
  minor: 73,
15
15
  patch: 0,
16
- prerelease: 'rc.1',
16
+ prerelease: 'rc.3',
17
17
  };
@@ -30,6 +30,7 @@ export type LogData = $ReadOnly<{|
30
30
  message: Message,
31
31
  category: Category,
32
32
  componentStack: ComponentStack,
33
+ stack?: string,
33
34
  |}>;
34
35
 
35
36
  export type Observer = (
@@ -198,7 +199,7 @@ export function addLog(log: LogData): void {
198
199
  // otherwise spammy logs would pause rendering.
199
200
  setImmediate(() => {
200
201
  try {
201
- const stack = parseErrorStack(errorForStackTrace?.stack);
202
+ const stack = parseErrorStack(log.stack ?? errorForStackTrace?.stack);
202
203
 
203
204
  appendNewLog(
204
205
  new LogBoxLog({
@@ -55,14 +55,20 @@ export function get<Config>(
55
55
  ): HostComponent<Config> {
56
56
  ReactNativeViewConfigRegistry.register(name, () => {
57
57
  const {native, strict, verify} = getRuntimeConfig?.(name) ?? {
58
- native: true,
58
+ native: !global.RN$Bridgeless,
59
59
  strict: false,
60
60
  verify: false,
61
61
  };
62
62
 
63
- const viewConfig = native
64
- ? getNativeComponentAttributes(name)
65
- : createViewConfig(viewConfigProvider());
63
+ let viewConfig;
64
+ if (native) {
65
+ viewConfig = getNativeComponentAttributes(name);
66
+ } else {
67
+ viewConfig = createViewConfig(viewConfigProvider());
68
+ if (viewConfig == null) {
69
+ viewConfig = getNativeComponentAttributes(name);
70
+ }
71
+ }
66
72
 
67
73
  if (verify) {
68
74
  const nativeViewConfig = native
@@ -10,6 +10,8 @@
10
10
 
11
11
  import typeof {enable} from 'promise/setimmediate/rejection-tracking';
12
12
 
13
+ import LogBox from './LogBox/LogBox';
14
+
13
15
  let rejectionTrackingOptions: $NonMaybeType<Parameters<enable>[0]> = {
14
16
  allRejections: true,
15
17
  onUnhandled: (id, rejection = {}) => {
@@ -34,17 +36,29 @@ let rejectionTrackingOptions: $NonMaybeType<Parameters<enable>[0]> = {
34
36
  }
35
37
  }
36
38
 
37
- const warning =
38
- `Possible Unhandled Promise Rejection (id: ${id}):\n` +
39
- `${message ?? ''}\n` +
40
- (stack == null ? '' : stack);
41
- console.warn(warning);
39
+ const warning = `Possible unhandled promise rejection (id: ${id}):\n${
40
+ message ?? ''
41
+ }`;
42
+ if (__DEV__) {
43
+ LogBox.addLog({
44
+ level: 'warn',
45
+ message: {
46
+ content: warning,
47
+ substitutions: [],
48
+ },
49
+ componentStack: [],
50
+ stack,
51
+ category: 'possible_unhandled_promise_rejection',
52
+ });
53
+ } else {
54
+ console.warn(warning);
55
+ }
42
56
  },
43
57
  onHandled: id => {
44
58
  const warning =
45
- `Promise Rejection Handled (id: ${id})\n` +
59
+ `Promise rejection handled (id: ${id})\n` +
46
60
  'This means you can ignore any previous messages of the form ' +
47
- `"Possible Unhandled Promise Rejection (id: ${id}):"`;
61
+ `"Possible unhandled promise rejection (id: ${id}):"`;
48
62
  console.warn(warning);
49
63
  },
50
64
  };
@@ -10,11 +10,11 @@
10
10
  -->
11
11
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
12
12
  <PropertyGroup>
13
- <ReactNativeWindowsVersion>0.73.0-preview.1</ReactNativeWindowsVersion>
13
+ <ReactNativeWindowsVersion>0.73.0-preview.3</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>73</ReactNativeWindowsMinor>
16
16
  <ReactNativeWindowsPatch>0</ReactNativeWindowsPatch>
17
17
  <ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
18
- <ReactNativeWindowsCommitId>ac285dafb2520fc3fc26e3ad1b5d1c4454378a2d</ReactNativeWindowsCommitId>
18
+ <ReactNativeWindowsCommitId>727387f5fd3b039d39d3b58d600b08204690b6e7</ReactNativeWindowsCommitId>
19
19
  </PropertyGroup>
20
20
  </Project>
@@ -0,0 +1,21 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #include "BlobCollector.h"
5
+
6
+ using std::string;
7
+
8
+ namespace Microsoft::React {
9
+
10
+ using Networking::IBlobResource;
11
+
12
+ BlobCollector::BlobCollector(string blobId, std::shared_ptr<IBlobResource> resource) noexcept
13
+ : m_blobId{blobId}, m_weakResource{std::weak_ptr<IBlobResource>(resource)} {}
14
+
15
+ BlobCollector::~BlobCollector() noexcept {
16
+ if (auto rc = m_weakResource.lock()) {
17
+ rc->Release(std::move(m_blobId));
18
+ }
19
+ }
20
+
21
+ } // namespace Microsoft::React
@@ -0,0 +1,23 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #pragma once
5
+
6
+ #include <Networking/IBlobResource.h>
7
+
8
+ // JSI
9
+ #include <jsi/jsi.h>
10
+
11
+ namespace Microsoft::React {
12
+
13
+ class JSI_EXPORT BlobCollector : public facebook::jsi::HostObject {
14
+ std::string m_blobId;
15
+ std::weak_ptr<Networking::IBlobResource> m_weakResource;
16
+
17
+ public:
18
+ BlobCollector(std::string blobId, std::shared_ptr<Networking::IBlobResource> resource) noexcept;
19
+
20
+ ~BlobCollector() noexcept;
21
+ };
22
+
23
+ } // namespace Microsoft::React
@@ -4,7 +4,9 @@
4
4
  #include "BlobModule.h"
5
5
 
6
6
  #include <CreateModules.h>
7
+ #include <JSI/JsiApiContext.h>
7
8
  #include <Modules/CxxModuleUtilities.h>
9
+ #include "BlobCollector.h"
8
10
 
9
11
  // React Native
10
12
  #include <cxxreact/JsArgumentHelpers.h>
@@ -38,6 +40,23 @@ void BlobTurboModule::Initialize(msrn::ReactContext const &reactContext) noexcep
38
40
  m_resource->Callbacks().OnError = [&reactContext](string &&errorText) {
39
41
  Modules::SendEvent(reactContext, L"blobFailed", {errorText});
40
42
  };
43
+
44
+ namespace jsi = facebook::jsi;
45
+ msrn::ExecuteJsi(reactContext, [resource = m_resource](jsi::Runtime &runtime) {
46
+ runtime.global().setProperty(
47
+ runtime,
48
+ "__blobCollectorProvider",
49
+ jsi::Function::createFromHostFunction(
50
+ runtime,
51
+ jsi::PropNameID::forAscii(runtime, "__blobCollectorProvider"),
52
+ 1,
53
+ [resource](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) {
54
+ auto blobId = args[0].asString(rt).utf8(rt);
55
+ auto collector = std::make_shared<BlobCollector>(blobId, resource);
56
+
57
+ return jsi::Object::createFromHostObject(rt, collector);
58
+ }));
59
+ });
41
60
  }
42
61
 
43
62
  ReactNativeSpecs::BlobModuleSpec_Constants BlobTurboModule::GetConstants() noexcept {
@@ -193,6 +193,7 @@
193
193
  <ClCompile Include="$(MSBuildThisFileDirectory)LayoutAnimation.cpp" />
194
194
  <ClCompile Include="$(MSBuildThisFileDirectory)Logging.cpp" />
195
195
  <ClCompile Include="$(MSBuildThisFileDirectory)MemoryMappedBuffer.cpp" />
196
+ <ClCompile Include="$(MSBuildThisFileDirectory)Modules\BlobCollector.cpp" />
196
197
  <ClCompile Include="$(MSBuildThisFileDirectory)Modules\BlobModule.cpp" />
197
198
  <ClCompile Include="$(MSBuildThisFileDirectory)Modules\CxxModuleUtilities.cpp" />
198
199
  <ClCompile Include="$(MSBuildThisFileDirectory)Modules\ExceptionsManagerModule.cpp" />
@@ -327,6 +328,7 @@
327
328
  <ClInclude Include="$(MSBuildThisFileDirectory)JSI\V8RuntimeHolder.h" />
328
329
  <ClInclude Include="$(MSBuildThisFileDirectory)JSI\RuntimeHolder.h" />
329
330
  <ClInclude Include="$(MSBuildThisFileDirectory)JSI\ScriptStore.h" />
331
+ <ClInclude Include="$(MSBuildThisFileDirectory)Modules\BlobCollector.h" />
330
332
  <ClInclude Include="$(MSBuildThisFileDirectory)Modules\BlobModule.h" />
331
333
  <ClInclude Include="$(MSBuildThisFileDirectory)Modules\CxxModuleUtilities.h" />
332
334
  <ClInclude Include="$(MSBuildThisFileDirectory)Modules\FileReaderModule.h" />
@@ -565,4 +567,4 @@
565
567
  <PrecompiledHeader>NotUsing</PrecompiledHeader>
566
568
  </ClCompile>
567
569
  </ItemGroup>
568
- </Project>
570
+ </Project>
@@ -275,6 +275,9 @@
275
275
  </ClCompile>
276
276
  <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\platform\react\renderer\components\view\HostPlatformViewProps.cpp" />
277
277
  <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\platform\react\renderer\components\view\HostPlatformViewEventEmitter.cpp" />
278
+ <ClCompile Include="$(MSBuildThisFileDirectory)Modules\BlobCollector.cpp">
279
+ <Filter>Source Files\Modules</Filter>
280
+ </ClCompile>
278
281
  </ItemGroup>
279
282
  <ItemGroup>
280
283
  <Filter Include="Source Files">
@@ -750,6 +753,9 @@
750
753
  </ClInclude>
751
754
  <ClInclude Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\platform\react\renderer\components\view\HostPlatformTouch.h" />
752
755
  <ClInclude Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\platform\react\renderer\components\view\HostPlatformViewEventEmitter.h" />
756
+ <ClInclude Include="$(MSBuildThisFileDirectory)Modules\BlobCollector.h">
757
+ <Filter>Header Files\Modules</Filter>
758
+ </ClInclude>
753
759
  </ItemGroup>
754
760
  <ItemGroup>
755
761
  <None Include="$(MSBuildThisFileDirectory)tracing\rnw.wprp">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-windows",
3
- "version": "0.73.0-preview.1",
3
+ "version": "0.73.0-preview.3",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,11 +30,11 @@
30
30
  "@react-native/assets": "1.0.0",
31
31
  "@react-native/assets-registry": "^0.73.1",
32
32
  "@react-native/codegen": "^0.73.1",
33
- "@react-native/community-cli-plugin": "^0.73.6",
34
- "@react-native/gradle-plugin": "^0.73.1",
33
+ "@react-native/community-cli-plugin": "^0.73.7",
34
+ "@react-native/gradle-plugin": "^0.73.2",
35
35
  "@react-native/js-polyfills": "^0.73.1",
36
36
  "@react-native/normalize-colors": "^0.73.2",
37
- "@react-native/virtualized-lists": "^0.73.1",
37
+ "@react-native/virtualized-lists": "^0.73.2",
38
38
  "abort-controller": "^3.0.0",
39
39
  "anser": "^1.4.9",
40
40
  "ansi-regex": "^5.0.0",
@@ -81,14 +81,14 @@
81
81
  "just-scripts": "^1.3.3",
82
82
  "prettier": "^2.4.1",
83
83
  "react": "18.2.0",
84
- "react-native": "0.73.0-rc.1",
84
+ "react-native": "0.73.0-rc.3",
85
85
  "react-native-platform-override": "^1.9.16",
86
86
  "react-refresh": "^0.4.0",
87
87
  "typescript": "^4.9.5"
88
88
  },
89
89
  "peerDependencies": {
90
90
  "react": "18.2.0",
91
- "react-native": "0.73.0-rc.1"
91
+ "react-native": "^0.73.0-rc.3"
92
92
  },
93
93
  "beachball": {
94
94
  "defaultNpmTag": "preview",
@@ -1,9 +1,5 @@
1
- /**
2
- * Metro configuration for React Native
3
- * https://github.com/facebook/react-native
4
- *
5
- * @format
6
- */
1
+ const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
2
+
7
3
  const fs = require('fs');
8
4
  const path = require('path');
9
5
  const exclusionList = require('metro-config/src/defaults/exclusionList');
@@ -12,7 +8,14 @@ const rnwPath = fs.realpathSync(
12
8
  path.resolve(require.resolve('react-native-windows/package.json'), '..'),
13
9
  );
14
10
 
15
- module.exports = {
11
+ /**
12
+ * Metro configuration
13
+ * https://facebook.github.io/metro/docs/configuration
14
+ *
15
+ * @type {import('metro-config').MetroConfig}
16
+ */
17
+
18
+ const config = {
16
19
  resolver: {
17
20
  blockList: exclusionList([
18
21
  // This stops "react-native run-windows" from causing the metro server to crash if its already running
@@ -36,3 +39,5 @@ module.exports = {
36
39
  assetRegistryPath: 'react-native/Libraries/Image/AssetRegistry',
37
40
  },
38
41
  };
42
+
43
+ module.exports = mergeConfig(getDefaultConfig(__dirname), config);
@@ -1,9 +1,5 @@
1
- /**
2
- * Metro configuration for React Native
3
- * https://github.com/facebook/react-native
4
- *
5
- * @format
6
- */
1
+ const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
2
+
7
3
  const fs = require('fs');
8
4
  const path = require('path');
9
5
  const exclusionList = require('metro-config/src/defaults/exclusionList');
@@ -17,7 +13,14 @@ const rnwRootNodeModules = path.resolve(rnwPath, '..', 'node_modules');
17
13
  const rnwPackages = path.resolve(rnwPath, '..', 'packages');
18
14
  // devMode]
19
15
 
20
- module.exports = {
16
+ /**
17
+ * Metro configuration
18
+ * https://facebook.github.io/metro/docs/configuration
19
+ *
20
+ * @type {import('metro-config').MetroConfig}
21
+ */
22
+
23
+ const config = {
21
24
  // [devMode
22
25
  watchFolders: [rnwPath, rnwRootNodeModules, rnwPackages],
23
26
  // devMode]
@@ -45,5 +48,9 @@ module.exports = {
45
48
  inlineRequires: true,
46
49
  },
47
50
  }),
51
+ // This fixes the 'missing-asset-registry-path` error (see https://github.com/microsoft/react-native-windows/issues/11437)
52
+ assetRegistryPath: 'react-native/Libraries/Image/AssetRegistry',
48
53
  },
49
54
  };
55
+
56
+ module.exports = mergeConfig(getDefaultConfig(__dirname), config);
@@ -1,9 +1,5 @@
1
- /**
2
- * Metro configuration for React Native
3
- * https://github.com/facebook/react-native
4
- *
5
- * @format
6
- */
1
+ const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
2
+
7
3
  const fs = require('fs');
8
4
  const path = require('path');
9
5
  const exclusionList = require('metro-config/src/defaults/exclusionList');
@@ -17,7 +13,14 @@ const rnwRootNodeModules = path.resolve(rnwPath, '..', 'node_modules');
17
13
  const rnwPackages = path.resolve(rnwPath, '..', 'packages');
18
14
  // devMode]{{/devMode}}
19
15
 
20
- module.exports = {
16
+ /**
17
+ * Metro configuration
18
+ * https://facebook.github.io/metro/docs/configuration
19
+ *
20
+ * @type {import('metro-config').MetroConfig}
21
+ */
22
+
23
+ const config = {
21
24
  //{{#devMode}} [devMode
22
25
  watchFolders: [rnwPath, rnwRootNodeModules, rnwPackages],
23
26
  // devMode]{{/devMode}}
@@ -49,3 +52,5 @@ module.exports = {
49
52
  assetRegistryPath: 'react-native/Libraries/Image/AssetRegistry',
50
53
  },
51
54
  };
55
+
56
+ module.exports = mergeConfig(getDefaultConfig(__dirname), config);