react-native 0.76.4 → 0.76.5

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.
@@ -16,7 +16,7 @@ const version: $ReadOnly<{
16
16
  }> = {
17
17
  major: 0,
18
18
  minor: 76,
19
- patch: 4,
19
+ patch: 5,
20
20
  prerelease: null,
21
21
  };
22
22
 
@@ -36,6 +36,7 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
36
36
  {
37
37
  if (![self isDescendantOfView:scrollView]) {
38
38
  // View is outside scroll view
39
+ scrollView.firstResponderViewOutsideScrollView = self.backedTextInputView;
39
40
  return;
40
41
  }
41
42
 
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(76),
26
- RCTVersionPatch: @(4),
26
+ RCTVersionPatch: @(5),
27
27
  RCTVersionPrerelease: [NSNull null],
28
28
  };
29
29
  });
@@ -38,6 +38,9 @@ NS_ASSUME_NONNULL_BEGIN
38
38
  /** Focus area of newly-activated text input relative to the window to compare against UIKeyboardFrameBegin/End */
39
39
  @property (nonatomic, assign) CGRect firstResponderFocus;
40
40
 
41
+ /** newly-activated text input outside of the scroll view */
42
+ @property (nonatomic, weak) UIView *firstResponderViewOutsideScrollView;
43
+
41
44
  /*
42
45
  * Returns the subview of the scroll view that the component uses to mount all subcomponents into. That's useful to
43
46
  * separate component views from auxiliary views to be able to reliably implement pull-to-refresh- and RTL-related
@@ -182,16 +182,18 @@ RCTSendScrollEventForNativeAnimations_DEPRECATED(UIScrollView *scrollView, NSInt
182
182
  UIViewAnimationCurve curve =
183
183
  (UIViewAnimationCurve)[notification.userInfo[UIKeyboardAnimationCurveUserInfoKey] unsignedIntegerValue];
184
184
  CGRect keyboardEndFrame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
185
+ CGRect keyboardBeginFrame = [notification.userInfo[UIKeyboardFrameBeginUserInfoKey] CGRectValue];
185
186
 
186
187
  CGPoint absoluteViewOrigin = [self convertPoint:self.bounds.origin toView:nil];
187
188
  CGFloat scrollViewLowerY = isInverted ? absoluteViewOrigin.y : absoluteViewOrigin.y + self.bounds.size.height;
188
189
 
189
190
  UIEdgeInsets newEdgeInsets = _scrollView.contentInset;
190
191
  CGFloat inset = MAX(scrollViewLowerY - keyboardEndFrame.origin.y, 0);
192
+ const auto &props = static_cast<const ScrollViewProps &>(*_props);
191
193
  if (isInverted) {
192
- newEdgeInsets.top = MAX(inset, _scrollView.contentInset.top);
194
+ newEdgeInsets.top = MAX(inset, props.contentInset.top);
193
195
  } else {
194
- newEdgeInsets.bottom = MAX(inset, _scrollView.contentInset.bottom);
196
+ newEdgeInsets.bottom = MAX(inset, props.contentInset.bottom);
195
197
  }
196
198
 
197
199
  CGPoint newContentOffset = _scrollView.contentOffset;
@@ -203,21 +205,18 @@ RCTSendScrollEventForNativeAnimations_DEPRECATED(UIScrollView *scrollView, NSInt
203
205
  from:self
204
206
  forEvent:nil]) {
205
207
  if (CGRectEqualToRect(_firstResponderFocus, CGRectNull)) {
206
- // Text input view is outside of the scroll view.
207
- return;
208
- }
209
-
210
- CGRect viewIntersection = CGRectIntersection(self.firstResponderFocus, keyboardEndFrame);
211
-
212
- if (CGRectIsNull(viewIntersection)) {
213
- return;
214
- }
215
-
216
- // Inner text field focused
217
- CGFloat focusEnd = CGRectGetMaxY(self.firstResponderFocus);
218
- if (focusEnd > keyboardEndFrame.origin.y) {
219
- // Text field active region is below visible area with keyboard - update diff to bring into view
220
- contentDiff = keyboardEndFrame.origin.y - focusEnd;
208
+ UIView *inputAccessoryView = _firstResponderViewOutsideScrollView.inputAccessoryView;
209
+ if (inputAccessoryView) {
210
+ // Text input view is within the inputAccessoryView.
211
+ contentDiff = keyboardEndFrame.origin.y - keyboardBeginFrame.origin.y;
212
+ }
213
+ } else {
214
+ // Inner text field focused
215
+ CGFloat focusEnd = CGRectGetMaxY(self.firstResponderFocus);
216
+ if (focusEnd > keyboardEndFrame.origin.y) {
217
+ // Text field active region is below visible area with keyboard - update diff to bring into view
218
+ contentDiff = keyboardEndFrame.origin.y - focusEnd;
219
+ }
221
220
  }
222
221
  }
223
222
 
@@ -243,7 +242,7 @@ RCTSendScrollEventForNativeAnimations_DEPRECATED(UIScrollView *scrollView, NSInt
243
242
  animations:^{
244
243
  self->_scrollView.contentInset = newEdgeInsets;
245
244
  self->_scrollView.verticalScrollIndicatorInsets = newEdgeInsets;
246
- [self scrollToOffset:newContentOffset animated:NO];
245
+ [self scrollTo:newContentOffset.x y:newContentOffset.y animated:NO];
247
246
  }
248
247
  completion:nil];
249
248
  }
@@ -126,6 +126,7 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
126
126
  {
127
127
  if (![self isDescendantOfView:scrollView.scrollView] || !_backedTextInputView.isFirstResponder) {
128
128
  // View is outside scroll view or it's not a first responder.
129
+ scrollView.firstResponderViewOutsideScrollView = _backedTextInputView;
129
130
  return;
130
131
  }
131
132
 
@@ -50,6 +50,8 @@
50
50
  @property (nonatomic, assign) BOOL inverted;
51
51
  /** Focus area of newly-activated text input relative to the window to compare against UIKeyboardFrameBegin/End */
52
52
  @property (nonatomic, assign) CGRect firstResponderFocus;
53
+ /** newly-activated text input outside of the scroll view */
54
+ @property (nonatomic, weak) UIView *firstResponderViewOutsideScrollView;
53
55
 
54
56
  // NOTE: currently these event props are only declared so we can export the
55
57
  // event names to JS - we don't call the blocks directly because scroll events
@@ -338,6 +338,12 @@ static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCu
338
338
  if (!didFocusExternalTextField && focusEnd > endFrame.origin.y) {
339
339
  // Text field active region is below visible area with keyboard - update diff to bring into view
340
340
  contentDiff = endFrame.origin.y - focusEnd;
341
+ } else {
342
+ UIView *inputAccessoryView = _firstResponderViewOutsideScrollView.inputAccessoryView;
343
+ if (inputAccessoryView) {
344
+ // Text input view is within the inputAccessoryView.
345
+ contentDiff = endFrame.origin.y - beginFrame.origin.y;
346
+ }
341
347
  }
342
348
  } else if (endFrame.origin.y <= beginFrame.origin.y) {
343
349
  // Keyboard opened for other reason
@@ -29,12 +29,7 @@
29
29
 
30
30
  #include <DefaultComponentsRegistry.h>
31
31
  #include <DefaultTurboModuleManagerDelegate.h>
32
- #if __has_include("<autolinking.h>")
33
- #define AUTOLINKING_AVAILABLE 1
34
32
  #include <autolinking.h>
35
- #else
36
- #define AUTOLINKING_AVAILABLE 0
37
- #endif
38
33
  #include <fbjni/fbjni.h>
39
34
  #include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
40
35
  #include <rncore.h>
@@ -61,10 +56,8 @@ void registerComponents(
61
56
  REACT_NATIVE_APP_COMPONENT_REGISTRATION(registry);
62
57
  #endif
63
58
 
64
- #if AUTOLINKING_AVAILABLE
65
59
  // And we fallback to the components autolinked
66
60
  autolinking_registerProviders(registry);
67
- #endif
68
61
  }
69
62
 
70
63
  std::shared_ptr<TurboModule> cxxModuleProvider(
@@ -78,12 +71,8 @@ std::shared_ptr<TurboModule> cxxModuleProvider(
78
71
  // return std::make_shared<NativeCxxModuleExample>(jsInvoker);
79
72
  // }
80
73
 
81
- #if AUTOLINKING_AVAILABLE
82
74
  // And we fallback to the CXX module providers autolinked
83
75
  return autolinking_cxxModuleProvider(name, jsInvoker);
84
- #endif
85
-
86
- return nullptr;
87
76
  }
88
77
 
89
78
  std::shared_ptr<TurboModule> javaModuleProvider(
@@ -112,12 +101,10 @@ std::shared_ptr<TurboModule> javaModuleProvider(
112
101
  return module;
113
102
  }
114
103
 
115
- #if AUTOLINKING_AVAILABLE
116
104
  // And we fallback to the module providers autolinked
117
105
  if (auto module = autolinking_ModuleProvider(name, params)) {
118
106
  return module;
119
107
  }
120
- #endif
121
108
 
122
109
  return nullptr;
123
110
  }
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.76.4
1
+ VERSION_NAME=0.76.5
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 (ReactFeatureFlags.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
  }
@@ -17,6 +17,6 @@ public class ReactNativeVersion {
17
17
  public static final Map<String, Object> VERSION = MapBuilder.<String, Object>of(
18
18
  "major", 0,
19
19
  "minor", 76,
20
- "patch", 4,
20
+ "patch", 5,
21
21
  "prerelease", null);
22
22
  }
@@ -17,7 +17,7 @@ namespace facebook::react {
17
17
  constexpr struct {
18
18
  int32_t Major = 0;
19
19
  int32_t Minor = 76;
20
- int32_t Patch = 4;
20
+ int32_t Patch = 5;
21
21
  std::string_view Prerelease = "";
22
22
  } ReactNativeVersion;
23
23
 
@@ -204,47 +204,51 @@ std::string simpleBasename(const std::string& path) {
204
204
  */
205
205
  void ReactInstance::loadScript(
206
206
  std::unique_ptr<const JSBigString> script,
207
- const std::string& sourceURL) {
207
+ const std::string& sourceURL,
208
+ std::function<void(jsi::Runtime& runtime)>&& completion) {
208
209
  auto buffer = std::make_shared<BigStringBuffer>(std::move(script));
209
210
  std::string scriptName = simpleBasename(sourceURL);
210
211
 
211
- runtimeScheduler_->scheduleWork(
212
- [this,
213
- scriptName,
214
- sourceURL,
215
- buffer = std::move(buffer),
216
- weakBufferedRuntimeExecuter = std::weak_ptr<BufferedRuntimeExecutor>(
217
- bufferedRuntimeExecutor_)](jsi::Runtime& runtime) {
218
- SystraceSection s("ReactInstance::loadScript");
219
- bool hasLogger(ReactMarker::logTaggedMarkerBridgelessImpl);
220
- if (hasLogger) {
221
- ReactMarker::logTaggedMarkerBridgeless(
222
- ReactMarker::RUN_JS_BUNDLE_START, scriptName.c_str());
223
- }
212
+ runtimeScheduler_->scheduleWork([this,
213
+ scriptName,
214
+ sourceURL,
215
+ buffer = std::move(buffer),
216
+ weakBufferedRuntimeExecuter =
217
+ std::weak_ptr<BufferedRuntimeExecutor>(
218
+ bufferedRuntimeExecutor_),
219
+ completion](jsi::Runtime& runtime) {
220
+ SystraceSection s("ReactInstance::loadScript");
221
+ bool hasLogger(ReactMarker::logTaggedMarkerBridgelessImpl);
222
+ if (hasLogger) {
223
+ ReactMarker::logTaggedMarkerBridgeless(
224
+ ReactMarker::RUN_JS_BUNDLE_START, scriptName.c_str());
225
+ }
224
226
 
225
- runtime.evaluateJavaScript(buffer, sourceURL);
227
+ runtime.evaluateJavaScript(buffer, sourceURL);
226
228
 
227
- /**
228
- * TODO(T183610671): We need a safe/reliable way to enable the js
229
- * pipeline from javascript. Remove this after we figure that out, or
230
- * after we just remove the js pipeline.
231
- */
232
- if (!jsErrorHandler_->hasHandledFatalError()) {
233
- jsErrorHandler_->setRuntimeReady();
234
- }
229
+ /**
230
+ * TODO(T183610671): We need a safe/reliable way to enable the js
231
+ * pipeline from javascript. Remove this after we figure that out, or
232
+ * after we just remove the js pipeline.
233
+ */
234
+ if (!jsErrorHandler_->hasHandledFatalError()) {
235
+ jsErrorHandler_->setRuntimeReady();
236
+ }
235
237
 
236
- if (hasLogger) {
237
- ReactMarker::logTaggedMarkerBridgeless(
238
- ReactMarker::RUN_JS_BUNDLE_STOP, scriptName.c_str());
239
- ReactMarker::logMarkerBridgeless(
240
- ReactMarker::INIT_REACT_RUNTIME_STOP);
241
- ReactMarker::logMarkerBridgeless(ReactMarker::APP_STARTUP_STOP);
242
- }
243
- if (auto strongBufferedRuntimeExecuter =
244
- weakBufferedRuntimeExecuter.lock()) {
245
- strongBufferedRuntimeExecuter->flush();
246
- }
247
- });
238
+ if (hasLogger) {
239
+ ReactMarker::logTaggedMarkerBridgeless(
240
+ ReactMarker::RUN_JS_BUNDLE_STOP, scriptName.c_str());
241
+ ReactMarker::logMarkerBridgeless(ReactMarker::INIT_REACT_RUNTIME_STOP);
242
+ ReactMarker::logMarkerBridgeless(ReactMarker::APP_STARTUP_STOP);
243
+ }
244
+ if (auto strongBufferedRuntimeExecuter =
245
+ weakBufferedRuntimeExecuter.lock()) {
246
+ strongBufferedRuntimeExecuter->flush();
247
+ }
248
+ if (completion) {
249
+ completion(runtime);
250
+ }
251
+ });
248
252
  }
249
253
 
250
254
  /*
@@ -48,7 +48,8 @@ class ReactInstance final : private jsinspector_modern::InstanceTargetDelegate {
48
48
 
49
49
  void loadScript(
50
50
  std::unique_ptr<const JSBigString> script,
51
- const std::string& sourceURL);
51
+ const std::string& sourceURL,
52
+ std::function<void(jsi::Runtime& runtime)>&& completion = nullptr);
52
53
 
53
54
  void registerSegment(uint32_t segmentId, const std::string& segmentPath);
54
55
 
@@ -470,8 +470,9 @@ void RCTInstanceSetRuntimeDiagnosticFlags(NSString *flags)
470
470
 
471
471
  auto script = std::make_unique<NSDataBigString>(source.data);
472
472
  const auto *url = deriveSourceURL(source.url).UTF8String;
473
- _reactInstance->loadScript(std::move(script), url);
474
- [[NSNotificationCenter defaultCenter] postNotificationName:@"RCTInstanceDidLoadBundle" object:nil];
473
+ _reactInstance->loadScript(std::move(script), url, [](jsi::Runtime &_) {
474
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"RCTInstanceDidLoadBundle" object:nil];
475
+ });
475
476
  }
476
477
 
477
478
  - (void)_handleJSError:(const JsErrorHandler::ParsedError &)error
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native",
3
- "version": "0.76.4",
3
+ "version": "0.76.5",
4
4
  "description": "A framework for building native apps using React",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -109,13 +109,13 @@
109
109
  },
110
110
  "dependencies": {
111
111
  "@jest/create-cache-key-function": "^29.6.3",
112
- "@react-native/assets-registry": "0.76.4",
113
- "@react-native/codegen": "0.76.4",
114
- "@react-native/community-cli-plugin": "0.76.4",
115
- "@react-native/gradle-plugin": "0.76.4",
116
- "@react-native/js-polyfills": "0.76.4",
117
- "@react-native/normalize-colors": "0.76.4",
118
- "@react-native/virtualized-lists": "0.76.4",
112
+ "@react-native/assets-registry": "0.76.5",
113
+ "@react-native/codegen": "0.76.5",
114
+ "@react-native/community-cli-plugin": "0.76.5",
115
+ "@react-native/gradle-plugin": "0.76.5",
116
+ "@react-native/js-polyfills": "0.76.5",
117
+ "@react-native/normalize-colors": "0.76.5",
118
+ "@react-native/virtualized-lists": "0.76.5",
119
119
  "abort-controller": "^3.0.0",
120
120
  "anser": "^1.4.9",
121
121
  "ansi-regex": "^5.0.0",
@@ -311,12 +311,27 @@ function findNotLinkedLibraries(projectRoot) {
311
311
  Object.keys(rnConfig.dependencies).forEach(name => {
312
312
  const dependency = rnConfig.dependencies[name];
313
313
  let notLinkedPlatforms = [];
314
- Object.keys(dependency.platforms).forEach(platform => {
314
+
315
+ // dependency.platforms might not be defined, as the format
316
+ // {
317
+ // "dependencies": {
318
+ // "dependency-name": {
319
+ // "root": "path/to/dependency",
320
+ // }
321
+ // }
322
+ // }
323
+ // is also supported.
324
+ // In this case, we assume that the library is linked to all platforms.
325
+ // We don't consider the case were `dependency-name.root` is equal to `null`, because that
326
+ // means that the library is not linked to the app at all, and in that case the dependency
327
+ // should be removed by the user.
328
+ dependency.platforms && Object.keys(dependency.platforms).forEach(platform => {
315
329
  if (dependency.platforms[platform] == null) {
316
330
  notLinkedPlatforms.push(platform);
317
331
  }
318
332
  });
319
333
  notLinkedLibraries[name] = notLinkedPlatforms;
334
+
320
335
  });
321
336
  return notLinkedLibraries;
322
337
  }
Binary file
Binary file
Binary file