react-native 0.75.0-rc.1 → 0.75.0-rc.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.
@@ -17,7 +17,7 @@ const version: $ReadOnly<{
17
17
  major: 0,
18
18
  minor: 75,
19
19
  patch: 0,
20
- prerelease: 'rc.1',
20
+ prerelease: 'rc.3',
21
21
  };
22
22
 
23
23
  module.exports = {version};
@@ -24,7 +24,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(75),
26
26
  RCTVersionPatch: @(0),
27
- RCTVersionPrerelease: @"rc.1",
27
+ RCTVersionPrerelease: @"rc.3",
28
28
  };
29
29
  });
30
30
  return __rnVersion;
@@ -2323,12 +2323,19 @@ public class com/facebook/react/devsupport/ReleaseDevSupportManager : com/facebo
2323
2323
 
2324
2324
  public class com/facebook/react/devsupport/StackTraceHelper {
2325
2325
  public static final field COLUMN_KEY Ljava/lang/String;
2326
+ public static final field FILE_KEY Ljava/lang/String;
2327
+ public static final field ID_KEY Ljava/lang/String;
2328
+ public static final field IS_FATAL_KEY Ljava/lang/String;
2326
2329
  public static final field LINE_NUMBER_KEY Ljava/lang/String;
2330
+ public static final field MESSAGE_KEY Ljava/lang/String;
2331
+ public static final field METHOD_NAME_KEY Ljava/lang/String;
2332
+ public static final field STACK_KEY Ljava/lang/String;
2327
2333
  public fun <init> ()V
2328
2334
  public static fun convertJavaStackTrace (Ljava/lang/Throwable;)[Lcom/facebook/react/devsupport/interfaces/StackFrame;
2329
2335
  public static fun convertJsStackTrace (Lcom/facebook/react/bridge/ReadableArray;)[Lcom/facebook/react/devsupport/interfaces/StackFrame;
2330
2336
  public static fun convertJsStackTrace (Ljava/lang/String;)[Lcom/facebook/react/devsupport/interfaces/StackFrame;
2331
2337
  public static fun convertJsStackTrace (Lorg/json/JSONArray;)[Lcom/facebook/react/devsupport/interfaces/StackFrame;
2338
+ public static fun convertParsedError (Lcom/facebook/react/interfaces/exceptionmanager/ReactJsExceptionHandler$ParsedError;)Lcom/facebook/react/bridge/JavaOnlyMap;
2332
2339
  public static fun formatFrameSource (Lcom/facebook/react/devsupport/interfaces/StackFrame;)Ljava/lang/String;
2333
2340
  public static fun formatStackTrace (Ljava/lang/String;[Lcom/facebook/react/devsupport/interfaces/StackFrame;)Ljava/lang/String;
2334
2341
  }
@@ -3779,8 +3786,8 @@ public abstract class com/facebook/react/runtime/JSRuntimeFactory {
3779
3786
  }
3780
3787
 
3781
3788
  public class com/facebook/react/runtime/ReactHostImpl : com/facebook/react/ReactHost {
3782
- public fun <init> (Landroid/content/Context;Lcom/facebook/react/runtime/ReactHostDelegate;Lcom/facebook/react/fabric/ComponentFactory;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Lcom/facebook/react/interfaces/exceptionmanager/ReactJsExceptionHandler;ZZ)V
3783
- public fun <init> (Landroid/content/Context;Lcom/facebook/react/runtime/ReactHostDelegate;Lcom/facebook/react/fabric/ComponentFactory;ZLcom/facebook/react/interfaces/exceptionmanager/ReactJsExceptionHandler;Z)V
3789
+ public fun <init> (Landroid/content/Context;Lcom/facebook/react/runtime/ReactHostDelegate;Lcom/facebook/react/fabric/ComponentFactory;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;ZZ)V
3790
+ public fun <init> (Landroid/content/Context;Lcom/facebook/react/runtime/ReactHostDelegate;Lcom/facebook/react/fabric/ComponentFactory;ZZ)V
3784
3791
  public fun addBeforeDestroyListener (Lkotlin/jvm/functions/Function0;)V
3785
3792
  public fun addReactInstanceEventListener (Lcom/facebook/react/ReactInstanceEventListener;)V
3786
3793
  public fun createSurface (Landroid/content/Context;Ljava/lang/String;Landroid/os/Bundle;)Lcom/facebook/react/interfaces/fabric/ReactSurface;
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.75.0-rc.1
1
+ VERSION_NAME=0.75.0-rc.3
2
2
  react.internal.publishingGroup=com.facebook.react
3
3
 
4
4
  android.useAndroidX=true
@@ -39,6 +39,7 @@ public object AndroidUnicodeUtils {
39
39
  }
40
40
 
41
41
  @DoNotStrip
42
+ @JvmStatic
42
43
  public fun convertToCase(input: String, targetCase: Int, useCurrentLocale: Boolean): String {
43
44
  // Note Java's case conversions use the user's locale. For example "I".toLowerCase()
44
45
  // will produce a dotless i. From Java's docs: "To obtain correct results for locale
@@ -17,7 +17,6 @@ import com.facebook.react.bridge.ReactContext
17
17
  import com.facebook.react.common.annotations.UnstableReactNativeAPI
18
18
  import com.facebook.react.common.build.ReactBuildConfig
19
19
  import com.facebook.react.fabric.ComponentFactory
20
- import com.facebook.react.interfaces.exceptionmanager.ReactJsExceptionHandler
21
20
  import com.facebook.react.runtime.JSCInstance
22
21
  import com.facebook.react.runtime.ReactHostImpl
23
22
  import com.facebook.react.runtime.cxxreactpackage.CxxReactPackage
@@ -74,8 +73,6 @@ public object DefaultReactHost {
74
73
  reactPackages = packageList,
75
74
  jsRuntimeFactory = jsRuntimeFactory,
76
75
  turboModuleManagerDelegateBuilder = defaultTmmDelegateBuilder)
77
- // TODO: T180971255 Improve default exception handler
78
- val reactJsExceptionHandler = ReactJsExceptionHandler { _ -> }
79
76
  val componentFactory = ComponentFactory()
80
77
  DefaultComponentsRegistry.register(componentFactory)
81
78
  // TODO: T164788699 find alternative of accessing ReactHostImpl for initialising reactHost
@@ -85,7 +82,6 @@ public object DefaultReactHost {
85
82
  defaultReactHostDelegate,
86
83
  componentFactory,
87
84
  true /* allowPackagerServerAccess */,
88
- reactJsExceptionHandler,
89
85
  useDevSupport,
90
86
  )
91
87
  .apply {
@@ -8,12 +8,17 @@
8
8
  package com.facebook.react.devsupport;
9
9
 
10
10
  import androidx.annotation.Nullable;
11
+ import com.facebook.react.bridge.JavaOnlyArray;
12
+ import com.facebook.react.bridge.JavaOnlyMap;
11
13
  import com.facebook.react.bridge.ReadableArray;
12
14
  import com.facebook.react.bridge.ReadableMap;
13
15
  import com.facebook.react.bridge.ReadableType;
14
16
  import com.facebook.react.common.MapBuilder;
15
17
  import com.facebook.react.devsupport.interfaces.StackFrame;
18
+ import com.facebook.react.interfaces.exceptionmanager.ReactJsExceptionHandler.ParsedError;
16
19
  import java.io.File;
20
+ import java.util.ArrayList;
21
+ import java.util.List;
17
22
  import java.util.regex.Matcher;
18
23
  import java.util.regex.Pattern;
19
24
  import org.json.JSONArray;
@@ -23,8 +28,15 @@ import org.json.JSONObject;
23
28
  /** Helper class converting JS and Java stack traces into arrays of {@link StackFrame} objects. */
24
29
  public class StackTraceHelper {
25
30
 
26
- public static final java.lang.String COLUMN_KEY = "column";
27
- public static final java.lang.String LINE_NUMBER_KEY = "lineNumber";
31
+ public static final String COLUMN_KEY = "column";
32
+ public static final String LINE_NUMBER_KEY = "lineNumber";
33
+ public static final String FILE_KEY = "file";
34
+ public static final String METHOD_NAME_KEY = "methodName";
35
+
36
+ public static final String MESSAGE_KEY = "message";
37
+ public static final String STACK_KEY = "stack";
38
+ public static final String ID_KEY = "id";
39
+ public static final String IS_FATAL_KEY = "isFatal";
28
40
 
29
41
  private static final Pattern STACK_FRAME_PATTERN1 =
30
42
  Pattern.compile("^(?:(.*?)@)?(.*?)\\:([0-9]+)\\:([0-9]+)$");
@@ -246,4 +258,25 @@ public class StackTraceHelper {
246
258
 
247
259
  return stackTrace.toString();
248
260
  }
261
+
262
+ public static JavaOnlyMap convertParsedError(ParsedError error) {
263
+ List<ParsedError.StackFrame> frames = error.getFrames();
264
+ List<ReadableMap> readableMapList = new ArrayList<>();
265
+ for (ParsedError.StackFrame frame : frames) {
266
+ JavaOnlyMap map = new JavaOnlyMap();
267
+ map.putDouble(COLUMN_KEY, frame.getColumnNumber());
268
+ map.putDouble(LINE_NUMBER_KEY, frame.getLineNumber());
269
+ map.putString(FILE_KEY, (String) frame.getFileName());
270
+ map.putString(METHOD_NAME_KEY, (String) frame.getMethodName());
271
+ readableMapList.add(map);
272
+ }
273
+
274
+ JavaOnlyMap data = new JavaOnlyMap();
275
+ data.putString(MESSAGE_KEY, error.getMessage());
276
+ data.putArray(STACK_KEY, JavaOnlyArray.from(readableMapList));
277
+ data.putInt(ID_KEY, error.getExceptionId());
278
+ data.putBoolean(IS_FATAL_KEY, error.isFatal());
279
+
280
+ return data;
281
+ }
249
282
  }
@@ -18,5 +18,5 @@ public class ReactNativeVersion {
18
18
  "major", 0,
19
19
  "minor", 75,
20
20
  "patch", 0,
21
- "prerelease", "rc.1");
21
+ "prerelease", "rc.3");
22
22
  }
@@ -57,7 +57,6 @@ import com.facebook.react.devsupport.interfaces.DevSupportManager.PausedInDebugg
57
57
  import com.facebook.react.fabric.ComponentFactory;
58
58
  import com.facebook.react.fabric.FabricUIManager;
59
59
  import com.facebook.react.interfaces.TaskInterface;
60
- import com.facebook.react.interfaces.exceptionmanager.ReactJsExceptionHandler;
61
60
  import com.facebook.react.interfaces.fabric.ReactSurface;
62
61
  import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags;
63
62
  import com.facebook.react.modules.appearance.AppearanceModule;
@@ -102,7 +101,6 @@ public class ReactHostImpl implements ReactHost {
102
101
  private final Context mContext;
103
102
  private final ReactHostDelegate mReactHostDelegate;
104
103
  private final ComponentFactory mComponentFactory;
105
- private final ReactJsExceptionHandler mReactJsExceptionHandler;
106
104
  private final DevSupportManager mDevSupportManager;
107
105
  private final Executor mBGExecutor;
108
106
  private final Executor mUIExecutor;
@@ -145,7 +143,6 @@ public class ReactHostImpl implements ReactHost {
145
143
  ReactHostDelegate delegate,
146
144
  ComponentFactory componentFactory,
147
145
  boolean allowPackagerServerAccess,
148
- ReactJsExceptionHandler reactJsExceptionHandler,
149
146
  boolean useDevSupport) {
150
147
  this(
151
148
  context,
@@ -153,7 +150,6 @@ public class ReactHostImpl implements ReactHost {
153
150
  componentFactory,
154
151
  Executors.newSingleThreadExecutor(),
155
152
  Task.UI_THREAD_EXECUTOR,
156
- reactJsExceptionHandler,
157
153
  allowPackagerServerAccess,
158
154
  useDevSupport);
159
155
  }
@@ -164,7 +160,6 @@ public class ReactHostImpl implements ReactHost {
164
160
  ComponentFactory componentFactory,
165
161
  Executor bgExecutor,
166
162
  Executor uiExecutor,
167
- ReactJsExceptionHandler reactJsExceptionHandler,
168
163
  boolean allowPackagerServerAccess,
169
164
  boolean useDevSupport) {
170
165
  mContext = context;
@@ -172,7 +167,6 @@ public class ReactHostImpl implements ReactHost {
172
167
  mComponentFactory = componentFactory;
173
168
  mBGExecutor = bgExecutor;
174
169
  mUIExecutor = uiExecutor;
175
- mReactJsExceptionHandler = reactJsExceptionHandler;
176
170
  mQueueThreadExceptionHandler = ReactHostImpl.this::handleHostException;
177
171
  mMemoryPressureRouter = new MemoryPressureRouter(context);
178
172
  mAllowPackagerServerAccess = allowPackagerServerAccess;
@@ -1074,7 +1068,6 @@ public class ReactHostImpl implements ReactHost {
1074
1068
  mComponentFactory,
1075
1069
  devSupportManager,
1076
1070
  mQueueThreadExceptionHandler,
1077
- mReactJsExceptionHandler,
1078
1071
  mUseDevSupport,
1079
1072
  getOrCreateReactHostInspectorTarget());
1080
1073
  mReactInstance = instance;
@@ -10,6 +10,8 @@ package com.facebook.react.runtime;
10
10
  import android.content.res.AssetManager;
11
11
  import android.view.View;
12
12
  import com.facebook.common.logging.FLog;
13
+ import com.facebook.fbreact.specs.NativeExceptionsManagerSpec;
14
+ import com.facebook.infer.annotation.Assertions;
13
15
  import com.facebook.infer.annotation.Nullsafe;
14
16
  import com.facebook.infer.annotation.ThreadConfined;
15
17
  import com.facebook.infer.annotation.ThreadSafe;
@@ -21,6 +23,7 @@ import com.facebook.react.ViewManagerOnDemandReactPackage;
21
23
  import com.facebook.react.bridge.Arguments;
22
24
  import com.facebook.react.bridge.JSBundleLoader;
23
25
  import com.facebook.react.bridge.JSBundleLoaderDelegate;
26
+ import com.facebook.react.bridge.JavaOnlyMap;
24
27
  import com.facebook.react.bridge.JavaScriptContextHolder;
25
28
  import com.facebook.react.bridge.NativeArray;
26
29
  import com.facebook.react.bridge.NativeMap;
@@ -35,6 +38,7 @@ import com.facebook.react.bridge.queue.QueueThreadExceptionHandler;
35
38
  import com.facebook.react.bridge.queue.ReactQueueConfiguration;
36
39
  import com.facebook.react.bridge.queue.ReactQueueConfigurationImpl;
37
40
  import com.facebook.react.bridge.queue.ReactQueueConfigurationSpec;
41
+ import com.facebook.react.devsupport.StackTraceHelper;
38
42
  import com.facebook.react.devsupport.interfaces.DevSupportManager;
39
43
  import com.facebook.react.fabric.Binding;
40
44
  import com.facebook.react.fabric.BindingImpl;
@@ -110,7 +114,6 @@ final class ReactInstance {
110
114
  ComponentFactory componentFactory,
111
115
  DevSupportManager devSupportManager,
112
116
  QueueThreadExceptionHandler exceptionHandler,
113
- ReactJsExceptionHandler reactExceptionManager,
114
117
  boolean useDevSupport,
115
118
  @Nullable ReactHostInspectorTarget reactHostInspectorTarget) {
116
119
  mBridgelessReactContext = bridgelessReactContext;
@@ -154,6 +157,7 @@ final class ReactInstance {
154
157
  // Notify JS if profiling is enabled
155
158
  boolean isProfiling =
156
159
  Systrace.isTracing(Systrace.TRACE_TAG_REACT_APPS | Systrace.TRACE_TAG_REACT_JS_VM_CALLS);
160
+
157
161
  mHybridData =
158
162
  initHybrid(
159
163
  jsRuntimeFactory,
@@ -161,7 +165,7 @@ final class ReactInstance {
161
165
  nativeModulesMessageQueueThread,
162
166
  mJavaTimerManager,
163
167
  jsTimerExecutor,
164
- reactExceptionManager,
168
+ new ReactJsExceptionHandlerImpl(nativeModulesMessageQueueThread),
165
169
  bindingsInstaller,
166
170
  isProfiling,
167
171
  reactHostInspectorTarget);
@@ -313,6 +317,29 @@ final class ReactInstance {
313
317
  return mQueueConfiguration;
314
318
  }
315
319
 
320
+ private class ReactJsExceptionHandlerImpl implements ReactJsExceptionHandler {
321
+ private final MessageQueueThread mNativemodulesmessagequeuethread;
322
+
323
+ ReactJsExceptionHandlerImpl(MessageQueueThread nativeModulesMessageQueueThread) {
324
+ this.mNativemodulesmessagequeuethread = nativeModulesMessageQueueThread;
325
+ }
326
+
327
+ @Override
328
+ public void reportJsException(ParsedError error) {
329
+ JavaOnlyMap data = StackTraceHelper.convertParsedError(error);
330
+
331
+ // Simulate async native module method call
332
+ mNativemodulesmessagequeuethread.runOnQueue(
333
+ () -> {
334
+ NativeExceptionsManagerSpec exceptionsManager =
335
+ (NativeExceptionsManagerSpec)
336
+ Assertions.assertNotNull(
337
+ mTurboModuleManager.getModule(NativeExceptionsManagerSpec.NAME));
338
+ exceptionsManager.reportException(data);
339
+ });
340
+ }
341
+ }
342
+
316
343
  public void loadJSBundle(JSBundleLoader bundleLoader) {
317
344
  // Load the JS bundle
318
345
  Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "ReactInstance.loadJSBundle");
@@ -18,7 +18,7 @@ constexpr struct {
18
18
  int32_t Major = 0;
19
19
  int32_t Minor = 75;
20
20
  int32_t Patch = 0;
21
- std::string_view Prerelease = "rc.1";
21
+ std::string_view Prerelease = "rc.3";
22
22
  } ReactNativeVersion;
23
23
 
24
24
  } // namespace facebook::react
@@ -654,6 +654,20 @@ class WithRuntimeDecorator : public RuntimeDecorator<Plain, Base> {
654
654
  return RD::getHostFunction(f);
655
655
  };
656
656
 
657
+ bool hasNativeState(const Object& o) override {
658
+ Around around{with_};
659
+ return RD::hasNativeState(o);
660
+ };
661
+ std::shared_ptr<NativeState> getNativeState(const Object& o) override {
662
+ Around around{with_};
663
+ return RD::getNativeState(o);
664
+ };
665
+ void setNativeState(const Object& o, std::shared_ptr<NativeState> state)
666
+ override {
667
+ Around around{with_};
668
+ RD::setNativeState(o, state);
669
+ };
670
+
657
671
  Value getProperty(const Object& o, const PropNameID& name) override {
658
672
  Around around{with_};
659
673
  return RD::getProperty(o, name);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native",
3
- "version": "0.75.0-rc.1",
3
+ "version": "0.75.0-rc.3",
4
4
  "description": "A framework for building native apps using React",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -109,16 +109,16 @@
109
109
  },
110
110
  "dependencies": {
111
111
  "@jest/create-cache-key-function": "^29.6.3",
112
- "@react-native-community/cli": "14.0.0-alpha.10",
113
- "@react-native-community/cli-platform-android": "14.0.0-alpha.10",
114
- "@react-native-community/cli-platform-ios": "14.0.0-alpha.10",
115
- "@react-native/assets-registry": "0.75.0-rc.1",
116
- "@react-native/codegen": "0.75.0-rc.1",
117
- "@react-native/community-cli-plugin": "0.75.0-rc.1",
118
- "@react-native/gradle-plugin": "0.75.0-rc.1",
119
- "@react-native/js-polyfills": "0.75.0-rc.1",
120
- "@react-native/normalize-colors": "0.75.0-rc.1",
121
- "@react-native/virtualized-lists": "0.75.0-rc.1",
112
+ "@react-native-community/cli": "14.0.0-alpha.11",
113
+ "@react-native-community/cli-platform-android": "14.0.0-alpha.11",
114
+ "@react-native-community/cli-platform-ios": "14.0.0-alpha.11",
115
+ "@react-native/assets-registry": "0.75.0-rc.3",
116
+ "@react-native/codegen": "0.75.0-rc.3",
117
+ "@react-native/community-cli-plugin": "0.75.0-rc.3",
118
+ "@react-native/gradle-plugin": "0.75.0-rc.3",
119
+ "@react-native/js-polyfills": "0.75.0-rc.3",
120
+ "@react-native/normalize-colors": "0.75.0-rc.3",
121
+ "@react-native/virtualized-lists": "0.75.0-rc.3",
122
122
  "abort-controller": "^3.0.0",
123
123
  "anser": "^1.4.9",
124
124
  "ansi-regex": "^5.0.0",
package/scripts/bundle.js CHANGED
@@ -31,9 +31,9 @@ program
31
31
  'npx react-native config',
32
32
  )
33
33
  .option('--load-config <string>', 'JSON project config')
34
- .action(async function handleAction(_, options) {
34
+ .action(async function handleAction() {
35
35
  let config = null;
36
-
36
+ let options = program.opts();
37
37
  if (options.loadConfig != null) {
38
38
  config = JSON.parse(
39
39
  options.loadConfig.replace(/^\W*'/, '').replace(/'\W*$/, ''),
@@ -168,7 +168,7 @@ def link_native_modules!(config)
168
168
 
169
169
  # Support passing in a path relative to the root of the package
170
170
  if phase["path"]
171
- phase["script"] = File.read(File.expand_path(phase["path"], package["root"]))
171
+ phase["script"] = File.read(File.expand_path(phase["path"], package[:path]))
172
172
  phase.delete("path")
173
173
  end
174
174
 
@@ -365,7 +365,7 @@ function computeOutputPath(projectRoot, baseOutputPath, pkgJson, platform) {
365
365
  if (baseOutputPath == null) {
366
366
  const outputDirFromPkgJson = readOutputDirFromPkgJson(pkgJson, platform);
367
367
  if (outputDirFromPkgJson != null) {
368
- baseOutputPath = outputDirFromPkgJson;
368
+ baseOutputPath = path.join(projectRoot, outputDirFromPkgJson);
369
369
  } else {
370
370
  baseOutputPath = projectRoot;
371
371
  }
@@ -1 +1 @@
1
- hermes-2024-06-17-RNv0.75.0-c2c4ee7dfcf4b006268ee215b63f79e9cbeedcf4
1
+ hermes-2024-07-01-RNv0.75.0-1edbe36ce92fef2c4d427f5c4e104f2758f4b692
Binary file
Binary file
Binary file