react-native 0.77.0-rc.1 → 0.77.0-rc.2

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.
@@ -165,7 +165,7 @@ export default class Animation {
165
165
  const callback = this.#onEnd;
166
166
  if (callback != null) {
167
167
  this.#onEnd = null;
168
- queueMicrotask(() => callback(result));
168
+ callback(result);
169
169
  }
170
170
  }
171
171
  }
@@ -17,7 +17,7 @@ const version: $ReadOnly<{
17
17
  major: 0,
18
18
  minor: 77,
19
19
  patch: 0,
20
- prerelease: 'rc.1',
20
+ prerelease: 'rc.2',
21
21
  };
22
22
 
23
23
  module.exports = {version};
@@ -24,7 +24,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(77),
26
26
  RCTVersionPatch: @(0),
27
- RCTVersionPrerelease: @"rc.1",
27
+ RCTVersionPrerelease: @"rc.2",
28
28
  };
29
29
  });
30
30
  return __rnVersion;
@@ -189,10 +189,11 @@ RCTSendScrollEventForNativeAnimations_DEPRECATED(UIScrollView *scrollView, NSInt
189
189
 
190
190
  UIEdgeInsets newEdgeInsets = _scrollView.contentInset;
191
191
  CGFloat inset = MAX(scrollViewLowerY - keyboardEndFrame.origin.y, 0);
192
+ const auto &props = static_cast<const ScrollViewProps &>(*_props);
192
193
  if (isInverted) {
193
- newEdgeInsets.top = MAX(inset, _scrollView.contentInset.top);
194
+ newEdgeInsets.top = MAX(inset, props.contentInset.top);
194
195
  } else {
195
- newEdgeInsets.bottom = MAX(inset, _scrollView.contentInset.bottom);
196
+ newEdgeInsets.bottom = MAX(inset, props.contentInset.bottom);
196
197
  }
197
198
 
198
199
  CGPoint newContentOffset = _scrollView.contentOffset;
@@ -210,12 +211,6 @@ RCTSendScrollEventForNativeAnimations_DEPRECATED(UIScrollView *scrollView, NSInt
210
211
  contentDiff = keyboardEndFrame.origin.y - keyboardBeginFrame.origin.y;
211
212
  }
212
213
  } else {
213
- CGRect viewIntersection = CGRectIntersection(self.firstResponderFocus, keyboardEndFrame);
214
-
215
- if (CGRectIsNull(viewIntersection)) {
216
- return;
217
- }
218
-
219
214
  // Inner text field focused
220
215
  CGFloat focusEnd = CGRectGetMaxY(self.firstResponderFocus);
221
216
  if (focusEnd > keyboardEndFrame.origin.y) {
@@ -247,7 +242,7 @@ RCTSendScrollEventForNativeAnimations_DEPRECATED(UIScrollView *scrollView, NSInt
247
242
  animations:^{
248
243
  self->_scrollView.contentInset = newEdgeInsets;
249
244
  self->_scrollView.verticalScrollIndicatorInsets = newEdgeInsets;
250
- [self scrollToOffset:newContentOffset animated:NO];
245
+ [self scrollTo:newContentOffset.x y:newContentOffset.y animated:NO];
251
246
  }
252
247
  completion:nil];
253
248
  }
@@ -2963,6 +2963,7 @@ public abstract interface annotation class com/facebook/react/module/annotations
2963
2963
  public final class com/facebook/react/module/model/ReactModuleInfo {
2964
2964
  public static final field Companion Lcom/facebook/react/module/model/ReactModuleInfo$Companion;
2965
2965
  public fun <init> (Ljava/lang/String;Ljava/lang/String;ZZZZ)V
2966
+ public fun <init> (Ljava/lang/String;Ljava/lang/String;ZZZZZ)V
2966
2967
  public final fun canOverrideExistingModule ()Z
2967
2968
  public static final fun classIsTurboModule (Ljava/lang/Class;)Z
2968
2969
  public final fun className ()Ljava/lang/String;
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.77.0-rc.1
1
+ VERSION_NAME=0.77.0-rc.2
2
2
  react.internal.publishingGroup=com.facebook.react
3
3
 
4
4
  android.useAndroidX=true
@@ -179,31 +179,30 @@ public abstract class HeadlessJsTaskService extends Service implements HeadlessJ
179
179
  }
180
180
 
181
181
  private void createReactContextAndScheduleTask(final HeadlessJsTaskConfig taskConfig) {
182
- final ReactHost reactHost = getReactHost();
183
-
184
- if (reactHost == null) { // old arch
185
- final ReactInstanceManager reactInstanceManager =
186
- getReactNativeHost().getReactInstanceManager();
187
-
188
- reactInstanceManager.addReactInstanceEventListener(
182
+ if (ReactNativeFeatureFlags.enableBridgelessArchitecture()) {
183
+ final ReactHost reactHost = getReactHost();
184
+ reactHost.addReactInstanceEventListener(
189
185
  new ReactInstanceEventListener() {
190
186
  @Override
191
187
  public void onReactContextInitialized(@NonNull ReactContext reactContext) {
192
188
  invokeStartTask(reactContext, taskConfig);
193
- reactInstanceManager.removeReactInstanceEventListener(this);
189
+ reactHost.removeReactInstanceEventListener(this);
194
190
  }
195
191
  });
196
- reactInstanceManager.createReactContextInBackground();
197
- } else { // new arch
198
- reactHost.addReactInstanceEventListener(
192
+ reactHost.start();
193
+ } else {
194
+ final ReactInstanceManager reactInstanceManager =
195
+ getReactNativeHost().getReactInstanceManager();
196
+
197
+ reactInstanceManager.addReactInstanceEventListener(
199
198
  new ReactInstanceEventListener() {
200
199
  @Override
201
200
  public void onReactContextInitialized(@NonNull ReactContext reactContext) {
202
201
  invokeStartTask(reactContext, taskConfig);
203
- reactHost.removeReactInstanceEventListener(this);
202
+ reactInstanceManager.removeReactInstanceEventListener(this);
204
203
  }
205
204
  });
206
- reactHost.start();
205
+ reactInstanceManager.createReactContextInBackground();
207
206
  }
208
207
  }
209
208
  }
@@ -21,6 +21,24 @@ public class ReactModuleInfo(
21
21
  public val isCxxModule: Boolean,
22
22
  public val isTurboModule: Boolean
23
23
  ) {
24
+
25
+ @Deprecated(
26
+ "This constructor is deprecated and will be removed in the future. Use ReactModuleInfo(String, String, boolean, boolean, boolean, boolean)]",
27
+ replaceWith =
28
+ ReplaceWith(
29
+ expression =
30
+ "ReactModuleInfo(name, className, canOverrideExistingModule, needsEagerInit, isCxxModule, isTurboModule)"),
31
+ level = DeprecationLevel.WARNING)
32
+ public constructor(
33
+ name: String,
34
+ className: String,
35
+ canOverrideExistingModule: Boolean,
36
+ needsEagerInit: Boolean,
37
+ @Suppress("UNUSED_PARAMETER") hasConstants: Boolean,
38
+ isCxxModule: Boolean,
39
+ isTurboModule: Boolean
40
+ ) : this(name, className, canOverrideExistingModule, needsEagerInit, isCxxModule, isTurboModule)
41
+
24
42
  public companion object {
25
43
  /**
26
44
  * Checks if the passed class is a TurboModule. Useful to populate the parameter [isTurboModule]
@@ -18,5 +18,5 @@ public class ReactNativeVersion {
18
18
  "major", 0,
19
19
  "minor", 77,
20
20
  "patch", 0,
21
- "prerelease", "rc.1");
21
+ "prerelease", "rc.2");
22
22
  }
@@ -18,7 +18,7 @@ constexpr struct {
18
18
  int32_t Major = 0;
19
19
  int32_t Minor = 77;
20
20
  int32_t Patch = 0;
21
- std::string_view Prerelease = "rc.1";
21
+ std::string_view Prerelease = "rc.2";
22
22
  } ReactNativeVersion;
23
23
 
24
24
  } // namespace facebook::react
@@ -236,47 +236,51 @@ std::string simpleBasename(const std::string& path) {
236
236
  */
237
237
  void ReactInstance::loadScript(
238
238
  std::unique_ptr<const JSBigString> script,
239
- const std::string& sourceURL) {
239
+ const std::string& sourceURL,
240
+ std::function<void(jsi::Runtime& runtime)>&& completion) {
240
241
  auto buffer = std::make_shared<BigStringBuffer>(std::move(script));
241
242
  std::string scriptName = simpleBasename(sourceURL);
242
243
 
243
- runtimeScheduler_->scheduleWork(
244
- [this,
245
- scriptName,
246
- sourceURL,
247
- buffer = std::move(buffer),
248
- weakBufferedRuntimeExecuter = std::weak_ptr<BufferedRuntimeExecutor>(
249
- bufferedRuntimeExecutor_)](jsi::Runtime& runtime) {
250
- SystraceSection s("ReactInstance::loadScript");
251
- bool hasLogger(ReactMarker::logTaggedMarkerBridgelessImpl);
252
- if (hasLogger) {
253
- ReactMarker::logTaggedMarkerBridgeless(
254
- ReactMarker::RUN_JS_BUNDLE_START, scriptName.c_str());
255
- }
244
+ runtimeScheduler_->scheduleWork([this,
245
+ scriptName,
246
+ sourceURL,
247
+ buffer = std::move(buffer),
248
+ weakBufferedRuntimeExecuter =
249
+ std::weak_ptr<BufferedRuntimeExecutor>(
250
+ bufferedRuntimeExecutor_),
251
+ completion](jsi::Runtime& runtime) {
252
+ SystraceSection s("ReactInstance::loadScript");
253
+ bool hasLogger(ReactMarker::logTaggedMarkerBridgelessImpl);
254
+ if (hasLogger) {
255
+ ReactMarker::logTaggedMarkerBridgeless(
256
+ ReactMarker::RUN_JS_BUNDLE_START, scriptName.c_str());
257
+ }
256
258
 
257
- runtime.evaluateJavaScript(buffer, sourceURL);
259
+ runtime.evaluateJavaScript(buffer, sourceURL);
258
260
 
259
- /**
260
- * TODO(T183610671): We need a safe/reliable way to enable the js
261
- * pipeline from javascript. Remove this after we figure that out, or
262
- * after we just remove the js pipeline.
263
- */
264
- if (!jsErrorHandler_->hasHandledFatalError()) {
265
- jsErrorHandler_->setRuntimeReady();
266
- }
261
+ /**
262
+ * TODO(T183610671): We need a safe/reliable way to enable the js
263
+ * pipeline from javascript. Remove this after we figure that out, or
264
+ * after we just remove the js pipeline.
265
+ */
266
+ if (!jsErrorHandler_->hasHandledFatalError()) {
267
+ jsErrorHandler_->setRuntimeReady();
268
+ }
267
269
 
268
- if (hasLogger) {
269
- ReactMarker::logTaggedMarkerBridgeless(
270
- ReactMarker::RUN_JS_BUNDLE_STOP, scriptName.c_str());
271
- ReactMarker::logMarkerBridgeless(
272
- ReactMarker::INIT_REACT_RUNTIME_STOP);
273
- ReactMarker::logMarkerBridgeless(ReactMarker::APP_STARTUP_STOP);
274
- }
275
- if (auto strongBufferedRuntimeExecuter =
276
- weakBufferedRuntimeExecuter.lock()) {
277
- strongBufferedRuntimeExecuter->flush();
278
- }
279
- });
270
+ if (hasLogger) {
271
+ ReactMarker::logTaggedMarkerBridgeless(
272
+ ReactMarker::RUN_JS_BUNDLE_STOP, scriptName.c_str());
273
+ ReactMarker::logMarkerBridgeless(ReactMarker::INIT_REACT_RUNTIME_STOP);
274
+ ReactMarker::logMarkerBridgeless(ReactMarker::APP_STARTUP_STOP);
275
+ }
276
+ if (auto strongBufferedRuntimeExecuter =
277
+ weakBufferedRuntimeExecuter.lock()) {
278
+ strongBufferedRuntimeExecuter->flush();
279
+ }
280
+ if (completion) {
281
+ completion(runtime);
282
+ }
283
+ });
280
284
  }
281
285
 
282
286
  /*
@@ -49,7 +49,8 @@ class ReactInstance final : private jsinspector_modern::InstanceTargetDelegate {
49
49
 
50
50
  void loadScript(
51
51
  std::unique_ptr<const JSBigString> script,
52
- const std::string& sourceURL);
52
+ const std::string& sourceURL,
53
+ std::function<void(jsi::Runtime& runtime)>&& completion = nullptr);
53
54
 
54
55
  void registerSegment(uint32_t segmentId, const std::string& segmentPath);
55
56
 
@@ -472,8 +472,9 @@ void RCTInstanceSetRuntimeDiagnosticFlags(NSString *flags)
472
472
 
473
473
  auto script = std::make_unique<NSDataBigString>(source.data);
474
474
  const auto *url = deriveSourceURL(source.url).UTF8String;
475
- _reactInstance->loadScript(std::move(script), url);
476
- [[NSNotificationCenter defaultCenter] postNotificationName:@"RCTInstanceDidLoadBundle" object:nil];
475
+ _reactInstance->loadScript(std::move(script), url, [](jsi::Runtime &_) {
476
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"RCTInstanceDidLoadBundle" object:nil];
477
+ });
477
478
  }
478
479
 
479
480
  - (void)_handleJSError:(const JsErrorHandler::ParsedError &)error withRuntime:(jsi::Runtime &)runtime
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native",
3
- "version": "0.77.0-rc.1",
3
+ "version": "0.77.0-rc.2",
4
4
  "description": "A framework for building native apps using React",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -108,13 +108,13 @@
108
108
  },
109
109
  "dependencies": {
110
110
  "@jest/create-cache-key-function": "^29.6.3",
111
- "@react-native/assets-registry": "0.77.0-rc.1",
112
- "@react-native/codegen": "0.77.0-rc.1",
113
- "@react-native/community-cli-plugin": "0.77.0-rc.1",
114
- "@react-native/gradle-plugin": "0.77.0-rc.1",
115
- "@react-native/js-polyfills": "0.77.0-rc.1",
116
- "@react-native/normalize-colors": "0.77.0-rc.1",
117
- "@react-native/virtualized-lists": "0.77.0-rc.1",
111
+ "@react-native/assets-registry": "0.77.0-rc.2",
112
+ "@react-native/codegen": "0.77.0-rc.2",
113
+ "@react-native/community-cli-plugin": "0.77.0-rc.2",
114
+ "@react-native/gradle-plugin": "0.77.0-rc.2",
115
+ "@react-native/js-polyfills": "0.77.0-rc.2",
116
+ "@react-native/normalize-colors": "0.77.0-rc.2",
117
+ "@react-native/virtualized-lists": "0.77.0-rc.2",
118
118
  "abort-controller": "^3.0.0",
119
119
  "anser": "^1.4.9",
120
120
  "ansi-regex": "^5.0.0",
@@ -778,6 +778,11 @@ function findFilesWithExtension(filePath, extension) {
778
778
  // Given a filepath, read the file and look for a string that starts with 'Class<RCTComponentViewProtocol> '
779
779
  // and ends with 'Cls(void)'. Return the string between the two.
780
780
  function findRCTComponentViewProtocolClass(filepath) {
781
+ // Exclude files provided by react-native
782
+ if (filepath.includes(`${path.sep}react-native${path.sep}`)) {
783
+ return null;
784
+ }
785
+
781
786
  const fileContent = fs.readFileSync(filepath, 'utf8');
782
787
  const regex = /Class<RCTComponentViewProtocol> (.*)Cls\(/;
783
788
  const match = fileContent.match(regex);
Binary file
Binary file
Binary file