react-native-tvos 0.74.1-0 → 0.74.3-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.
Files changed (46) hide show
  1. package/Libraries/AppDelegate/RCTAppDelegate.mm +4 -1
  2. package/Libraries/AppDelegate/RCTRootViewFactory.h +8 -0
  3. package/Libraries/AppDelegate/RCTRootViewFactory.mm +11 -3
  4. package/Libraries/Components/Pressable/Pressable.js +11 -7
  5. package/Libraries/Components/TextInput/TextInput.js +6 -3
  6. package/Libraries/Core/ReactNativeVersion.js +1 -1
  7. package/Libraries/Text/TextInput/Multiline/RCTUITextView.mm +6 -0
  8. package/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h +1 -0
  9. package/Libraries/Text/TextInput/Singleline/RCTUITextField.mm +5 -0
  10. package/React/Base/RCTVersion.m +1 -1
  11. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +10 -5
  12. package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +4 -0
  13. package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +3 -2
  14. package/React/Views/ScrollView/RCTScrollView.m +32 -16
  15. package/ReactAndroid/gradle.properties +1 -1
  16. package/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java +2 -4
  17. package/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaTimerManager.java +5 -2
  18. package/ReactAndroid/src/main/java/com/facebook/react/modules/core/ReactAndroidHWInputDeviceHelper.java +20 -0
  19. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  20. package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java +20 -15
  21. package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactSurfaceView.java +5 -0
  22. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  23. package/ReactCommon/jsc/JSCRuntime.cpp +30 -2
  24. package/ReactCommon/jsi/jsi/decorator.h +7 -0
  25. package/ReactCommon/jsi/jsi/jsi.h +7 -0
  26. package/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.cpp +53 -10
  27. package/ReactCommon/react/renderer/components/textinput/platform/ios/react/renderer/components/iostextinput/TextInputEventEmitter.cpp +53 -1
  28. package/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.cpp +0 -1
  29. package/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler_Legacy.cpp +3 -3
  30. package/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler_Modern.cpp +28 -28
  31. package/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler_Modern.h +3 -3
  32. package/ReactCommon/react/renderer/runtimescheduler/Task.cpp +9 -7
  33. package/ReactCommon/react/renderer/runtimescheduler/tests/RuntimeSchedulerTest.cpp +46 -0
  34. package/cli.js +11 -3
  35. package/package.json +13 -13
  36. package/scripts/cocoapods/privacy_manifest_utils.rb +8 -7
  37. package/scripts/codegen/generate-artifacts-executor.js +1 -1
  38. package/scripts/ios-configure-glog.sh +9 -2
  39. package/scripts/react_native_pods.rb +3 -1
  40. package/sdks/.hermesversion +1 -1
  41. package/sdks/hermesc/osx-bin/hermes +0 -0
  42. package/sdks/hermesc/osx-bin/hermesc +0 -0
  43. package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
  44. package/template/package.json +6 -6
  45. package/types/public/ReactNativeTVTypes.d.ts +2 -2
  46. package/ReactCommon/react/renderer/runtimescheduler/ErrorUtils.h +0 -34
@@ -126,6 +126,9 @@ class RuntimeDecorator : public Base, private jsi::Instrumentation {
126
126
  const std::shared_ptr<const PreparedJavaScript>& js) override {
127
127
  return plain().evaluatePreparedJavaScript(js);
128
128
  }
129
+ void queueMicrotask(const jsi::Function& callback) override {
130
+ return plain().queueMicrotask(callback);
131
+ }
129
132
  bool drainMicrotasks(int maxMicrotasksHint) override {
130
133
  return plain().drainMicrotasks(maxMicrotasksHint);
131
134
  }
@@ -544,6 +547,10 @@ class WithRuntimeDecorator : public RuntimeDecorator<Plain, Base> {
544
547
  Around around{with_};
545
548
  return RD::evaluatePreparedJavaScript(js);
546
549
  }
550
+ void queueMicrotask(const Function& callback) override {
551
+ Around around{with_};
552
+ RD::queueMicrotask(callback);
553
+ }
547
554
  bool drainMicrotasks(int maxMicrotasksHint) override {
548
555
  Around around{with_};
549
556
  return RD::drainMicrotasks(maxMicrotasksHint);
@@ -209,6 +209,13 @@ class JSI_EXPORT Runtime {
209
209
  virtual Value evaluatePreparedJavaScript(
210
210
  const std::shared_ptr<const PreparedJavaScript>& js) = 0;
211
211
 
212
+ /// Queues a microtask in the JavaScript VM internal Microtask (a.k.a. Job in
213
+ /// ECMA262) queue, to be executed when the host drains microtasks in
214
+ /// its event loop implementation.
215
+ ///
216
+ /// \param callback a function to be executed as a microtask.
217
+ virtual void queueMicrotask(const jsi::Function& callback) = 0;
218
+
212
219
  /// Drain the JavaScript VM internal Microtask (a.k.a. Job in ECMA262) queue.
213
220
  ///
214
221
  /// \param maxMicrotasksHint a hint to tell an implementation that it should
@@ -86,6 +86,38 @@ struct JNIArgs {
86
86
  std::vector<jobject> globalRefs_;
87
87
  };
88
88
 
89
+ jsi::Value createJSRuntimeError(
90
+ jsi::Runtime& runtime,
91
+ const std::string& message) {
92
+ return runtime.global()
93
+ .getPropertyAsFunction(runtime, "Error")
94
+ .call(runtime, message);
95
+ }
96
+
97
+ jsi::Value createRejectionError(jsi::Runtime& rt, const folly::dynamic& args) {
98
+ react_native_assert(
99
+ args.size() == 1 && "promise reject should has only one argument");
100
+
101
+ auto value = jsi::valueFromDynamic(rt, args[0]);
102
+ react_native_assert(value.isObject() && "promise reject should return a map");
103
+
104
+ const jsi::Object& valueAsObject = value.asObject(rt);
105
+
106
+ auto messageProperty = valueAsObject.getProperty(rt, "message");
107
+ auto jsError =
108
+ createJSRuntimeError(rt, messageProperty.asString(rt).utf8(rt));
109
+
110
+ auto jsErrorAsObject = jsError.asObject(rt);
111
+ auto propertyNames = valueAsObject.getPropertyNames(rt);
112
+ for (size_t i = 0; i < propertyNames.size(rt); ++i) {
113
+ auto propertyName = jsi::PropNameID::forString(
114
+ rt, propertyNames.getValueAtIndex(rt, i).asString(rt));
115
+ jsErrorAsObject.setProperty(
116
+ rt, propertyName, valueAsObject.getProperty(rt, propertyName));
117
+ }
118
+ return jsError;
119
+ }
120
+
89
121
  auto createJavaCallback(
90
122
  jsi::Runtime& rt,
91
123
  jsi::Function&& function,
@@ -98,7 +130,6 @@ auto createJavaCallback(
98
130
  LOG(FATAL) << "Callback arg cannot be called more than once";
99
131
  return;
100
132
  }
101
-
102
133
  callback->call([args = std::move(args)](
103
134
  jsi::Runtime& rt, jsi::Function& jsFunction) {
104
135
  std::vector<jsi::Value> jsArgs;
@@ -112,6 +143,26 @@ auto createJavaCallback(
112
143
  });
113
144
  }
114
145
 
146
+ auto createJavaRejectCallback(
147
+ jsi::Runtime& rt,
148
+ jsi::Function&& function,
149
+ std::shared_ptr<CallInvoker> jsInvoker) {
150
+ std::optional<AsyncCallback<>> callback(
151
+ {rt, std::move(function), std::move(jsInvoker)});
152
+ return JCxxCallbackImpl::newObjectCxxArgs(
153
+ [callback = std::move(callback)](folly::dynamic args) mutable {
154
+ if (!callback) {
155
+ LOG(FATAL) << "Callback arg cannot be called more than once";
156
+ return;
157
+ }
158
+ callback->call([args = std::move(args)](
159
+ jsi::Runtime& rt, jsi::Function& jsFunction) {
160
+ jsFunction.call(rt, createRejectionError(rt, args));
161
+ });
162
+ callback = std::nullopt;
163
+ });
164
+ }
165
+
115
166
  struct JPromiseImpl : public jni::JavaClass<JPromiseImpl> {
116
167
  constexpr static auto kJavaDescriptor =
117
168
  "Lcom/facebook/react/bridge/PromiseImpl;";
@@ -407,14 +458,6 @@ jsi::Value convertFromJMapToValue(JNIEnv* env, jsi::Runtime& rt, jobject arg) {
407
458
  return jsi::valueFromDynamic(rt, result->cthis()->consume());
408
459
  }
409
460
 
410
- jsi::Value createJSRuntimeError(
411
- jsi::Runtime& runtime,
412
- const std::string& message) {
413
- return runtime.global()
414
- .getPropertyAsFunction(runtime, "Error")
415
- .call(runtime, message);
416
- }
417
-
418
461
  /**
419
462
  * Creates JSError with current JS runtime stack and Throwable stack trace.
420
463
  */
@@ -855,7 +898,7 @@ jsi::Value JavaTurboModule::invokeJavaMethod(
855
898
  runtime,
856
899
  args[0].getObject(runtime).getFunction(runtime),
857
900
  jsInvoker_);
858
- auto reject = createJavaCallback(
901
+ auto reject = createJavaRejectCallback(
859
902
  runtime,
860
903
  args[1].getObject(runtime).getFunction(runtime),
861
904
  jsInvoker_);
@@ -36,6 +36,56 @@ static jsi::Value textInputMetricsPayload(
36
36
  return payload;
37
37
  };
38
38
 
39
+ static jsi::Value textInputMetricsScrollPayload(
40
+ jsi::Runtime& runtime,
41
+ const TextInputMetrics& textInputMetrics) {
42
+ auto payload = jsi::Object(runtime);
43
+
44
+ {
45
+ auto contentOffset = jsi::Object(runtime);
46
+ contentOffset.setProperty(runtime, "x", textInputMetrics.contentOffset.x);
47
+ contentOffset.setProperty(runtime, "y", textInputMetrics.contentOffset.y);
48
+ payload.setProperty(runtime, "contentOffset", contentOffset);
49
+ }
50
+
51
+ {
52
+ auto contentInset = jsi::Object(runtime);
53
+ contentInset.setProperty(runtime, "top", textInputMetrics.contentInset.top);
54
+ contentInset.setProperty(
55
+ runtime, "left", textInputMetrics.contentInset.left);
56
+ contentInset.setProperty(
57
+ runtime, "bottom", textInputMetrics.contentInset.bottom);
58
+ contentInset.setProperty(
59
+ runtime, "right", textInputMetrics.contentInset.right);
60
+ payload.setProperty(runtime, "contentInset", contentInset);
61
+ }
62
+
63
+ {
64
+ auto contentSize = jsi::Object(runtime);
65
+ contentSize.setProperty(
66
+ runtime, "width", textInputMetrics.contentSize.width);
67
+ contentSize.setProperty(
68
+ runtime, "height", textInputMetrics.contentSize.height);
69
+ payload.setProperty(runtime, "contentSize", contentSize);
70
+ }
71
+
72
+ {
73
+ auto layoutMeasurement = jsi::Object(runtime);
74
+ layoutMeasurement.setProperty(
75
+ runtime, "width", textInputMetrics.layoutMeasurement.width);
76
+ layoutMeasurement.setProperty(
77
+ runtime, "height", textInputMetrics.layoutMeasurement.height);
78
+ payload.setProperty(runtime, "layoutMeasurement", layoutMeasurement);
79
+ }
80
+
81
+ payload.setProperty(
82
+ runtime,
83
+ "zoomScale",
84
+ textInputMetrics.zoomScale ? textInputMetrics.zoomScale : 1);
85
+
86
+ return payload;
87
+ };
88
+
39
89
  static jsi::Value textInputMetricsContentSizePayload(
40
90
  jsi::Runtime& runtime,
41
91
  const TextInputMetrics& textInputMetrics) {
@@ -140,7 +190,9 @@ void TextInputEventEmitter::onKeyPressSync(
140
190
 
141
191
  void TextInputEventEmitter::onScroll(
142
192
  const TextInputMetrics& textInputMetrics) const {
143
- dispatchTextInputEvent("scroll", textInputMetrics);
193
+ dispatchEvent("scroll", [textInputMetrics](jsi::Runtime& runtime) {
194
+ return textInputMetricsScrollPayload(runtime, textInputMetrics);
195
+ });
144
196
  }
145
197
 
146
198
  void TextInputEventEmitter::dispatchTextInputEvent(
@@ -13,7 +13,6 @@
13
13
  #include <react/featureflags/ReactNativeFeatureFlags.h>
14
14
  #include <react/renderer/debug/SystraceSection.h>
15
15
  #include <utility>
16
- #include "ErrorUtils.h"
17
16
 
18
17
  namespace facebook::react {
19
18
 
@@ -8,9 +8,9 @@
8
8
  #include "RuntimeScheduler_Legacy.h"
9
9
  #include "SchedulerPriorityUtils.h"
10
10
 
11
+ #include <cxxreact/ErrorUtils.h>
11
12
  #include <react/renderer/debug/SystraceSection.h>
12
13
  #include <utility>
13
- #include "ErrorUtils.h"
14
14
 
15
15
  namespace facebook::react {
16
16
 
@@ -136,7 +136,7 @@ void RuntimeScheduler_Legacy::callExpiredTasks(jsi::Runtime& runtime) {
136
136
  executeTask(runtime, topPriorityTask, didUserCallbackTimeout);
137
137
  }
138
138
  } catch (jsi::JSError& error) {
139
- handleFatalError(runtime, error);
139
+ handleJSError(runtime, error, true);
140
140
  }
141
141
 
142
142
  currentPriority_ = previousPriority;
@@ -182,7 +182,7 @@ void RuntimeScheduler_Legacy::startWorkLoop(jsi::Runtime& runtime) {
182
182
  executeTask(runtime, topPriorityTask, didUserCallbackTimeout);
183
183
  }
184
184
  } catch (jsi::JSError& error) {
185
- handleFatalError(runtime, error);
185
+ handleJSError(runtime, error, true);
186
186
  }
187
187
 
188
188
  currentPriority_ = previousPriority;
@@ -12,7 +12,6 @@
12
12
  #include <react/featureflags/ReactNativeFeatureFlags.h>
13
13
  #include <react/renderer/debug/SystraceSection.h>
14
14
  #include <utility>
15
- #include "ErrorUtils.h"
16
15
 
17
16
  namespace facebook::react {
18
17
 
@@ -104,7 +103,7 @@ bool RuntimeScheduler_Modern::getShouldYield() const noexcept {
104
103
  std::shared_lock lock(schedulingMutex_);
105
104
 
106
105
  return syncTaskRequests_ > 0 ||
107
- (!taskQueue_.empty() && taskQueue_.top() != currentTask_);
106
+ (!taskQueue_.empty() && taskQueue_.top().get() != currentTask_);
108
107
  }
109
108
 
110
109
  bool RuntimeScheduler_Modern::getIsSynchronous() const noexcept {
@@ -144,9 +143,8 @@ void RuntimeScheduler_Modern::executeNowOnTheSameThread(
144
143
  auto priority = SchedulerPriority::ImmediatePriority;
145
144
  auto expirationTime =
146
145
  currentTime + timeoutForSchedulerPriority(priority);
147
- auto task = std::make_shared<Task>(
148
- priority, std::move(callback), expirationTime);
149
146
 
147
+ auto task = Task{priority, std::move(callback), expirationTime};
150
148
  executeTask(runtime, task, currentTime);
151
149
 
152
150
  isSynchronous_ = false;
@@ -231,21 +229,17 @@ void RuntimeScheduler_Modern::startWorkLoop(
231
229
 
232
230
  auto previousPriority = currentPriority_;
233
231
 
234
- try {
235
- while (syncTaskRequests_ == 0) {
236
- auto currentTime = now_();
237
- auto topPriorityTask = selectTask(currentTime, onlyExpired);
232
+ while (syncTaskRequests_ == 0) {
233
+ auto currentTime = now_();
234
+ auto topPriorityTask = selectTask(currentTime, onlyExpired);
238
235
 
239
- if (!topPriorityTask) {
240
- // No pending work to do.
241
- // Events will restart the loop when necessary.
242
- break;
243
- }
244
-
245
- executeTask(runtime, topPriorityTask, currentTime);
236
+ if (!topPriorityTask) {
237
+ // No pending work to do.
238
+ // Events will restart the loop when necessary.
239
+ break;
246
240
  }
247
- } catch (jsi::JSError& error) {
248
- handleFatalError(runtime, error);
241
+
242
+ executeTask(runtime, *topPriorityTask, currentTime);
249
243
  }
250
244
 
251
245
  currentPriority_ = previousPriority;
@@ -280,19 +274,19 @@ std::shared_ptr<Task> RuntimeScheduler_Modern::selectTask(
280
274
 
281
275
  void RuntimeScheduler_Modern::executeTask(
282
276
  jsi::Runtime& runtime,
283
- const std::shared_ptr<Task>& task,
277
+ Task& task,
284
278
  RuntimeSchedulerTimePoint currentTime) {
285
- auto didUserCallbackTimeout = task->expirationTime <= currentTime;
279
+ auto didUserCallbackTimeout = task.expirationTime <= currentTime;
286
280
 
287
281
  SystraceSection s(
288
282
  "RuntimeScheduler::executeTask",
289
283
  "priority",
290
- serialize(task->priority),
284
+ serialize(task.priority),
291
285
  "didUserCallbackTimeout",
292
286
  didUserCallbackTimeout);
293
287
 
294
- currentTask_ = task;
295
- currentPriority_ = task->priority;
288
+ currentTask_ = &task;
289
+ currentPriority_ = task.priority;
296
290
 
297
291
  executeMacrotask(runtime, task, didUserCallbackTimeout);
298
292
 
@@ -305,6 +299,8 @@ void RuntimeScheduler_Modern::executeTask(
305
299
  // "Update the rendering" step.
306
300
  updateRendering();
307
301
  }
302
+
303
+ currentTask_ = nullptr;
308
304
  }
309
305
 
310
306
  /**
@@ -326,16 +322,20 @@ void RuntimeScheduler_Modern::updateRendering() {
326
322
 
327
323
  void RuntimeScheduler_Modern::executeMacrotask(
328
324
  jsi::Runtime& runtime,
329
- std::shared_ptr<Task> task,
325
+ Task& task,
330
326
  bool didUserCallbackTimeout) const {
331
327
  SystraceSection s("RuntimeScheduler::executeMacrotask");
332
328
 
333
- auto result = task->execute(runtime, didUserCallbackTimeout);
329
+ try {
330
+ auto result = task.execute(runtime, didUserCallbackTimeout);
334
331
 
335
- if (result.isObject() && result.getObject(runtime).isFunction(runtime)) {
336
- // If the task returned a continuation callback, we re-assign it to the task
337
- // and keep the task in the queue.
338
- task->callback = result.getObject(runtime).getFunction(runtime);
332
+ if (result.isObject() && result.getObject(runtime).isFunction(runtime)) {
333
+ // If the task returned a continuation callback, we re-assign it to the
334
+ // task and keep the task in the queue.
335
+ task.callback = result.getObject(runtime).getFunction(runtime);
336
+ }
337
+ } catch (jsi::JSError& error) {
338
+ handleJSError(runtime, error, true);
339
339
  }
340
340
  }
341
341
 
@@ -139,7 +139,7 @@ class RuntimeScheduler_Modern final : public RuntimeSchedulerBase {
139
139
  TaskPriorityComparer>
140
140
  taskQueue_;
141
141
 
142
- std::shared_ptr<Task> currentTask_;
142
+ Task* currentTask_{};
143
143
 
144
144
  /**
145
145
  * This protects the access to `taskQueue_` and `isWorkLoopScheduled_`.
@@ -168,12 +168,12 @@ class RuntimeScheduler_Modern final : public RuntimeSchedulerBase {
168
168
  */
169
169
  void executeTask(
170
170
  jsi::Runtime& runtime,
171
- const std::shared_ptr<Task>& task,
171
+ Task& task,
172
172
  RuntimeSchedulerTimePoint currentTime);
173
173
 
174
174
  void executeMacrotask(
175
175
  jsi::Runtime& runtime,
176
- std::shared_ptr<Task> task,
176
+ Task& task,
177
177
  bool didUserCallbackTimeout) const;
178
178
 
179
179
  void updateRendering();
@@ -32,20 +32,22 @@ jsi::Value Task::execute(jsi::Runtime& runtime, bool didUserCallbackTimeout) {
32
32
  return result;
33
33
  }
34
34
 
35
- auto& cbVal = callback.value();
35
+ // We get the value of the callback and reset it immediately to avoid it being
36
+ // called more than once (including when the callback throws).
37
+ auto originalCallback = std::move(*callback);
38
+ callback.reset();
36
39
 
37
- if (cbVal.index() == 0) {
40
+ if (originalCallback.index() == 0) {
38
41
  // Callback in JavaScript is expecting a single bool parameter.
39
42
  // React team plans to remove it in the future when a scheduler bug on web
40
43
  // is resolved.
41
- result =
42
- std::get<jsi::Function>(cbVal).call(runtime, {didUserCallbackTimeout});
44
+ result = std::get<jsi::Function>(originalCallback)
45
+ .call(runtime, {didUserCallbackTimeout});
43
46
  } else {
44
47
  // Calling a raw callback
45
- std::get<RawCallback>(cbVal)(runtime);
48
+ std::get<RawCallback>(originalCallback)(runtime);
46
49
  }
47
- // Destroying callback to prevent calling it twice.
48
- callback.reset();
50
+
49
51
  return result;
50
52
  }
51
53
 
@@ -1021,6 +1021,52 @@ TEST_P(RuntimeSchedulerTest, modernTwoThreadsRequestAccessToTheRuntime) {
1021
1021
  EXPECT_EQ(stubQueue_->size(), 0);
1022
1022
  }
1023
1023
 
1024
+ TEST_P(RuntimeSchedulerTest, errorInTaskShouldNotStopMicrotasks) {
1025
+ // Only for modern runtime scheduler
1026
+ if (!GetParam()) {
1027
+ return;
1028
+ }
1029
+
1030
+ auto microtaskRan = false;
1031
+ auto taskRan = false;
1032
+
1033
+ auto callback = createHostFunctionFromLambda([&](bool /* unused */) {
1034
+ taskRan = true;
1035
+
1036
+ auto microtaskCallback = jsi::Function::createFromHostFunction(
1037
+ *runtime_,
1038
+ jsi::PropNameID::forUtf8(*runtime_, "microtask1"),
1039
+ 3,
1040
+ [&](jsi::Runtime& /*unused*/,
1041
+ const jsi::Value& /*unused*/,
1042
+ const jsi::Value* /*arguments*/,
1043
+ size_t /*unused*/) -> jsi::Value {
1044
+ microtaskRan = true;
1045
+ return jsi::Value::undefined();
1046
+ });
1047
+
1048
+ runtime_->queueMicrotask(microtaskCallback);
1049
+
1050
+ throw jsi::JSError(*runtime_, "Test error");
1051
+
1052
+ return jsi::Value::undefined();
1053
+ });
1054
+
1055
+ runtimeScheduler_->scheduleTask(
1056
+ SchedulerPriority::NormalPriority, std::move(callback));
1057
+
1058
+ EXPECT_EQ(taskRan, false);
1059
+ EXPECT_EQ(microtaskRan, false);
1060
+ EXPECT_EQ(stubQueue_->size(), 1);
1061
+
1062
+ stubQueue_->tick();
1063
+
1064
+ EXPECT_EQ(taskRan, 1);
1065
+ EXPECT_EQ(microtaskRan, 1);
1066
+ EXPECT_EQ(stubQueue_->size(), 0);
1067
+ EXPECT_EQ(stubErrorUtils_->getReportFatalCallCount(), 1);
1068
+ }
1069
+
1024
1070
  INSTANTIATE_TEST_SUITE_P(
1025
1071
  UseModernRuntimeScheduler,
1026
1072
  RuntimeSchedulerTest,
package/cli.js CHANGED
@@ -17,6 +17,7 @@ const {get} = require('https');
17
17
  const {URL} = require('url');
18
18
 
19
19
  const isNpxRuntime = process.env.npm_lifecycle_event === 'npx';
20
+ const isInitCommand = process.argv[2] === 'init';
20
21
  const DEFAULT_REGISTRY_HOST =
21
22
  process.env.npm_config_registry ?? 'https://registry.npmjs.org/';
22
23
  const HEAD = '1000.0.0';
@@ -44,8 +45,10 @@ async function getLatestVersion(registryHost = DEFAULT_REGISTRY_HOST) {
44
45
  * @see https://github.com/react-native-community/discussions-and-proposals/tree/main/proposals/0759-react-native-frameworks.md
45
46
  */
46
47
  function warnWhenRunningInit() {
47
- if (process.argv[2] === 'init') {
48
- console.warn('\nRunning: npx @react-native-community/cli init\n');
48
+ if (isInitCommand) {
49
+ console.warn(
50
+ `\nRunning: ${chalk.grey.bold('npx @react-native-community/cli init')}\n`,
51
+ );
49
52
  }
50
53
  }
51
54
 
@@ -59,7 +62,12 @@ function warnWhenRunningInit() {
59
62
  *
60
63
  */
61
64
  async function main() {
62
- if (isNpxRuntime && !process.env.SKIP && currentVersion !== HEAD) {
65
+ if (
66
+ isNpxRuntime &&
67
+ !process.env.SKIP &&
68
+ currentVersion !== HEAD &&
69
+ isInitCommand
70
+ ) {
63
71
  try {
64
72
  const latest = await getLatestVersion();
65
73
  if (latest !== currentVersion) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-tvos",
3
- "version": "0.74.1-0",
3
+ "version": "0.74.3-0",
4
4
  "description": "A framework for building native apps using React",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -108,16 +108,16 @@
108
108
  },
109
109
  "dependencies": {
110
110
  "@jest/create-cache-key-function": "^29.6.3",
111
- "@react-native-community/cli": "13.6.6",
112
- "@react-native-community/cli-platform-android": "13.6.6",
113
- "@react-native-community/cli-platform-ios": "13.6.6",
114
- "@react-native/assets-registry": "0.74.83",
115
- "@react-native/codegen": "0.74.83",
116
- "@react-native/community-cli-plugin": "0.74.83",
117
- "@react-native/gradle-plugin": "0.74.83",
118
- "@react-native/js-polyfills": "0.74.83",
119
- "@react-native/normalize-colors": "0.74.83",
120
- "@react-native-tvos/virtualized-lists": "0.74.1-0",
111
+ "@react-native-community/cli": "13.6.9",
112
+ "@react-native-community/cli-platform-android": "13.6.9",
113
+ "@react-native-community/cli-platform-ios": "13.6.9",
114
+ "@react-native/assets-registry": "0.74.85",
115
+ "@react-native/codegen": "0.74.85",
116
+ "@react-native/community-cli-plugin": "0.74.85",
117
+ "@react-native/gradle-plugin": "0.74.85",
118
+ "@react-native/js-polyfills": "0.74.85",
119
+ "@react-native/normalize-colors": "0.74.85",
120
+ "@react-native-tvos/virtualized-lists": "0.74.3-0",
121
121
  "abort-controller": "^3.0.0",
122
122
  "anser": "^1.4.9",
123
123
  "ansi-regex": "^5.0.0",
@@ -142,7 +142,7 @@
142
142
  "scheduler": "0.24.0-canary-efb381bbf-20230505",
143
143
  "stacktrace-parser": "^0.1.10",
144
144
  "whatwg-fetch": "^3.0.0",
145
- "ws": "^6.2.2",
145
+ "ws": "^6.2.3",
146
146
  "yargs": "^17.6.2"
147
147
  },
148
148
  "codegenConfig": {
@@ -164,6 +164,6 @@
164
164
  ]
165
165
  },
166
166
  "devDependencies": {
167
- "react-native-core": "npm:react-native@0.74.1"
167
+ "react-native-core": "npm:react-native@0.74.3"
168
168
  }
169
169
  }
@@ -67,7 +67,7 @@ module PrivacyManifestUtils
67
67
  end
68
68
 
69
69
  def self.ensure_reference(file_path, user_project, target)
70
- reference_exists = target.resources_build_phase.files_references.any? { |file_ref| file_ref.path.end_with? "PrivacyInfo.xcprivacy" }
70
+ reference_exists = target.resources_build_phase.files_references.any? { |file_ref| file_ref.path&.end_with? "PrivacyInfo.xcprivacy" }
71
71
  unless reference_exists
72
72
  # We try to find the main group, but if it doesn't exist, we default to adding the file to the project root – both work
73
73
  file_root = user_project.root_object.main_group.children.find { |group|
@@ -80,7 +80,7 @@ module PrivacyManifestUtils
80
80
 
81
81
  def self.get_privacyinfo_file_path(user_project, targets)
82
82
  file_refs = targets.flat_map { |target| target.resources_build_phase.files_references }
83
- existing_file = file_refs.find { |file_ref| file_ref.path.end_with? "PrivacyInfo.xcprivacy" }
83
+ existing_file = file_refs.find { |file_ref| file_ref.path&.end_with? "PrivacyInfo.xcprivacy" }
84
84
  if existing_file
85
85
  return existing_file.real_path
86
86
  end
@@ -108,11 +108,12 @@ module PrivacyManifestUtils
108
108
  if File.basename(file_path) == 'PrivacyInfo.xcprivacy'
109
109
  content = Xcodeproj::Plist.read_from_path(file_path)
110
110
  accessed_api_types = content["NSPrivacyAccessedAPITypes"]
111
- accessed_api_types.each do |accessed_api|
112
- api_type = accessed_api["NSPrivacyAccessedAPIType"]
113
- reasons = accessed_api["NSPrivacyAccessedAPITypeReasons"]
114
- used_apis[api_type] ||= []
115
- used_apis[api_type] += reasons
111
+ accessed_api_types&.each do |accessed_api|
112
+ api_type = accessed_api["NSPrivacyAccessedAPIType"]
113
+ reasons = accessed_api["NSPrivacyAccessedAPITypeReasons"]
114
+ next unless api_type
115
+ used_apis[api_type] ||= []
116
+ used_apis[api_type] += reasons
116
117
  end
117
118
  end
118
119
  end
@@ -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
  }
@@ -42,8 +42,15 @@ EOF
42
42
  patch -p1 config.sub fix_glog_0.3.5_apple_silicon.patch
43
43
  fi
44
44
 
45
- export CC="$(xcrun -find -sdk $PLATFORM_NAME cc) -arch $CURRENT_ARCH -isysroot $(xcrun -sdk $PLATFORM_NAME --show-sdk-path)"
46
- export CXX="$CC"
45
+ XCRUN="$(which xcrun)"
46
+ if [ -n "$XCRUN" ]; then
47
+ export CC="$(xcrun -find -sdk $PLATFORM_NAME cc) -arch $CURRENT_ARCH -isysroot $(xcrun -sdk $PLATFORM_NAME --show-sdk-path)"
48
+ export CXX="$CC"
49
+ else
50
+ export CC="$CC:-$(which gcc)"
51
+ export CXX="$CXX:-$(which g++ || true)"
52
+ fi
53
+ export CXX="$CXX:-$CC"
47
54
 
48
55
  # Remove automake symlink if it exists
49
56
  if [ -h "test-driver" ]; then
@@ -297,7 +297,9 @@ def react_native_post_install(
297
297
  ReactNativePodsUtils.set_use_hermes_build_setting(installer, hermes_enabled)
298
298
  ReactNativePodsUtils.set_node_modules_user_settings(installer, react_native_path)
299
299
  ReactNativePodsUtils.set_ccache_compiler_and_linker_build_settings(installer, react_native_path, ccache_enabled)
300
- ReactNativePodsUtils.apply_xcode_15_patch(installer)
300
+ if Environment.new().ruby_platform().include?('darwin')
301
+ ReactNativePodsUtils.apply_xcode_15_patch(installer)
302
+ end
301
303
  ReactNativePodsUtils.updateOSDeploymentTarget(installer)
302
304
  ReactNativePodsUtils.set_dynamic_frameworks_flags(installer)
303
305
  ReactNativePodsUtils.add_ndebug_flag_to_pods_in_release(installer)
@@ -1 +1 @@
1
- hermes-2024-05-04-RNv0.74.1-8a6d0a654e022aaf283ef33b08b9ea113ee29695
1
+ hermes-2024-06-28-RNv0.74.3-8a42e289991d48575dcb4012ea9205d707dac43d
Binary file
Binary file
Binary file