react-native-macos 0.0.0-081d66e4e → 0.0.0-08d0c3b4f

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 (84) hide show
  1. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
  2. package/Libraries/Components/TextInput/TextInput.js +77 -1
  3. package/Libraries/Components/View/ReactNativeViewAttributes.js +1 -0
  4. package/Libraries/Core/ReactNativeVersion.js +1 -1
  5. package/Libraries/Image/RCTImageView.mm +14 -10
  6. package/Libraries/Lists/VirtualizedList.js +13 -1
  7. package/Libraries/Text/BaseText/RCTBaseTextViewManager.m +1 -0
  8. package/Libraries/Text/RCTTextAttributes.h +2 -0
  9. package/Libraries/Text/RCTTextAttributes.m +9 -0
  10. package/Libraries/Text/Text/RCTDynamicTypeRamp.h +40 -0
  11. package/Libraries/Text/Text/RCTDynamicTypeRamp.m +77 -0
  12. package/Libraries/Text/Text/RCTTextView.m +118 -47
  13. package/Libraries/Text/Text.js +0 -8
  14. package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.h +8 -0
  15. package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m +57 -4
  16. package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.m +13 -0
  17. package/Libraries/Text/TextInput/Multiline/RCTUITextView.h +2 -1
  18. package/Libraries/Text/TextInput/Multiline/RCTUITextView.m +36 -4
  19. package/Libraries/Text/TextInput/RCTBackedTextInputDelegate.h +2 -0
  20. package/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m +6 -1
  21. package/Libraries/Text/TextInput/RCTBaseTextInputView.h +4 -1
  22. package/Libraries/Text/TextInput/RCTBaseTextInputView.m +57 -0
  23. package/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m +6 -1
  24. package/Libraries/Text/TextInput/Singleline/RCTUITextField.m +16 -0
  25. package/Libraries/Text/TextNativeComponent.js +2 -0
  26. package/Libraries/Text/TextProps.js +29 -0
  27. package/React/Base/RCTAssert.h +4 -3
  28. package/React/Base/RCTAssert.m +11 -2
  29. package/React/Base/RCTBridge.m +1 -1
  30. package/React/Base/RCTConstants.h +6 -0
  31. package/React/Base/RCTConstants.m +15 -0
  32. package/React/Base/RCTConvert.m +7 -4
  33. package/React/Base/RCTTouchHandler.m +4 -0
  34. package/React/Base/RCTUIKit.h +8 -13
  35. package/React/Base/RCTUtils.m +6 -3
  36. package/React/Base/RCTVersion.m +1 -1
  37. package/React/Base/macOS/RCTUIKit.m +33 -0
  38. package/React/CoreModules/RCTPerfMonitor.mm +1 -1
  39. package/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm +6 -2
  40. package/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm +2 -1
  41. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.mm +1 -1
  42. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +35 -9
  43. package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +8 -1
  44. package/React/Fabric/Mounting/RCTComponentViewFactory.mm +2 -2
  45. package/React/Fabric/Mounting/RCTMountingManager.h +1 -1
  46. package/React/Fabric/Mounting/RCTMountingManager.mm +10 -9
  47. package/React/Fabric/Mounting/RCTMountingTransactionObserverCoordinator.h +5 -3
  48. package/React/Fabric/Mounting/RCTMountingTransactionObserverCoordinator.mm +10 -8
  49. package/React/Fabric/Mounting/RCTMountingTransactionObserving.h +5 -3
  50. package/React/Fabric/RCTConversions.h +9 -1
  51. package/React/Fabric/RCTLocalizationProvider.mm +10 -4
  52. package/React/Fabric/RCTScheduler.h +5 -0
  53. package/React/Fabric/RCTScheduler.mm +10 -0
  54. package/React/Fabric/RCTSurfacePresenter.h +2 -0
  55. package/React/Fabric/RCTSurfacePresenter.mm +12 -11
  56. package/React/Fabric/RCTSurfaceTouchHandler.mm +0 -1
  57. package/React/React-RCTFabric.podspec +1 -1
  58. package/React/Views/RCTView.h +1 -0
  59. package/React/Views/RCTView.m +47 -16
  60. package/React/Views/RCTViewManager.m +1 -1
  61. package/React/Views/ScrollView/RCTScrollView.m +1 -1
  62. package/ReactAndroid/gradle.properties +1 -1
  63. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  64. package/ReactCommon/React-Fabric.podspec +1 -1
  65. package/ReactCommon/React-rncore.podspec +1 -1
  66. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  67. package/ReactCommon/react/renderer/core/EventDispatcher.cpp +21 -0
  68. package/ReactCommon/react/renderer/core/EventDispatcher.h +15 -0
  69. package/ReactCommon/react/renderer/core/EventListener.cpp +39 -0
  70. package/ReactCommon/react/renderer/core/EventListener.h +44 -0
  71. package/ReactCommon/react/renderer/graphics/React-graphics.podspec +1 -1
  72. package/ReactCommon/react/renderer/mounting/TelemetryController.cpp +6 -9
  73. package/ReactCommon/react/renderer/mounting/TelemetryController.h +7 -7
  74. package/ReactCommon/react/renderer/scheduler/Scheduler.cpp +14 -0
  75. package/ReactCommon/react/renderer/scheduler/Scheduler.h +6 -0
  76. package/ReactCommon/react/utils/ManagedObjectWrapper.h +1 -1
  77. package/ReactCommon/react/utils/ManagedObjectWrapper.mm +1 -3
  78. package/package.json +1 -1
  79. package/scripts/react_native_pods.rb +0 -3
  80. package/template/Gemfile.lock +4 -4
  81. package/template/package.json +1 -1
  82. package/ReactCommon/react/renderer/mounting/MountingTransactionMetadata.cpp +0 -12
  83. package/ReactCommon/react/renderer/mounting/MountingTransactionMetadata.h +0 -32
  84. package/third-party-podspecs/boost-for-react-native.podspec +0 -20
@@ -80,11 +80,6 @@ UIKIT_STATIC_INLINE void RCTUIViewSetContentModeRedraw(UIView *view)
80
80
  view.contentMode = UIViewContentModeRedraw;
81
81
  }
82
82
 
83
- UIKIT_STATIC_INLINE BOOL RCTUIViewDrawViewHierarchyInRectAfterScreenUpdates(RCTPlatformView *view, CGRect rect, BOOL afterUpdates)
84
- {
85
- return [view drawViewHierarchyInRect:rect afterScreenUpdates:afterUpdates];
86
- }
87
-
88
83
  UIKIT_STATIC_INLINE BOOL RCTUIViewIsDescendantOfView(RCTPlatformView *view, RCTPlatformView *parent)
89
84
  {
90
85
  return [view isDescendantOfView:parent];
@@ -427,9 +422,17 @@ CGPathRef UIBezierPathCreateCGPathRef(UIBezierPath *path);
427
422
  @property (nonatomic, assign) BOOL alwaysBounceVertical;
428
423
  // macOS specific properties
429
424
  @property (nonatomic, assign) BOOL enableFocusRing;
425
+ @property (nonatomic, assign, getter=isScrollEnabled) BOOL scrollEnabled;
430
426
 
431
427
  @end
432
428
 
429
+ @interface RCTClipView : NSClipView // [TODO(macOS GH#774)
430
+
431
+ @property (nonatomic, assign) BOOL constrainScrolling;
432
+
433
+ @end // ]TODO(macOS GH#774)
434
+
435
+
433
436
  NS_INLINE RCTPlatformView *RCTUIViewHitTestWithEvent(RCTPlatformView *view, CGPoint point, __unused UIEvent *event)
434
437
  {
435
438
  return [view hitTest:point];
@@ -442,14 +445,6 @@ NS_INLINE void RCTUIViewSetContentModeRedraw(RCTPlatformView *view)
442
445
  view.layerContentsRedrawPolicy = NSViewLayerContentsRedrawDuringViewResize;
443
446
  }
444
447
 
445
- NS_INLINE BOOL RCTUIViewDrawViewHierarchyInRectAfterScreenUpdates(RCTPlatformView *view, CGRect rect, __unused BOOL afterUpdates)
446
- {
447
- RCTAssert(afterUpdates, @"We're redrawing the view so it will necessarily include the latest changes.");
448
- (void) afterUpdates;
449
- [view displayRectIgnoringOpacity:NSRectToCGRect(rect)];
450
- return YES;
451
- }
452
-
453
448
  NS_INLINE BOOL RCTUIViewIsDescendantOfView(RCTPlatformView *view, RCTPlatformView *parent)
454
449
  {
455
450
  return [view isDescendantOf:parent];
@@ -905,9 +905,12 @@ UIImage *__nullable RCTImageFromLocalAssetURL(NSURL *imageURL)
905
905
  }
906
906
  #if !TARGET_OS_OSX // TODO(macOS GH#774)
907
907
  image = [UIImage imageWithContentsOfFile:filePath];
908
- #else // TODO(macOS GH#774)
909
- image = [[NSImage alloc] initWithContentsOfFile:filePath]; // TODO(macOS GH#774)
910
- #endif // TODO(macOS GH#774)
908
+ #else // [TODO(macOS GH#774)
909
+ // macOS keeps file handles in open state for lifetime of image if "initWithContentsOfFile:" is used with path inside app bundle
910
+ // Workaround is to load file in data and then convert data to image
911
+ NSData *data = [NSData dataWithContentsOfFile:filePath];
912
+ image = [[NSImage alloc] initWithData:data];
913
+ #endif // ]TODO(macOS GH#774)
911
914
  }
912
915
  }
913
916
 
@@ -28,7 +28,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
28
28
  RCTVersionMajor: @(0),
29
29
  RCTVersionMinor: @(0),
30
30
  RCTVersionPatch: @(0),
31
- RCTVersionPrerelease: @"081d66e4e",
31
+ RCTVersionPrerelease: @"08d0c3b4f",
32
32
  };
33
33
  });
34
34
  return __rnVersion;
@@ -436,6 +436,15 @@ static RCTUIView *RCTUIViewCommonInit(RCTUIView *self)
436
436
 
437
437
  @implementation RCTUIScrollView // TODO(macOS ISS#3536887)
438
438
 
439
+ - (instancetype)initWithFrame:(CGRect)frame
440
+ {
441
+ if (self = [super initWithFrame:frame]) {
442
+ self.scrollEnabled = YES;
443
+ }
444
+
445
+ return self;
446
+ }
447
+
439
448
  - (void)setEnableFocusRing:(BOOL)enableFocusRing {
440
449
  if (_enableFocusRing != enableFocusRing) {
441
450
  _enableFocusRing = enableFocusRing;
@@ -542,6 +551,7 @@ static RCTUIView *RCTUIViewCommonInit(RCTUIView *self)
542
551
  self.verticalScrollElasticity = alwaysBounceVertical ? NSScrollElasticityAllowed : NSScrollElasticityNone;
543
552
  }
544
553
 
554
+
545
555
  @end
546
556
 
547
557
  BOOL RCTUIViewSetClipsToBounds(RCTPlatformView *view)
@@ -557,3 +567,26 @@ BOOL RCTUIViewSetClipsToBounds(RCTPlatformView *view)
557
567
 
558
568
  return clipsToBounds;
559
569
  }
570
+
571
+ @implementation RCTClipView
572
+
573
+ - (instancetype)initWithFrame:(NSRect)frameRect
574
+ {
575
+ if (self = [super initWithFrame:frameRect]) {
576
+ self.constrainScrolling = NO;
577
+ self.drawsBackground = NO;
578
+ }
579
+
580
+ return self;
581
+ }
582
+
583
+ - (NSRect)constrainBoundsRect:(NSRect)proposedBounds
584
+ {
585
+ if (self.constrainScrolling) {
586
+ return NSMakeRect(0, 0, 0, 0);
587
+ }
588
+
589
+ return [super constrainBoundsRect:proposedBounds];
590
+ }
591
+
592
+ @end
@@ -176,7 +176,7 @@ RCT_EXPORT_MODULE()
176
176
  {
177
177
  if (!_devMenuItem) {
178
178
  __weak __typeof__(self) weakSelf = self;
179
- __weak RCTDevSettings *devSettings = [self->_moduleRegistry moduleForName:"DevSettings"];
179
+ __weak RCTDevSettings *devSettings = [[self bridge] devSettings]; // TODO(macOS GH#774)
180
180
  if (devSettings.isPerfMonitorShown) {
181
181
  [weakSelf show];
182
182
  }
@@ -29,8 +29,6 @@ static NSString *const kRCTLegacyInteropChildIndexKey = @"index";
29
29
  - (instancetype)initWithFrame:(CGRect)frame
30
30
  {
31
31
  if (self = [super initWithFrame:frame]) {
32
- RCTWarnNotAllowedForNewArchitecture(
33
- self, @"ViewManager with interop layer is not allowed in the new architecture.");
34
32
  static const auto defaultProps = std::make_shared<const LegacyViewManagerInteropViewProps>();
35
33
  _props = defaultProps;
36
34
  _viewsToBeMounted = [NSMutableArray new];
@@ -67,6 +65,12 @@ static NSString *const kRCTLegacyInteropChildIndexKey = @"index";
67
65
 
68
66
  + (BOOL)isSupported:(NSString *)componentName
69
67
  {
68
+ RCTLogNotAllowedForNewArchitecture(
69
+ self,
70
+ [NSString
71
+ stringWithFormat:
72
+ @"Legacy ViewManagers should be migrated to Fabric ComponentViews in the new architecture to reduce risk. Component using interop layer: %@",
73
+ componentName]);
70
74
  return [[RCTLegacyViewManagerInteropComponentView supportedViewManagers] containsObject:componentName];
71
75
  }
72
76
 
@@ -192,7 +192,8 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct(
192
192
 
193
193
  #pragma mark - RCTMountingTransactionObserving
194
194
 
195
- - (void)mountingTransactionWillMountWithMetadata:(MountingTransactionMetadata const &)metadata
195
+ - (void)mountingTransactionWillMount:(MountingTransaction const &)transaction
196
+ withSurfaceTelemetry:(facebook::react::SurfaceTelemetry const &)surfaceTelemetry
196
197
  {
197
198
  _modalContentsSnapshot = [self.viewController.view snapshotViewAfterScreenUpdates:NO];
198
199
  }
@@ -25,7 +25,7 @@ using namespace facebook::react;
25
25
 
26
26
  @implementation RCTPullToRefreshViewComponentView {
27
27
  UIRefreshControl *_refreshControl;
28
- RCTScrollViewComponentView *_scrollViewComponentView;
28
+ RCTScrollViewComponentView *__weak _scrollViewComponentView;
29
29
  }
30
30
 
31
31
  - (instancetype)initWithFrame:(CGRect)frame
@@ -52,7 +52,11 @@ static UIScrollViewIndicatorStyle RCTUIScrollViewIndicatorStyleFromProps(ScrollV
52
52
  }
53
53
  }
54
54
 
55
- static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteger tag)
55
+ // Once Fabric implements proper NativeAnimationDriver, this should be removed.
56
+ // This is just a workaround to allow animations based on onScroll event.
57
+ // This is only used to animate sticky headers in ScrollViews, and only the contentOffset and tag is used.
58
+ // TODO: T116850910 [Fabric][iOS] Make Fabric not use legacy RCTEventDispatcher for native-driven AnimatedEvents
59
+ static void RCTSendScrollEventForNativeAnimations_DEPRECATED(UIScrollView *scrollView, NSInteger tag)
56
60
  {
57
61
  static uint16_t coalescingKey = 0;
58
62
  RCTScrollEvent *scrollEvent = [[RCTScrollEvent alloc] initWithEventName:@"onScroll"
@@ -64,7 +68,15 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg
64
68
  scrollViewZoomScale:scrollView.zoomScale
65
69
  userData:nil
66
70
  coalescingKey:coalescingKey];
67
- [[RCTBridge currentBridge].eventDispatcher sendEvent:scrollEvent];
71
+ RCTBridge *bridge = [RCTBridge currentBridge];
72
+ if (bridge) {
73
+ [bridge.eventDispatcher sendEvent:scrollEvent];
74
+ } else {
75
+ NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:scrollEvent, @"event", nil];
76
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"RCTSendEventToLegacyEventDispatcher"
77
+ object:nil
78
+ userInfo:userInfo];
79
+ }
68
80
  }
69
81
 
70
82
  @interface RCTScrollViewComponentView () <
@@ -85,6 +97,7 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg
85
97
  // This helps to only update state from `scrollViewDidScroll` in case
86
98
  // some other part of the system scrolls scroll view.
87
99
  BOOL _isUserTriggeredScrolling;
100
+ BOOL _shouldUpdateContentInsetAdjustmentBehavior;
88
101
 
89
102
  CGPoint _contentOffsetWhenClipped;
90
103
  }
@@ -108,6 +121,7 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg
108
121
  _scrollView.delaysContentTouches = NO;
109
122
  ((RCTEnhancedScrollView *)_scrollView).overridingDelegate = self;
110
123
  _isUserTriggeredScrolling = NO;
124
+ _shouldUpdateContentInsetAdjustmentBehavior = YES;
111
125
  [self addSubview:_scrollView];
112
126
 
113
127
  _containerView = [[UIView alloc] initWithFrame:CGRectZero];
@@ -135,7 +149,8 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg
135
149
 
136
150
  #pragma mark - RCTMountingTransactionObserving
137
151
 
138
- - (void)mountingTransactionDidMountWithMetadata:(MountingTransactionMetadata const &)metadata
152
+ - (void)mountingTransactionDidMount:(MountingTransaction const &)transaction
153
+ withSurfaceTelemetry:(facebook::react::SurfaceTelemetry const &)surfaceTelemetry
139
154
  {
140
155
  [self _remountChildren];
141
156
  }
@@ -253,7 +268,8 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg
253
268
  }
254
269
  }
255
270
 
256
- if (oldScrollViewProps.contentInsetAdjustmentBehavior != newScrollViewProps.contentInsetAdjustmentBehavior) {
271
+ if ((oldScrollViewProps.contentInsetAdjustmentBehavior != newScrollViewProps.contentInsetAdjustmentBehavior) ||
272
+ _shouldUpdateContentInsetAdjustmentBehavior) {
257
273
  auto const contentInsetAdjustmentBehavior = newScrollViewProps.contentInsetAdjustmentBehavior;
258
274
  if (contentInsetAdjustmentBehavior == ContentInsetAdjustmentBehavior::Never) {
259
275
  scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
@@ -264,6 +280,7 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg
264
280
  } else if (contentInsetAdjustmentBehavior == ContentInsetAdjustmentBehavior::Always) {
265
281
  scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAlways;
266
282
  }
283
+ _shouldUpdateContentInsetAdjustmentBehavior = NO;
267
284
  }
268
285
 
269
286
  MAP_SCROLL_VIEW_PROP(disableIntervalMomentum);
@@ -377,8 +394,16 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg
377
394
  {
378
395
  const auto &props = *std::static_pointer_cast<const ScrollViewProps>(_props);
379
396
  _scrollView.contentOffset = RCTCGPointFromPoint(props.contentOffset);
397
+ // We set the default behavior to "never" so that iOS
398
+ // doesn't do weird things to UIScrollView insets automatically
399
+ // and keeps it as an opt-in behavior.
400
+ _scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
401
+ _shouldUpdateContentInsetAdjustmentBehavior = YES;
380
402
  _state.reset();
381
403
  _isUserTriggeredScrolling = NO;
404
+ CGRect oldFrame = self.frame;
405
+ self.frame = CGRectZero;
406
+ self.frame = oldFrame;
382
407
  [super prepareForRecycle];
383
408
  }
384
409
 
@@ -403,9 +428,8 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg
403
428
  if (_eventEmitter) {
404
429
  std::static_pointer_cast<ScrollViewEventEmitter const>(_eventEmitter)->onScroll([self _scrollViewMetrics]);
405
430
  }
406
- // Once Fabric implements proper NativeAnimationDriver, this should be removed.
407
- // This is just a workaround to allow animations based on onScroll event.
408
- RCTSendPaperScrollEvent_DEPRECATED(scrollView, self.tag);
431
+
432
+ RCTSendScrollEventForNativeAnimations_DEPRECATED(scrollView, self.tag);
409
433
  }
410
434
 
411
435
  [self _remountChildrenIfNeeded];
@@ -566,7 +590,6 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg
566
590
  offset = CGPointMake(localX, localY);
567
591
  }
568
592
 
569
- [self _forceDispatchNextScrollEvent];
570
593
  [self scrollToOffset:offset animated:animated];
571
594
  }
572
595
 
@@ -621,12 +644,15 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg
621
644
 
622
645
  - (void)scrollToOffset:(CGPoint)offset
623
646
  {
624
- [self _forceDispatchNextScrollEvent];
625
647
  [self scrollToOffset:offset animated:YES];
626
648
  }
627
649
 
628
650
  - (void)scrollToOffset:(CGPoint)offset animated:(BOOL)animated
629
651
  {
652
+ if (CGPointEqualToPoint(_scrollView.contentOffset, offset)) {
653
+ return;
654
+ }
655
+
630
656
  [self _forceDispatchNextScrollEvent];
631
657
 
632
658
  if (_layoutMetrics.layoutDirection == LayoutDirection::RightToLeft) {
@@ -591,6 +591,12 @@ static RCTBorderStyle RCTBorderStyleFromBorderStyle(BorderStyle borderStyle)
591
591
 
592
592
  RCTBorderColors borderColors = RCTCreateRCTBorderColorsFromBorderColors(borderMetrics.borderColors);
593
593
 
594
+ #if TARGET_OS_OSX // [TODO(macOS GH#774)
595
+ CGFloat scaleFactor = self.window.backingScaleFactor;
596
+ #else
597
+ // On iOS setting the scaleFactor to 0.0 will default to the device's native scale factor.
598
+ CGFloat scaleFactor = 0.0;
599
+ #endif // ]TODO(macOS GH#774)
594
600
  UIImage *image = RCTGetBorderImage(
595
601
  RCTBorderStyleFromBorderStyle(borderMetrics.borderStyles.left),
596
602
  layer.bounds.size,
@@ -598,7 +604,8 @@ static RCTBorderStyle RCTBorderStyleFromBorderStyle(BorderStyle borderStyle)
598
604
  RCTUIEdgeInsetsFromEdgeInsets(borderMetrics.borderWidths),
599
605
  borderColors,
600
606
  _backgroundColor.CGColor,
601
- self.clipsToBounds);
607
+ self.clipsToBounds,
608
+ scaleFactor); // TODO(macOS GH#774)
602
609
 
603
610
  RCTReleaseRCTBorderColors(borderColors);
604
611
 
@@ -95,9 +95,9 @@ static Class<RCTComponentViewProtocol> RCTComponentViewClassWithName(const char
95
95
  {
96
96
  .viewClass = viewClass,
97
97
  .observesMountingTransactionWillMount =
98
- (bool)class_respondsToSelector(viewClass, @selector(mountingTransactionWillMountWithMetadata:)),
98
+ (bool)class_respondsToSelector(viewClass, @selector(mountingTransactionWillMount:withSurfaceTelemetry:)),
99
99
  .observesMountingTransactionDidMount =
100
- (bool)class_respondsToSelector(viewClass, @selector(mountingTransactionDidMountWithMetadata:)),
100
+ (bool)class_respondsToSelector(viewClass, @selector(mountingTransactionDidMount:withSurfaceTelemetry:)),
101
101
  };
102
102
  #pragma clang diagnostic pop
103
103
  }
@@ -63,7 +63,7 @@ NS_ASSUME_NONNULL_BEGIN
63
63
 
64
64
  - (void)setIsJSResponder:(BOOL)isJSResponder
65
65
  blockNativeResponder:(BOOL)blockNativeResponder
66
- forShadowView:(facebook::react::ShadowView)shadowView;
66
+ forShadowView:(facebook::react::ShadowView const &)shadowView;
67
67
 
68
68
  - (void)synchronouslyUpdateViewOnUIThread:(ReactTag)reactTag
69
69
  changedProps:(NSDictionary *)props
@@ -265,26 +265,27 @@ static void RCTPerformMountInstructions(
265
265
  auto surfaceId = mountingCoordinator->getSurfaceId();
266
266
 
267
267
  mountingCoordinator->getTelemetryController().pullTransaction(
268
- [&](MountingTransactionMetadata metadata) {
268
+ [&](MountingTransaction const &transaction, SurfaceTelemetry const &surfaceTelemetry) {
269
269
  [self.delegate mountingManager:self willMountComponentsWithRootTag:surfaceId];
270
- _observerCoordinator.notifyObserversMountingTransactionWillMount(metadata);
270
+ _observerCoordinator.notifyObserversMountingTransactionWillMount(transaction, surfaceTelemetry);
271
271
  },
272
- [&](ShadowViewMutationList const &mutations) {
273
- RCTPerformMountInstructions(mutations, _componentViewRegistry, _observerCoordinator, surfaceId);
272
+ [&](MountingTransaction const &transaction, SurfaceTelemetry const &surfaceTelemetry) {
273
+ RCTPerformMountInstructions(
274
+ transaction.getMutations(), _componentViewRegistry, _observerCoordinator, surfaceId);
274
275
  },
275
- [&](MountingTransactionMetadata metadata) {
276
- _observerCoordinator.notifyObserversMountingTransactionDidMount(metadata);
276
+ [&](MountingTransaction const &transaction, SurfaceTelemetry const &surfaceTelemetry) {
277
+ _observerCoordinator.notifyObserversMountingTransactionDidMount(transaction, surfaceTelemetry);
277
278
  [self.delegate mountingManager:self didMountComponentsWithRootTag:surfaceId];
278
279
  });
279
280
  }
280
281
 
281
282
  - (void)setIsJSResponder:(BOOL)isJSResponder
282
283
  blockNativeResponder:(BOOL)blockNativeResponder
283
- forShadowView:(facebook::react::ShadowView)shadowView
284
+ forShadowView:(facebook::react::ShadowView const &)shadowView
284
285
  {
286
+ ReactTag reactTag = shadowView.tag;
285
287
  RCTExecuteOnMainQueue(^{
286
- UIView<RCTComponentViewProtocol> *componentView =
287
- [self->_componentViewRegistry findComponentViewWithTag:shadowView.tag];
288
+ UIView<RCTComponentViewProtocol> *componentView = [self->_componentViewRegistry findComponentViewWithTag:reactTag];
288
289
  [componentView setIsJSResponder:isJSResponder];
289
290
  });
290
291
  }
@@ -11,7 +11,7 @@
11
11
  #import <butter/map.h>
12
12
  #import <butter/set.h>
13
13
 
14
- #import <react/renderer/mounting/MountingTransactionMetadata.h>
14
+ #include <react/renderer/mounting/MountingTransaction.h>
15
15
 
16
16
  class RCTMountingTransactionObserverCoordinator final {
17
17
  public:
@@ -31,9 +31,11 @@ class RCTMountingTransactionObserverCoordinator final {
31
31
  * To be called from `RCTMountingManager`.
32
32
  */
33
33
  void notifyObserversMountingTransactionWillMount(
34
- facebook::react::MountingTransactionMetadata const &metadata) const;
34
+ facebook::react::MountingTransaction const &transaction,
35
+ facebook::react::SurfaceTelemetry const &surfaceTelemetry) const;
35
36
  void notifyObserversMountingTransactionDidMount(
36
- facebook::react::MountingTransactionMetadata const &metadata) const;
37
+ facebook::react::MountingTransaction const &transaction,
38
+ facebook::react::SurfaceTelemetry const &surfaceTelemetry) const;
37
39
 
38
40
  private:
39
41
  facebook::butter::map<
@@ -40,9 +40,10 @@ void RCTMountingTransactionObserverCoordinator::unregisterViewComponentDescripto
40
40
  }
41
41
 
42
42
  void RCTMountingTransactionObserverCoordinator::notifyObserversMountingTransactionWillMount(
43
- MountingTransactionMetadata const &metadata) const
43
+ MountingTransaction const &transaction,
44
+ SurfaceTelemetry const &surfaceTelemetry) const
44
45
  {
45
- auto surfaceId = metadata.surfaceId;
46
+ auto surfaceId = transaction.getSurfaceId();
46
47
  auto surfaceRegistryIterator = registry_.find(surfaceId);
47
48
  if (surfaceRegistryIterator == registry_.end()) {
48
49
  return;
@@ -50,16 +51,17 @@ void RCTMountingTransactionObserverCoordinator::notifyObserversMountingTransacti
50
51
  auto &surfaceRegistry = surfaceRegistryIterator->second;
51
52
  for (auto const &componentViewDescriptor : surfaceRegistry) {
52
53
  if (componentViewDescriptor.observesMountingTransactionWillMount) {
53
- [(id<RCTMountingTransactionObserving>)componentViewDescriptor.view
54
- mountingTransactionWillMountWithMetadata:metadata];
54
+ [(id<RCTMountingTransactionObserving>)componentViewDescriptor.view mountingTransactionWillMount:transaction
55
+ withSurfaceTelemetry:surfaceTelemetry];
55
56
  }
56
57
  }
57
58
  }
58
59
 
59
60
  void RCTMountingTransactionObserverCoordinator::notifyObserversMountingTransactionDidMount(
60
- MountingTransactionMetadata const &metadata) const
61
+ MountingTransaction const &transaction,
62
+ SurfaceTelemetry const &surfaceTelemetry) const
61
63
  {
62
- auto surfaceId = metadata.surfaceId;
64
+ auto surfaceId = transaction.getSurfaceId();
63
65
  auto surfaceRegistryIterator = registry_.find(surfaceId);
64
66
  if (surfaceRegistryIterator == registry_.end()) {
65
67
  return;
@@ -67,8 +69,8 @@ void RCTMountingTransactionObserverCoordinator::notifyObserversMountingTransacti
67
69
  auto &surfaceRegistry = surfaceRegistryIterator->second;
68
70
  for (auto const &componentViewDescriptor : surfaceRegistry) {
69
71
  if (componentViewDescriptor.observesMountingTransactionDidMount) {
70
- [(id<RCTMountingTransactionObserving>)componentViewDescriptor.view
71
- mountingTransactionDidMountWithMetadata:metadata];
72
+ [(id<RCTMountingTransactionObserving>)componentViewDescriptor.view mountingTransactionDidMount:transaction
73
+ withSurfaceTelemetry:surfaceTelemetry];
72
74
  }
73
75
  }
74
76
  }
@@ -7,7 +7,7 @@
7
7
 
8
8
  #import <UIKit/UIKit.h>
9
9
 
10
- #import <react/renderer/mounting/MountingTransactionMetadata.h>
10
+ #include <react/renderer/mounting/MountingTransaction.h>
11
11
 
12
12
  NS_ASSUME_NONNULL_BEGIN
13
13
 
@@ -50,14 +50,16 @@ NS_ASSUME_NONNULL_BEGIN
50
50
  * Is not being called for a component view which is being mounted as part of the transaction (because the view is not
51
51
  * registered as an observer yet).
52
52
  */
53
- - (void)mountingTransactionWillMountWithMetadata:(facebook::react::MountingTransactionMetadata const &)metadata;
53
+ - (void)mountingTransactionWillMount:(facebook::react::MountingTransaction const &)transaction
54
+ withSurfaceTelemetry:(facebook::react::SurfaceTelemetry const &)surfaceTelemetry;
54
55
 
55
56
  /*
56
57
  * Called right after the last mutation instruction is executed.
57
58
  * Is not being called for a component view which was being unmounted as part of the transaction (because the view is
58
59
  * not registered as an observer already).
59
60
  */
60
- - (void)mountingTransactionDidMountWithMetadata:(facebook::react::MountingTransactionMetadata const &)metadata;
61
+ - (void)mountingTransactionDidMount:(facebook::react::MountingTransaction const &)transaction
62
+ withSurfaceTelemetry:(facebook::react::SurfaceTelemetry const &)surfaceTelemetry;
61
63
 
62
64
  @end
63
65
 
@@ -173,9 +173,17 @@ inline facebook::react::Point RCTPointFromCGPoint(const CGPoint &point)
173
173
  return {point.x, point.y};
174
174
  }
175
175
 
176
+ inline facebook::react::Float RCTFloatFromCGFloat(CGFloat value)
177
+ {
178
+ if (value == CGFLOAT_MAX) {
179
+ return std::numeric_limits<facebook::react::Float>::infinity();
180
+ }
181
+ return value;
182
+ }
183
+
176
184
  inline facebook::react::Size RCTSizeFromCGSize(const CGSize &size)
177
185
  {
178
- return {size.width, size.height};
186
+ return {RCTFloatFromCGFloat(size.width), RCTFloatFromCGFloat(size.height)};
179
187
  }
180
188
 
181
189
  inline facebook::react::Rect RCTRectFromCGRect(const CGRect &rect)
@@ -26,15 +26,21 @@ void setLocalizationLanguagePack(NSDictionary<NSString *, NSString *> *pack)
26
26
 
27
27
  + (NSString *)RCTLocalizedString:(NSString *)oldString withDescription:(NSString *)description
28
28
  {
29
+ NSString *candidate = nil;
30
+
29
31
  if (_delegate != nil) {
30
- return [_delegate localizedString:oldString withDescription:description];
32
+ candidate = [_delegate localizedString:oldString withDescription:description];
33
+ }
34
+
35
+ if (candidate == nil && _languagePack != nil) {
36
+ candidate = _languagePack[oldString];
31
37
  }
32
38
 
33
- if (_languagePack != nil) {
34
- return _languagePack[oldString];
39
+ if (candidate == nil) {
40
+ candidate = oldString;
35
41
  }
36
42
 
37
- return oldString;
43
+ return candidate;
38
44
  }
39
45
 
40
46
  @end
@@ -10,6 +10,7 @@
10
10
 
11
11
  #import <react/renderer/componentregistry/ComponentDescriptorFactory.h>
12
12
  #import <react/renderer/core/ComponentDescriptor.h>
13
+ #import <react/renderer/core/EventListener.h>
13
14
  #import <react/renderer/core/LayoutConstraints.h>
14
15
  #import <react/renderer/core/LayoutContext.h>
15
16
  #import <react/renderer/mounting/MountingCoordinator.h>
@@ -64,6 +65,10 @@ NS_ASSUME_NONNULL_BEGIN
64
65
 
65
66
  - (void)animationTick;
66
67
 
68
+ - (void)addEventListener:(std::shared_ptr<facebook::react::EventListener> const &)listener;
69
+
70
+ - (void)removeEventListener:(std::shared_ptr<facebook::react::EventListener> const &)listener;
71
+
67
72
  @end
68
73
 
69
74
  NS_ASSUME_NONNULL_END
@@ -193,4 +193,14 @@ class LayoutAnimationDelegateProxy : public LayoutAnimationStatusDelegate, publi
193
193
  }
194
194
  }
195
195
 
196
+ - (void)addEventListener:(std::shared_ptr<EventListener> const &)listener
197
+ {
198
+ return _scheduler->addEventListener(listener);
199
+ }
200
+
201
+ - (void)removeEventListener:(std::shared_ptr<EventListener> const &)listener
202
+ {
203
+ return _scheduler->removeEventListener(listener);
204
+ }
205
+
196
206
  @end
@@ -19,6 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
19
19
  @class RCTFabricSurface;
20
20
  @class RCTImageLoader;
21
21
  @class RCTMountingManager;
22
+ @class RCTScheduler;
22
23
 
23
24
  /**
24
25
  * Coordinates presenting of React Native Surfaces and represents application
@@ -53,6 +54,7 @@ NS_ASSUME_NONNULL_BEGIN
53
54
  - (void)unregisterSurface:(RCTFabricSurface *)surface;
54
55
 
55
56
  @property (readonly) RCTMountingManager *mountingManager;
57
+ @property (readonly, nullable) RCTScheduler *scheduler;
56
58
 
57
59
  - (nullable RCTFabricSurface *)surfaceForRootTag:(ReactTag)rootTag;
58
60