react-native-macos 0.0.0-d7b3947f3 → 0.0.0-d7b689f90

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 (122) hide show
  1. package/Libraries/Alert/Alert.js +115 -6
  2. package/Libraries/Alert/NativeAlertManager.js +1 -19
  3. package/Libraries/Components/View/ViewAccessibility.js +0 -5
  4. package/Libraries/Components/View/ViewPropTypes.js +95 -115
  5. package/Libraries/Core/ReactNativeVersion.js +1 -5
  6. package/Libraries/Image/RCTImageLoader.mm +19 -13
  7. package/Libraries/Image/RCTImageView.h +0 -8
  8. package/Libraries/Text/Text.js +0 -6
  9. package/Libraries/Text/TextInput/Multiline/RCTUITextView.m +7 -3
  10. package/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h +2 -2
  11. package/Libraries/Text/TextInput/RCTBaseTextInputView.m +7 -1
  12. package/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m +2 -2
  13. package/React/Base/RCTTouchHandler.m +2 -1
  14. package/React/Base/RCTUIKit.h +70 -2
  15. package/React/Base/RCTVersion.m +1 -5
  16. package/React/Base/macOS/RCTUIKit.m +51 -2
  17. package/React/CoreModules/RCTAlertManager.mm +1 -1
  18. package/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.h +1 -1
  19. package/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm +3 -2
  20. package/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.h +1 -1
  21. package/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm +8 -8
  22. package/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.h +2 -2
  23. package/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.mm +3 -3
  24. package/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.h +1 -1
  25. package/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm +6 -6
  26. package/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.h +1 -1
  27. package/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.mm +1 -1
  28. package/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.h +1 -1
  29. package/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.h +2 -0
  30. package/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm +8 -4
  31. package/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.h +1 -1
  32. package/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.h +1 -1
  33. package/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.mm +10 -0
  34. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.h +5 -3
  35. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm +23 -6
  36. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.h +1 -1
  37. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.mm +16 -0
  38. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.h +6 -4
  39. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +65 -27
  40. package/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.h +1 -1
  41. package/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.mm +19 -5
  42. package/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.h +1 -1
  43. package/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm +3 -3
  44. package/React/Fabric/Mounting/ComponentViews/Text/RCTAccessibilityElement.h +5 -1
  45. package/React/Fabric/Mounting/ComponentViews/Text/RCTAccessibilityElement.mm +3 -1
  46. package/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentAccessibilityProvider.h +4 -2
  47. package/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentAccessibilityProvider.mm +6 -2
  48. package/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.h +1 -1
  49. package/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm +21 -0
  50. package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.h +1 -1
  51. package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +37 -3
  52. package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.h +5 -3
  53. package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm +14 -2
  54. package/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.h +2 -1
  55. package/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.mm +6 -4
  56. package/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.h +1 -1
  57. package/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.mm +14 -4
  58. package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h +5 -5
  59. package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +28 -18
  60. package/React/Fabric/Mounting/RCTComponentViewClassDescriptor.h +1 -1
  61. package/React/Fabric/Mounting/RCTComponentViewDescriptor.h +2 -2
  62. package/React/Fabric/Mounting/RCTComponentViewFactory.h +1 -1
  63. package/React/Fabric/Mounting/RCTComponentViewProtocol.h +3 -3
  64. package/React/Fabric/Mounting/RCTComponentViewRegistry.h +2 -2
  65. package/React/Fabric/Mounting/RCTComponentViewRegistry.mm +3 -1
  66. package/React/Fabric/Mounting/RCTMountingManager.h +3 -3
  67. package/React/Fabric/Mounting/RCTMountingManager.mm +12 -9
  68. package/React/Fabric/Mounting/RCTMountingManagerDelegate.h +1 -1
  69. package/React/Fabric/Mounting/RCTMountingTransactionObserving.h +1 -1
  70. package/React/Fabric/Mounting/UIView+ComponentViewProtocol.h +5 -5
  71. package/React/Fabric/Mounting/UIView+ComponentViewProtocol.mm +5 -5
  72. package/React/Fabric/RCTConversions.h +8 -6
  73. package/React/Fabric/RCTImageResponseDelegate.h +1 -1
  74. package/React/Fabric/RCTLocalizationProvider.h +1 -1
  75. package/React/Fabric/RCTScheduler.h +1 -1
  76. package/React/Fabric/RCTSurfacePresenter.h +2 -2
  77. package/React/Fabric/RCTSurfacePresenter.mm +5 -5
  78. package/React/Fabric/RCTSurfacePresenterBridgeAdapter.h +1 -1
  79. package/React/Fabric/RCTSurfaceRegistry.h +1 -1
  80. package/React/Fabric/RCTSurfaceTouchHandler.h +3 -3
  81. package/React/Fabric/RCTSurfaceTouchHandler.mm +8 -8
  82. package/React/Fabric/RCTTouchableComponentViewProtocol.h +1 -1
  83. package/React/Fabric/Surface/RCTFabricSurface.mm +2 -0
  84. package/React/Fabric/Utils/RCTGenericDelegateSplitter.h +1 -1
  85. package/React/Views/RCTMaskedView.h +1 -1
  86. package/React/Views/RCTModalHostView.h +2 -2
  87. package/React/Views/RCTModalHostViewController.h +1 -1
  88. package/React/Views/RCTModalManager.h +1 -1
  89. package/React/Views/RCTSwitch.h +1 -10
  90. package/React/Views/RCTSwitch.m +0 -20
  91. package/React/Views/RCTSwitchManager.m +0 -4
  92. package/React/Views/RCTWeakViewHolder.h +1 -1
  93. package/React/Views/RCTWrapperViewController.h +2 -2
  94. package/React/Views/RefreshControl/RCTRefreshControl.h +2 -2
  95. package/React/Views/RefreshControl/RCTRefreshableProtocol.h +1 -1
  96. package/React/Views/SafeAreaView/RCTSafeAreaView.h +1 -1
  97. package/React/Views/SafeAreaView/RCTSafeAreaViewLocalData.h +1 -1
  98. package/React/Views/ScrollView/RCTScrollableProtocol.h +1 -1
  99. package/ReactAndroid/gradle.properties +1 -1
  100. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -5
  101. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -5
  102. package/ReactCommon/hermes/inspector/tools/msggen/yarn.lock +3 -3
  103. package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.h +3 -3
  104. package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm +3 -3
  105. package/ReactCommon/react/renderer/graphics/platform/ios/RCTPlatformColorUtils.mm +9 -9
  106. package/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageManager.h +1 -1
  107. package/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImagePrimitivesConversions.h +1 -1
  108. package/ReactCommon/react/renderer/imagemanager/platform/ios/RCTSyncImageManager.h +1 -1
  109. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/NSTextStorage+FontScaling.h +1 -1
  110. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.h +1 -1
  111. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm +7 -7
  112. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontProperties.h +1 -1
  113. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontUtils.h +1 -1
  114. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextLayoutManager.h +1 -1
  115. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextLayoutManager.mm +5 -0
  116. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextPrimitivesConversions.h +6 -6
  117. package/index.js +0 -11
  118. package/local-cli/generator-macos/templates/macos/HelloWorld-macOS/ViewController.m +1 -1
  119. package/package.json +4 -1
  120. package/template/Gemfile.lock +3 -3
  121. package/template/package.json +1 -1
  122. package/Libraries/Alert/AlertMacOS.js +0 -211
@@ -56,11 +56,11 @@ RCT_REMAP_NOT_OSX_VIEW_PROPERTY(clearButtonMode, backedTextInputView.clearButton
56
56
  RCT_REMAP_NOT_OSX_VIEW_PROPERTY(secureTextEntry, backedTextInputView.secureTextEntry, BOOL) // TODO(macOS GH#774)
57
57
  RCT_EXPORT_VIEW_PROPERTY(autoFocus, BOOL)
58
58
  RCT_EXPORT_VIEW_PROPERTY(blurOnSubmit, BOOL)
59
- RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(clearTextOnFocus, BOOL) // TODO(macOS GH#774)
59
+ RCT_EXPORT_VIEW_PROPERTY(clearTextOnFocus, BOOL)
60
60
  RCT_REMAP_NOT_OSX_VIEW_PROPERTY(keyboardType, backedTextInputView.keyboardType, UIKeyboardType) // TODO(macOS GH#774)
61
61
  RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(showSoftInputOnFocus, BOOL) // TODO(macOS GH#774)
62
62
  RCT_EXPORT_VIEW_PROPERTY(maxLength, NSNumber)
63
- RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(selectTextOnFocus, BOOL) // TODO(macOS GH#774)
63
+ RCT_EXPORT_VIEW_PROPERTY(selectTextOnFocus, BOOL)
64
64
  RCT_EXPORT_VIEW_PROPERTY(selection, RCTTextSelection)
65
65
  RCT_EXPORT_VIEW_PROPERTY(inputAccessoryViewID, NSString)
66
66
  RCT_EXPORT_VIEW_PROPERTY(textContentType, NSString)
@@ -228,7 +228,8 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)coder)
228
228
  #else // [TODO(macOS GH#774)
229
229
  NSEvent *nativeTouch = _nativeTouches[touchIndex];
230
230
  CGPoint location = nativeTouch.locationInWindow;
231
- CGPoint rootViewLocation = CGPointMake(location.x, CGRectGetHeight(self.view.window.frame) - location.y);
231
+ RCTAssert(_cachedRootView, @"We were unable to find a root view for the touch");
232
+ CGPoint rootViewLocation = [_cachedRootView.window.contentView convertPoint:location toView:_cachedRootView];
232
233
  NSView *touchView = _touchViews[touchIndex];
233
234
  CGPoint touchViewLocation = [touchView convertPoint:location fromView:nil];
234
235
  #endif // ]TODO(macOS GH#774)
@@ -206,8 +206,7 @@ enum : NSUInteger
206
206
  };
207
207
 
208
208
  // UIView/NSView.h
209
- enum : NSInteger
210
- {
209
+ typedef NS_ENUM(NSInteger, UIViewContentMode) {
211
210
  UIViewContentModeScaleAspectFill = NSViewLayerContentsPlacementScaleProportionallyToFill,
212
211
  UIViewContentModeScaleAspectFit = NSViewLayerContentsPlacementScaleProportionallyToFit,
213
212
  UIViewContentModeScaleToFill = NSViewLayerContentsPlacementScaleAxesIndependently,
@@ -322,6 +321,11 @@ NS_INLINE NSEdgeInsets UIEdgeInsetsMake(CGFloat top, CGFloat left, CGFloat botto
322
321
  // UIImage
323
322
  @compatibility_alias UIImage NSImage;
324
323
 
324
+ typedef NS_ENUM(NSInteger, UIImageRenderingMode) {
325
+ UIImageRenderingModeAlwaysOriginal,
326
+ UIImageRenderingModeAlwaysTemplate,
327
+ };
328
+
325
329
  #ifdef __cplusplus
326
330
  extern "C"
327
331
  #endif
@@ -468,3 +472,67 @@ NS_INLINE CGRect CGRectValue(NSValue *value)
468
472
  }
469
473
 
470
474
  #endif // ] TARGET_OS_OSX
475
+
476
+ //
477
+ // fabric component types
478
+ //
479
+
480
+ // RCTUISlider
481
+
482
+ #if !TARGET_OS_OSX // [TODO(macOS GH#774)
483
+ typedef UISlider RCTUISlider;
484
+ #else
485
+ @interface RCTUISlider : NSSlider
486
+
487
+ @property (nonatomic, readonly) BOOL pressed;
488
+ @property (nonatomic, assign) float value;
489
+ @property (nonatomic, assign) float minimumValue;
490
+ @property (nonatomic, assign) float maximumValue;
491
+ @property (nonatomic, strong) NSColor *minimumTrackTintColor;
492
+ @property (nonatomic, strong) NSColor *maximumTrackTintColor;
493
+
494
+ - (void)setValue:(float)value animated:(BOOL)animated;
495
+
496
+ @end
497
+ #endif // ]TODO(macOS GH#774)
498
+
499
+ // RCTUILabel
500
+
501
+ #if !TARGET_OS_OSX // [TODO(macOS GH#774)
502
+ #define RCTUILabel UILabel
503
+ #else
504
+ @interface RCTUILabel : NSTextField
505
+ @end
506
+ #endif // ]TODO(macOS GH#774)
507
+
508
+ // RCTUISwitch
509
+
510
+ #if !TARGET_OS_OSX // [TODO(macOS GH#774)
511
+ typedef UISwitch RCTUISwitch;
512
+ #else
513
+ @interface RCTUISwitch : NSSwitch
514
+
515
+ @property (nonatomic, assign, getter=isOn) BOOL on;
516
+
517
+ - (void)setOn:(BOOL)on animated:(BOOL)animated;
518
+
519
+ @end
520
+ #endif // ]TODO(macOS GH#774)
521
+
522
+ // RCTUIActivityIndicatorView
523
+
524
+ #if !TARGET_OS_OSX // [TODO(macOS GH#774)
525
+ #define RCTUIActivityIndicatorView UIActivityIndicatorView
526
+ #else
527
+ @interface RCTUIActivityIndicatorView : NSProgressIndicator
528
+
529
+ @property (nonatomic, assign) UIActivityIndicatorViewStyle activityIndicatorViewStyle;
530
+ @property (nonatomic, assign) BOOL hidesWhenStopped;
531
+ @property (nullable, readwrite, nonatomic, strong) RCTUIColor *color;
532
+ @property (nonatomic, readonly, getter=isAnimating) BOOL animating;
533
+
534
+ - (void)startAnimating;
535
+ - (void)stopAnimating;
536
+
537
+ @end
538
+ #endif // ]TODO(macOS GH#774)
@@ -15,10 +15,6 @@ NSString* const RCTVersionPatch = @"patch";
15
15
  NSString* const RCTVersionPrerelease = @"prerelease";
16
16
 
17
17
 
18
- // [TODO(macOS GH#944)
19
- // Note: Be careful not to override these version numbers
20
- // when we merge upstream stable branches into main
21
- // TODO(macOS GH#944)]
22
18
  NSDictionary* RCTGetReactNativeVersion(void)
23
19
  {
24
20
  static NSDictionary* __rnVersion;
@@ -28,7 +24,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
28
24
  RCTVersionMajor: @(0),
29
25
  RCTVersionMinor: @(0),
30
26
  RCTVersionPatch: @(0),
31
- RCTVersionPrerelease: @"d7b3947f3",
27
+ RCTVersionPrerelease: @"d7b689f90",
32
28
  };
33
29
  });
34
30
  return __rnVersion;
@@ -131,7 +131,7 @@ NSData *UIImagePNGRepresentation(NSImage *image) {
131
131
  NSData *UIImageJPEGRepresentation(NSImage *image, CGFloat compressionQuality) {
132
132
  return NSImageDataForFileType(image,
133
133
  NSBitmapImageFileTypeJPEG,
134
- @{NSImageCompressionFactor: @(1.0)});
134
+ @{NSImageCompressionFactor: @(compressionQuality)});
135
135
  }
136
136
 
137
137
  // UIBezierPath
@@ -551,7 +551,6 @@ static RCTUIView *RCTUIViewCommonInit(RCTUIView *self)
551
551
  self.verticalScrollElasticity = alwaysBounceVertical ? NSScrollElasticityAllowed : NSScrollElasticityNone;
552
552
  }
553
553
 
554
-
555
554
  @end
556
555
 
557
556
  BOOL RCTUIViewSetClipsToBounds(RCTPlatformView *view)
@@ -589,4 +588,54 @@ BOOL RCTUIViewSetClipsToBounds(RCTPlatformView *view)
589
588
  return [super constrainBoundsRect:proposedBounds];
590
589
  }
591
590
 
591
+ @end
592
+
593
+ // RCTUISlider
594
+
595
+ @implementation RCTUISlider {} // [TODO(macOS GH#774)
596
+
597
+ - (void)setValue:(float)value animated:(__unused BOOL)animated
598
+ {
599
+ self.animator.floatValue = value;
600
+ }
601
+
602
+ @end // ]TODO(macOS GH#774)
603
+
604
+
605
+ // RCTUILabel
606
+
607
+ @implementation RCTUILabel {} // [TODO(macOS GH#774)
608
+
609
+ - (instancetype)initWithFrame:(NSRect)frameRect
610
+ {
611
+ if (self = [super initWithFrame:frameRect]) {
612
+ [self setBezeled:NO];
613
+ [self setDrawsBackground:NO];
614
+ [self setEditable:NO];
615
+ [self setSelectable:NO];
616
+ [self setWantsLayer:YES];
617
+ }
618
+
619
+ return self;
620
+ }
621
+
622
+ @end // ]TODO(macOS GH#774)
623
+
624
+ @implementation RCTUISwitch
625
+
626
+ - (BOOL)isOn
627
+ {
628
+ return self.state == NSControlStateValueOn;
629
+ }
630
+
631
+ - (void)setOn:(BOOL)on
632
+ {
633
+ self.state = on ? NSControlStateValueOn : NSControlStateValueOff;
634
+ }
635
+
636
+ - (void)setOn:(BOOL)on animated:(BOOL)animated {
637
+ self.state = on ? NSControlStateValueOn : NSControlStateValueOff;
638
+ }
639
+
640
+
592
641
  @end
@@ -78,7 +78,7 @@ RCT_EXPORT_MODULE()
78
78
  * The key from the `buttons` dictionary is passed back in the callback on click.
79
79
  * Buttons are displayed in the order they are specified.
80
80
  */
81
- RCT_EXPORT_METHOD(alertWithArgs : (JS::NativeAlertManager::NativeArgs &)args callback : (RCTResponseSenderBlock)callback)
81
+ RCT_EXPORT_METHOD(alertWithArgs : (JS::NativeAlertManager::Args &)args callback : (RCTResponseSenderBlock)callback)
82
82
  {
83
83
  NSString *title = [RCTConvert NSString:args.title()];
84
84
  NSString *message = [RCTConvert NSString:args.message()];
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- #import <UIKit/UIKit.h>
8
+ #import <React/RCTUIKit.h> // TODO(macOS GH#774)
9
9
 
10
10
  #import <React/RCTViewComponentView.h>
11
11
 
@@ -8,6 +8,7 @@
8
8
  #import "RCTActivityIndicatorViewComponentView.h"
9
9
 
10
10
  #import <React/RCTConversions.h>
11
+ #import <React/RCTActivityIndicatorView.h> // TODO(macOS GH#774)
11
12
 
12
13
  #import <react/renderer/components/rncore/ComponentDescriptors.h>
13
14
  #import <react/renderer/components/rncore/EventEmitters.h>
@@ -28,7 +29,7 @@ static UIActivityIndicatorViewStyle convertActivityIndicatorViewStyle(const Acti
28
29
  }
29
30
 
30
31
  @implementation RCTActivityIndicatorViewComponentView {
31
- UIActivityIndicatorView *_activityIndicatorView;
32
+ RCTUIActivityIndicatorView *_activityIndicatorView; // TODO(macOS GH#774)
32
33
  }
33
34
 
34
35
  #pragma mark - RCTComponentViewProtocol
@@ -44,7 +45,7 @@ static UIActivityIndicatorViewStyle convertActivityIndicatorViewStyle(const Acti
44
45
  static const auto defaultProps = std::make_shared<const ActivityIndicatorViewProps>();
45
46
  _props = defaultProps;
46
47
 
47
- _activityIndicatorView = [[UIActivityIndicatorView alloc] initWithFrame:self.bounds];
48
+ _activityIndicatorView = [[RCTUIActivityIndicatorView alloc] initWithFrame:self.bounds]; // TODO(macOS GH#774)
48
49
  _activityIndicatorView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
49
50
 
50
51
  if (defaultProps->animating) {
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- #import <UIKit/UIKit.h>
8
+ #import <React/RCTUIKit.h> // TODO(macOS GH#774)
9
9
 
10
10
  #import <React/RCTViewComponentView.h>
11
11
 
@@ -20,18 +20,18 @@
20
20
 
21
21
  using namespace facebook::react;
22
22
 
23
- static UIView<RCTBackedTextInputViewProtocol> *_Nullable RCTFindTextInputWithNativeId(UIView *view, NSString *nativeId)
23
+ static RCTUIView<RCTBackedTextInputViewProtocol> *_Nullable RCTFindTextInputWithNativeId(RCTUIView *view, NSString *nativeId) // TODO(macOS GH#774)
24
24
  {
25
25
  if ([view respondsToSelector:@selector(inputAccessoryViewID)] &&
26
26
  [view respondsToSelector:@selector(setInputAccessoryView:)]) {
27
- UIView<RCTBackedTextInputViewProtocol> *typed = (UIView<RCTBackedTextInputViewProtocol> *)view;
27
+ RCTUIView<RCTBackedTextInputViewProtocol> *typed = (RCTUIView<RCTBackedTextInputViewProtocol> *)view; // TODO(macOS GH#774)
28
28
  if (!nativeId || [typed.inputAccessoryViewID isEqualToString:nativeId]) {
29
29
  return typed;
30
30
  }
31
31
  }
32
32
 
33
- for (UIView *subview in view.subviews) {
34
- UIView<RCTBackedTextInputViewProtocol> *result = RCTFindTextInputWithNativeId(subview, nativeId);
33
+ for (RCTUIView *subview in view.subviews) { // TODO(macOS GH#774)
34
+ RCTUIView<RCTBackedTextInputViewProtocol> *result = RCTFindTextInputWithNativeId(subview, nativeId); // TODO(macOS GH#774)
35
35
  if (result) {
36
36
  return result;
37
37
  }
@@ -44,7 +44,7 @@ static UIView<RCTBackedTextInputViewProtocol> *_Nullable RCTFindTextInputWithNat
44
44
  InputAccessoryShadowNode::ConcreteState::Shared _state;
45
45
  RCTInputAccessoryContentView *_contentView;
46
46
  RCTSurfaceTouchHandler *_touchHandler;
47
- UIView<RCTBackedTextInputViewProtocol> __weak *_textInput;
47
+ RCTUIView<RCTBackedTextInputViewProtocol> __weak *_textInput; // TODO(macOS GH#774)
48
48
  }
49
49
 
50
50
  - (instancetype)initWithFrame:(CGRect)frame
@@ -83,7 +83,7 @@ static UIView<RCTBackedTextInputViewProtocol> *_Nullable RCTFindTextInputWithNat
83
83
  return true;
84
84
  }
85
85
 
86
- - (UIView *)inputAccessoryView
86
+ - (RCTUIView *)inputAccessoryView // TODO(macOS GH#774)
87
87
  {
88
88
  return _contentView;
89
89
  }
@@ -95,12 +95,12 @@ static UIView<RCTBackedTextInputViewProtocol> *_Nullable RCTFindTextInputWithNat
95
95
  return concreteComponentDescriptorProvider<InputAccessoryComponentDescriptor>();
96
96
  }
97
97
 
98
- - (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
98
+ - (void)mountChildComponentView:(RCTUIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index // TODO(macOS GH#774)
99
99
  {
100
100
  [_contentView insertSubview:childComponentView atIndex:index];
101
101
  }
102
102
 
103
- - (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
103
+ - (void)unmountChildComponentView:(RCTUIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index // TODO(macOS GH#774)
104
104
  {
105
105
  [childComponentView removeFromSuperview];
106
106
  }
@@ -5,8 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- #import <UIKit/UIKit.h>
8
+ #import <React/RCTUIKit.h> // TODO(macOS GH#774)
9
9
 
10
- @interface RCTInputAccessoryContentView : UIView
10
+ @interface RCTInputAccessoryContentView : RCTUIView // TODO(macOS GH#774)
11
11
 
12
12
  @end
@@ -8,7 +8,7 @@
8
8
  #import "RCTInputAccessoryContentView.h"
9
9
 
10
10
  @implementation RCTInputAccessoryContentView {
11
- UIView *_safeAreaContainer;
11
+ RCTUIView *_safeAreaContainer; // TODO(macOS GH#774)
12
12
  NSLayoutConstraint *_heightConstraint;
13
13
  }
14
14
 
@@ -17,7 +17,7 @@
17
17
  if (self = [super init]) {
18
18
  self.autoresizingMask = UIViewAutoresizingFlexibleHeight;
19
19
 
20
- _safeAreaContainer = [UIView new];
20
+ _safeAreaContainer = [RCTUIView new]; // TODO(macOS GH#774)
21
21
  _safeAreaContainer.translatesAutoresizingMaskIntoConstraints = NO;
22
22
  [self addSubview:_safeAreaContainer];
23
23
 
@@ -40,7 +40,7 @@
40
40
  return CGSizeZero;
41
41
  }
42
42
 
43
- - (void)insertSubview:(UIView *)view atIndex:(NSInteger)index
43
+ - (void)insertSubview:(RCTUIView *)view atIndex:(NSInteger)index // TODO(macOS GH#774)
44
44
  {
45
45
  [_safeAreaContainer insertSubview:view atIndex:index];
46
46
  }
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- #import <UIKit/UIKit.h>
8
+ #import <React/RCTUIKit.h> // TODO(macOS GH#774)
9
9
 
10
10
  #import <React/RCTViewComponentView.h>
11
11
 
@@ -22,7 +22,7 @@ static NSString *const kRCTLegacyInteropChildIndexKey = @"index";
22
22
 
23
23
  @implementation RCTLegacyViewManagerInteropComponentView {
24
24
  NSMutableArray<NSDictionary *> *_viewsToBeMounted;
25
- NSMutableArray<UIView *> *_viewsToBeUnmounted;
25
+ NSMutableArray<RCTUIView *> *_viewsToBeUnmounted; // TODO(macOS GH#774)
26
26
  RCTLegacyViewManagerInteropCoordinatorAdapter *_adapter;
27
27
  LegacyViewManagerInteropShadowNode::ConcreteState::Shared _state;
28
28
  BOOL _hasInvokedForwardingWarning;
@@ -41,9 +41,9 @@ static NSString *const kRCTLegacyInteropChildIndexKey = @"index";
41
41
  return self;
42
42
  }
43
43
 
44
- - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
44
+ - (RCTUIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event // TODO(macOS GH#774)
45
45
  {
46
- UIView *result = [super hitTest:point withEvent:event];
46
+ RCTUIView *result = [super hitTest:point withEvent:event]; // TODO(macOS GH#774)
47
47
 
48
48
  if (result == _adapter.paperView) {
49
49
  return self;
@@ -149,7 +149,7 @@ static NSString *const kRCTLegacyInteropChildIndexKey = @"index";
149
149
  [super prepareForRecycle];
150
150
  }
151
151
 
152
- - (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
152
+ - (void)mountChildComponentView:(RCTUIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index // TODO(macOS GH#774)
153
153
  {
154
154
  [_viewsToBeMounted addObject:@{
155
155
  kRCTLegacyInteropChildIndexKey : [NSNumber numberWithInteger:index],
@@ -157,7 +157,7 @@ static NSString *const kRCTLegacyInteropChildIndexKey = @"index";
157
157
  }];
158
158
  }
159
159
 
160
- - (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
160
+ - (void)unmountChildComponentView:(RCTUIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index // TODO(macOS GH#774)
161
161
  {
162
162
  if (_adapter) {
163
163
  [_adapter.paperView removeReactSubview:childComponentView];
@@ -208,7 +208,7 @@ static NSString *const kRCTLegacyInteropChildIndexKey = @"index";
208
208
 
209
209
  [_viewsToBeMounted removeAllObjects];
210
210
 
211
- for (UIView *view in _viewsToBeUnmounted) {
211
+ for (RCTUIView *view in _viewsToBeUnmounted) { // TODO(macOS GH#774)
212
212
  [_adapter.paperView removeReactSubview:view];
213
213
  }
214
214
 
@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
14
14
 
15
15
  - (instancetype)initWithCoordinator:(RCTLegacyViewManagerInteropCoordinator *)coordinator reactTag:(NSInteger)tag;
16
16
 
17
- @property (strong, nonatomic) UIView *paperView;
17
+ @property (strong, nonatomic) RCTUIView *paperView; // TODO(macOS GH#774)
18
18
 
19
19
  @property (nonatomic, copy, nullable) void (^eventInterceptor)(std::string eventName, folly::dynamic event);
20
20
 
@@ -28,7 +28,7 @@
28
28
  [_coordinator removeObserveForTag:_tag];
29
29
  }
30
30
 
31
- - (UIView *)paperView
31
+ - (RCTUIView *)paperView // TODO(macOS GH#774)
32
32
  {
33
33
  if (!_paperView) {
34
34
  _paperView = [_coordinator createPaperViewWithTag:_tag];
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- #import <UIKit/UIKit.h>
8
+ #import <React/RCTUIKit.h> // TODO(macOS GH#774)
9
9
 
10
10
  @protocol RCTFabricModalHostViewControllerDelegate <NSObject>
11
11
  - (void)boundsDidChange:(CGRect)newBounds;
@@ -13,6 +13,7 @@
13
13
  */
14
14
  @interface RCTModalHostViewComponentView : RCTViewComponentView <RCTMountingTransactionObserving>
15
15
 
16
+ #if !TARGET_OS_OSX // [TODO(macOS GH#774)
16
17
  /**
17
18
  * Subclasses may override this method and present the modal on different view controller.
18
19
  * Default implementation presents the modal on `[self reactViewController]`.
@@ -28,5 +29,6 @@
28
29
  - (void)dismissViewController:(UIViewController *)modalViewController
29
30
  animated:(BOOL)animated
30
31
  completion:(void (^)(void))completion;
32
+ #endif // ]TODO(macOS GH#774)
31
33
 
32
34
  @end
@@ -21,6 +21,7 @@
21
21
 
22
22
  using namespace facebook::react;
23
23
 
24
+ #if !TARGET_OS_OSX // [TODO(macOS GH#774)
24
25
  static UIInterfaceOrientationMask supportedOrientationsMask(ModalHostViewSupportedOrientationsMask mask)
25
26
  {
26
27
  UIInterfaceOrientationMask supportedOrientations = 0;
@@ -93,6 +94,7 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct(
93
94
  : ModalHostViewEventEmitter::OnOrientationChangeOrientation::Landscape;
94
95
  return {orientation};
95
96
  }
97
+ #endif // ]TODO(macOS GH#774)
96
98
 
97
99
  @interface RCTModalHostViewComponentView () <RCTFabricModalHostViewControllerDelegate>
98
100
 
@@ -104,9 +106,10 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct(
104
106
  BOOL _shouldAnimatePresentation;
105
107
  BOOL _shouldPresent;
106
108
  BOOL _isPresented;
107
- UIView *_modalContentsSnapshot;
109
+ RCTUIView *_modalContentsSnapshot; // TODO(macOS GH#774)
108
110
  }
109
111
 
112
+ #if !TARGET_OS_OSX // [TODO(macOS GH#774)
110
113
  - (instancetype)initWithFrame:(CGRect)frame
111
114
  {
112
115
  if (self = [super initWithFrame:frame]) {
@@ -165,7 +168,7 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct(
165
168
  _isPresented = NO;
166
169
  // To animate dismissal of view controller, snapshot of
167
170
  // view hierarchy needs to be added to the UIViewController.
168
- UIView *snapshot = _modalContentsSnapshot;
171
+ RCTUIView *snapshot = _modalContentsSnapshot; // TODO(macOS GH#774)
169
172
  [self.viewController.view addSubview:snapshot];
170
173
 
171
174
  [self dismissViewController:self.viewController
@@ -269,15 +272,16 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct(
269
272
  _state = std::static_pointer_cast<const ModalHostViewShadowNode::ConcreteState>(state);
270
273
  }
271
274
 
272
- - (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
275
+ - (void)mountChildComponentView:(RCTUIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index // TODO(macOS GH#774)
273
276
  {
274
277
  [self.viewController.view insertSubview:childComponentView atIndex:index];
275
278
  }
276
279
 
277
- - (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
280
+ - (void)unmountChildComponentView:(RCTUIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index // TODO(macOS GH#774)
278
281
  {
279
282
  [childComponentView removeFromSuperview];
280
283
  }
284
+ #endif // ]TODO(macOS GH#774)
281
285
 
282
286
  @end
283
287
 
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- #import <UIKit/UIKit.h>
8
+ #import <React/RCTUIKit.h> // TODO(macOS GH#774)
9
9
 
10
10
  #import <React/RCTViewComponentView.h>
11
11
 
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- #import <UIKit/UIKit.h>
8
+ #import <React/RCTUIKit.h> // TODO(macOS GH#774)
9
9
 
10
10
  #import <React/RCTViewComponentView.h>
11
11
 
@@ -38,12 +38,14 @@ using namespace facebook::react;
38
38
  return UIEdgeInsetsZero;
39
39
  }
40
40
 
41
+ #if !TARGET_OS_OSX // TODO(macOS GH#774)
41
42
  - (void)safeAreaInsetsDidChange
42
43
  {
43
44
  [super safeAreaInsetsDidChange];
44
45
 
45
46
  [self _updateStateIfNecessary];
46
47
  }
48
+ #endif // TODO(macOS GH#774)
47
49
 
48
50
  - (void)_updateStateIfNecessary
49
51
  {
@@ -52,10 +54,18 @@ using namespace facebook::react;
52
54
  }
53
55
 
54
56
  UIEdgeInsets insets = [self _safeAreaInsets];
57
+ #if !TARGET_OS_OSX // TODO(macOS GH#774)
55
58
  insets.left = RCTRoundPixelValue(insets.left);
56
59
  insets.top = RCTRoundPixelValue(insets.top);
57
60
  insets.right = RCTRoundPixelValue(insets.right);
58
61
  insets.bottom = RCTRoundPixelValue(insets.bottom);
62
+ #else // [TODO(macOS GH#774)
63
+ CGFloat scale = [[NSScreen mainScreen] backingScaleFactor];;
64
+ insets.left = RCTRoundPixelValue(insets.left, scale);
65
+ insets.top = RCTRoundPixelValue(insets.top, scale);
66
+ insets.right = RCTRoundPixelValue(insets.right, scale);
67
+ insets.bottom = RCTRoundPixelValue(insets.bottom, scale);
68
+ #endif // ]TODO(macOS GH#774)
59
69
 
60
70
  auto newPadding = RCTEdgeInsetsFromUIEdgeInsets(insets);
61
71
  auto threshold = 1.0 / RCTScreenScale() + 0.01; // Size of a pixel plus some small threshold.
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- #import <UIKit/UIKit.h>
8
+ #import <React/RCTUIKit.h> // TODO(macOS GH#774)
9
9
 
10
10
  #import <React/RCTGenericDelegateSplitter.h>
11
11
  #import <React/RCTViewComponentView.h>
@@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
19
19
  */
20
20
  @protocol RCTEnhancedScrollViewOverridingDelegate <NSObject>
21
21
 
22
- - (BOOL)touchesShouldCancelInContentView:(UIView *)view;
22
+ - (BOOL)touchesShouldCancelInContentView:(RCTUIView *)view; // TODO(macOS GH#774)
23
23
 
24
24
  @end
25
25
 
@@ -27,7 +27,7 @@ NS_ASSUME_NONNULL_BEGIN
27
27
  * `UIScrollView` subclass which has some improvements and tweaks
28
28
  * which are not directly related to React Native.
29
29
  */
30
- @interface RCTEnhancedScrollView : UIScrollView
30
+ @interface RCTEnhancedScrollView : RCTUIScrollView // TODO(macOS GH#774)
31
31
 
32
32
  /*
33
33
  * Returns a delegate splitter that can be used to create as many `UIScrollView` delegates as needed.
@@ -40,7 +40,9 @@ NS_ASSUME_NONNULL_BEGIN
40
40
  * resilient to other code as possible: even if something else nil the delegate, other delegates that were subscribed
41
41
  * via the splitter will continue working.
42
42
  */
43
+ #if !TARGET_OS_OSX // TODO(macOS GH#774)
43
44
  @property (nonatomic, strong, readonly) RCTGenericDelegateSplitter<id<UIScrollViewDelegate>> *delegateSplitter;
45
+ #endif // TODO(macOS GH#774)
44
46
 
45
47
  @property (nonatomic, weak) id<RCTEnhancedScrollViewOverridingDelegate> overridingDelegate;
46
48
  @property (nonatomic, assign) BOOL pinchGestureEnabled;