react-native-macos 0.0.0-dd8ec0d8a → 0.0.0-ddcc38f1b

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 (56) hide show
  1. package/Libraries/AddressSanitizerCrash/RCTAddressSanitizerCrash.js +25 -0
  2. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +22 -12
  3. package/Libraries/Core/ReactNativeVersion.js +1 -1
  4. package/Libraries/StyleSheet/PlatformColorValueTypes.macos.js +16 -1
  5. package/Libraries/StyleSheet/PlatformColorValueTypesMacOS.js +2 -0
  6. package/Libraries/StyleSheet/PlatformColorValueTypesMacOS.macos.js +8 -1
  7. package/Libraries/Text/RawText/RCTRawTextShadowView.m +2 -0
  8. package/Libraries/Text/Text/RCTTextView.m +7 -9
  9. package/Libraries/Text/TextInput/Multiline/RCTUITextView.m +10 -8
  10. package/Libraries/Text/TextInput/RCTBackedTextInputDelegate.h +2 -0
  11. package/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m +15 -3
  12. package/Libraries/Text/TextInput/RCTBaseTextInputView.m +10 -1
  13. package/Libraries/WebSocket/RCTSRWebSocket.m +23 -0
  14. package/README.md +18 -42
  15. package/React/Base/RCTBridgeModule.h +1 -1
  16. package/React/Base/RCTConvert.m +23 -6
  17. package/React/Base/RCTImageSource.m +2 -0
  18. package/React/Base/RCTJSStackFrame.m +2 -0
  19. package/React/Base/RCTJavaScriptLoader.mm +2 -0
  20. package/React/Base/RCTKeyCommands.m +2 -0
  21. package/React/Base/RCTModuleData.mm +2 -0
  22. package/React/Base/RCTModuleMethod.mm +2 -0
  23. package/React/Base/RCTTouchEvent.m +2 -0
  24. package/React/Base/RCTVersion.m +1 -1
  25. package/React/Base/macOS/RCTPlatformDisplayLink.m +4 -1
  26. package/React/CoreModules/RCTActionSheetManager.mm +4 -0
  27. package/React/CoreModules/RCTAddressSanitizerCrashManager.h +12 -0
  28. package/React/CoreModules/RCTAddressSanitizerCrashManager.mm +18 -0
  29. package/React/CoreModules/RCTAppearance.mm +5 -1
  30. package/React/CoreModules/RCTDevLoadingView.mm +14 -9
  31. package/React/CxxModule/RCTCxxMethod.mm +2 -0
  32. package/React/DevSupport/RCTInspectorDevServerHelper.mm +12 -0
  33. package/React/Modules/RCTLayoutAnimation.m +2 -0
  34. package/React/Modules/RCTLayoutAnimationGroup.m +2 -0
  35. package/React/Views/RCTShadowView.m +3 -1
  36. package/React/Views/RCTView.h +5 -2
  37. package/React/Views/RCTView.m +22 -10
  38. package/React/Views/RCTViewManager.m +9 -8
  39. package/React/Views/SafeAreaView/RCTSafeAreaView.m +2 -0
  40. package/React/Views/ScrollView/MacOS/RCTScrollContentLocalData.h +2 -2
  41. package/React/Views/ScrollView/MacOS/RCTScrollContentLocalData.m +4 -4
  42. package/React/Views/ScrollView/RCTScrollContentView.m +10 -24
  43. package/React/Views/ScrollView/RCTScrollView.m +1 -5
  44. package/ReactAndroid/gradle.properties +1 -1
  45. package/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java +27 -15
  46. package/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.java +12 -0
  47. package/ReactAndroid/src/main/java/com/facebook/react/ReactNativeHost.java +6 -0
  48. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  49. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  50. package/ReactCommon/hermes/inspector/tools/msggen/package.json +1 -1
  51. package/ReactCommon/hermes/inspector/tools/msggen/yarn.lock +1225 -1481
  52. package/package.json +20 -12
  53. package/template/ios/HelloWorld.xcodeproj/project.pbxproj +2 -0
  54. package/template/package.json +2 -2
  55. package/React/Base/macOS/RCTDynamicColor.h +0 -28
  56. package/React/Base/macOS/RCTDynamicColor.m +0 -217
@@ -74,6 +74,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init)
74
74
  return [_key isEqual:input] && (_flags == flags || flags == 0);
75
75
  }
76
76
 
77
+ #if DEBUG // TODO(macOS GH#774) description is a debug-only feature
77
78
  - (NSString *)description
78
79
  {
79
80
  return [NSString stringWithFormat:@"<%@:%p input=\"%@\" flags=%lld hasBlock=%@>",
@@ -83,6 +84,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init)
83
84
  (long long)_flags,
84
85
  _block ? @"YES" : @"NO"];
85
86
  }
87
+ #endif // TODO(macOS GH#774)
86
88
 
87
89
  @end
88
90
 
@@ -570,9 +570,11 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init);
570
570
  _methodQueue = nil;
571
571
  }
572
572
 
573
+ #if DEBUG // TODO(macOS GH#774) description is a debug-only feature
573
574
  - (NSString *)description
574
575
  {
575
576
  return [NSString stringWithFormat:@"<%@: %p; name=\"%@\">", [self class], self, self.name];
576
577
  }
578
+ #endif // TODO(macOS GH#774)
577
579
 
578
580
  @end
@@ -602,6 +602,7 @@ RCT_EXTERN_C_END
602
602
  return [NSString stringWithFormat:@"-[%@ %s]", _moduleClass, sel_getName(_selector)];
603
603
  }
604
604
 
605
+ #if DEBUG // TODO(macOS GH#774) description is a debug-only feature
605
606
  - (NSString *)description
606
607
  {
607
608
  return [NSString stringWithFormat:@"<%@: %p; exports %@ as %s(); type: %s>",
@@ -611,5 +612,6 @@ RCT_EXTERN_C_END
611
612
  self.JSMethodName,
612
613
  RCTFunctionDescriptorFromType(self.functionType)];
613
614
  }
615
+ #endif // TODO(macOS GH#774)
614
616
 
615
617
  @end
@@ -98,10 +98,12 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init)
98
98
  return _coalescingKey;
99
99
  }
100
100
 
101
+ #if DEBUG // TODO(macOS GH#774) description is a debug-only feature
101
102
  - (NSString *)description
102
103
  {
103
104
  return [NSString
104
105
  stringWithFormat:@"<%@: %p; name = %@; coalescing key = %hu>", [self class], self, _eventName, _coalescingKey];
105
106
  }
107
+ #endif // TODO(macOS GH#774)
106
108
 
107
109
  @end
@@ -28,7 +28,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
28
28
  RCTVersionMajor: @(0),
29
29
  RCTVersionMinor: @(0),
30
30
  RCTVersionPatch: @(0),
31
- RCTVersionPrerelease: @"dd8ec0d8a",
31
+ RCTVersionPrerelease: @"ddcc38f1b",
32
32
  };
33
33
  });
34
34
  return __rnVersion;
@@ -50,7 +50,7 @@ static CVReturn RCTPlatformDisplayLinkCallBack(__unused CVDisplayLinkRef display
50
50
  os_unfair_lock_lock(&rctDisplayLink->_lock);
51
51
  if (rctDisplayLink->_runLoop != nil) {
52
52
  CFRunLoopRef cfRunLoop = [rctDisplayLink->_runLoop getCFRunLoop];
53
- CFRunLoopPerformBlock(cfRunLoop, kCFRunLoopDefaultMode, ^{
53
+ CFRunLoopPerformBlock(cfRunLoop, (__bridge CFArrayRef)rctDisplayLink->_modes, ^{
54
54
  [rctDisplayLink tick];
55
55
  });
56
56
  CFRunLoopWakeUp(cfRunLoop);
@@ -71,14 +71,17 @@ static CVReturn RCTPlatformDisplayLinkCallBack(__unused CVDisplayLinkRef display
71
71
 
72
72
  - (void)addToRunLoop:(NSRunLoop *)runloop forMode:(NSRunLoopMode)mode
73
73
  {
74
+ os_unfair_lock_lock(&_lock);
74
75
  _runLoop = runloop;
75
76
 
76
77
  if (_displayLink != NULL) {
77
78
  [_modes addObject:mode];
79
+ os_unfair_lock_unlock(&_lock);
78
80
  return;
79
81
  }
80
82
 
81
83
  _modes = @[mode].mutableCopy;
84
+ os_unfair_lock_unlock(&_lock);
82
85
  CVReturn ret = CVDisplayLinkCreateWithActiveCGDisplays(&_displayLink);
83
86
  if (ret != kCVReturnSuccess) {
84
87
  ret = CVDisplayLinkCreateWithCGDisplay(CGMainDisplayID(), &_displayLink);
@@ -43,7 +43,11 @@ NSSharingServicePickerDelegate
43
43
 
44
44
  RCT_EXPORT_MODULE()
45
45
 
46
+ #if TARGET_OS_OSX // [TODO(macOS GH#774)
47
+ @synthesize bridge = _bridge;
48
+ #else // TODO(macOS GH#774)
46
49
  @synthesize viewRegistry_DEPRECATED = _viewRegistry_DEPRECATED;
50
+ #endif // ]TODO(macOS GH#774)
47
51
 
48
52
  - (dispatch_queue_t)methodQueue
49
53
  {
@@ -0,0 +1,12 @@
1
+ /*
2
+ *
3
+ * This source code is licensed under the MIT license found in the
4
+ * LICENSE file in the root directory of this source tree.
5
+ */
6
+
7
+ #import <React/RCTUIKit.h>
8
+ #import <React/RCTBridge.h>
9
+
10
+ @interface RCTAddressSanitizerCrashManager : NSObject <RCTBridgeModule>
11
+
12
+ @end
@@ -0,0 +1,18 @@
1
+ //
2
+ // RCTAddressSanitizerCrashManager.mm
3
+ // Pods
4
+ //
5
+
6
+ #import "RCTAddressSanitizerCrashManager.h"
7
+
8
+ @implementation RCTAddressSanitizerCrashManager
9
+
10
+ RCT_EXPORT_MODULE(ASANCrash)
11
+
12
+ RCT_EXPORT_METHOD(invokeMemoryCrash) {
13
+ char *s = (char*)malloc(100);
14
+ free(s);
15
+ strcpy(s, "Hello world!"); // AddressSanitizer: heap-use-after-free
16
+ }
17
+
18
+ @end
@@ -81,7 +81,11 @@ NSString *RCTColorSchemePreference(NSAppearance *appearance)
81
81
  return RCTAppearanceColorSchemeLight;
82
82
  }
83
83
 
84
- appearance = appearance ?: [NSAppearance currentAppearance];
84
+ if (@available(macOS 11.0, *)) {
85
+ appearance = appearance ?: [NSAppearance currentDrawingAppearance];
86
+ } else {
87
+ appearance = appearance ?: [NSAppearance currentAppearance];
88
+ }
85
89
  NSAppearanceName appearanceName = [appearance bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, NSAppearanceNameDarkAqua]];
86
90
  return appearances[appearanceName] ?: RCTAppearanceColorSchemeLight;
87
91
  }
@@ -266,16 +266,21 @@ RCT_EXPORT_METHOD(hide)
266
266
 
267
267
  - (void)showOfflineMessage
268
268
  {
269
- RCTUIColor *color = [RCTUIColor whiteColor]; // TODO(macOS GH#774)
270
- RCTUIColor *backgroundColor = [RCTUIColor blackColor]; // TODO(macOS GH#774)
271
-
272
- if ([self isDarkModeEnabled]) {
273
- color = [RCTUIColor blackColor]; // TODO(macOS GH#774)
274
- backgroundColor = [RCTUIColor whiteColor]; // TODO(macOS GH#774)
275
- }
269
+ // [TODO(macOS GH#774) - isDarkModeEnabled should only be run on the main thread
270
+ __weak __typeof(self) weakSelf = self;
271
+ RCTExecuteOnMainQueue(^{
272
+ RCTUIColor *color = [RCTUIColor whiteColor]; // TODO(macOS GH#774)
273
+ RCTUIColor *backgroundColor = [RCTUIColor blackColor]; // TODO(macOS GH#774)
274
+
275
+ if ([weakSelf isDarkModeEnabled]) {
276
+ color = [RCTUIColor blackColor]; // TODO(macOS GH#774)
277
+ backgroundColor = [RCTUIColor whiteColor]; // TODO(macOS GH#774)
278
+ }
276
279
 
277
- NSString *message = [NSString stringWithFormat:@"Connect to %@ to develop JavaScript.", RCT_PACKAGER_NAME];
278
- [self showMessage:message color:color backgroundColor:backgroundColor];
280
+ NSString *message = [NSString stringWithFormat:@"Connect to %@ to develop JavaScript.", RCT_PACKAGER_NAME];
281
+ [weakSelf showMessage:message color:color backgroundColor:backgroundColor];
282
+ });
283
+ // ]TODO(macOS GH#774)
279
284
  }
280
285
 
281
286
  - (BOOL)isDarkModeEnabled
@@ -131,9 +131,11 @@ using namespace facebook::react;
131
131
  }
132
132
  }
133
133
 
134
+ #if DEBUG // TODO(macOS GH#774) description is a debug-only feature
134
135
  - (NSString *)description
135
136
  {
136
137
  return [NSString stringWithFormat:@"<%@: %p; name = %s>", [self class], self, self.JSMethodName];
137
138
  }
139
+ #endif // TODO(macOS GH#774)
138
140
 
139
141
  @end
@@ -110,9 +110,21 @@ static void sendEventToAllConnections(NSString *event)
110
110
  }
111
111
 
112
112
  NSString *key = [inspectorURL absoluteString];
113
+ // [TODO(macOS GH#774) - safety check to avoid a crash
114
+ if (key == nil) {
115
+ RCTLogError(@"failed to get inspector URL");
116
+ return nil;
117
+ }
118
+ // ]TODO(macOS GH#774)
113
119
  RCTInspectorPackagerConnection *connection = socketConnections[key];
114
120
  if (!connection || !connection.isConnected) {
115
121
  connection = [[RCTInspectorPackagerConnection alloc] initWithURL:inspectorURL];
122
+ // [TODO(macOS GH#774) - safety check to avoid a crash
123
+ if (connection == nil) {
124
+ RCTLogError(@"failed to initialize RCTInspectorPackagerConnection");
125
+ return nil;
126
+ }
127
+ // ]TODO(macOS GH#774)
116
128
  socketConnections[key] = connection;
117
129
  [connection connect];
118
130
  }
@@ -190,6 +190,7 @@ static NSString *CAMediaTimingFunctionNameFromRCTAnimationType(RCTAnimationType
190
190
  _animationType == animation.animationType;
191
191
  }
192
192
 
193
+ #if DEBUG // TODO(macOS GH#774) description is a debug-only feature
193
194
  - (NSString *)description
194
195
  {
195
196
  return [NSString
@@ -204,5 +205,6 @@ static NSString *CAMediaTimingFunctionNameFromRCTAnimationType(RCTAnimationType
204
205
  _initialVelocity,
205
206
  (long)_animationType];
206
207
  }
208
+ #endif // TODO(macOS GH#774)
207
209
 
208
210
  @end
@@ -64,6 +64,7 @@
64
64
  [_deletingLayoutAnimation isEqual:deletingLayoutAnimation]);
65
65
  }
66
66
 
67
+ #if DEBUG // TODO(macOS GH#774) description is a debug-only feature
67
68
  - (NSString *)description
68
69
  {
69
70
  return
@@ -75,5 +76,6 @@
75
76
  [_updatingLayoutAnimation description],
76
77
  [_deletingLayoutAnimation description]];
77
78
  }
79
+ #endif // TODO(macOS GH#774)
78
80
 
79
81
  @end
@@ -52,7 +52,7 @@ typedef NS_ENUM(unsigned int, meta_prop_t) {
52
52
  #if !TARGET_OS_OSX // [TODO(macOS GH#774)
53
53
  float pixelsInPoint = RCTScreenScale();
54
54
  #else
55
- float pixelsInPoint = 0; // TODO(ISS#1656079): Turn off pixel rounding for macOS until we can get screen resolution passed here
55
+ float pixelsInPoint = 1; // TODO(ISS#1656079): Use 1x alignment for macOS until we can use backing resolution
56
56
  #endif // ]TODO(macOS GH#774)
57
57
  YGConfigSetPointScaleFactor(yogaConfig, pixelsInPoint);
58
58
  YGConfigSetUseLegacyStretchBehaviour(yogaConfig, true);
@@ -393,6 +393,7 @@ static void RCTProcessMetaPropsBorder(const YGValue metaProps[META_PROP_COUNT],
393
393
  return self.reactTag;
394
394
  }
395
395
 
396
+ #if DEBUG // TODO(macOS GH#774) description is a debug-only feature
396
397
  - (NSString *)description
397
398
  {
398
399
  NSString *description = super.description;
@@ -403,6 +404,7 @@ static void RCTProcessMetaPropsBorder(const YGValue metaProps[META_PROP_COUNT],
403
404
  NSStringFromCGRect(self.layoutMetrics.frame)];
404
405
  return description;
405
406
  }
407
+ #endif // TODO(macOS GH#774)
406
408
 
407
409
  - (void)addRecursiveDescriptionToString:(NSMutableString *)string atLevel:(NSUInteger)level
408
410
  {
@@ -9,7 +9,7 @@
9
9
 
10
10
  #import <React/RCTBorderStyle.h>
11
11
  #import <React/RCTComponent.h>
12
- #import <React/RCTEventDispatcher.h> // TODO(OSS Candidate ISS#2710739)
12
+ #import <React/RCTEventDispatcherProtocol.h> // TODO(OSS Candidate ISS#2710739)
13
13
  #import <React/RCTPointerEvents.h>
14
14
 
15
15
  #if !TARGET_OS_OSX // TODO(macOS GH#774)
@@ -23,7 +23,7 @@ extern const UIAccessibilityTraits SwitchAccessibilityTrait;
23
23
  @interface RCTView : RCTUIView // TODO(macOS ISS#3536887)
24
24
 
25
25
  // [TODO(OSS Candidate ISS#2710739)
26
- - (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher;
26
+ - (instancetype)initWithEventDispatcher:(id<RCTEventDispatcherProtocol>)eventDispatcher;
27
27
 
28
28
  - (BOOL)becomeFirstResponder;
29
29
  - (BOOL)resignFirstResponder;
@@ -128,6 +128,9 @@ extern const UIAccessibilityTraits SwitchAccessibilityTrait;
128
128
  /**
129
129
  * macOS Properties
130
130
  */
131
+
132
+ @property (nonatomic, assign) CATransform3D transform3D;
133
+
131
134
  @property (nonatomic, copy) RCTDirectEventBlock onDoubleClick;
132
135
  @property (nonatomic, copy) RCTDirectEventBlock onClick;
133
136
  @property (nonatomic, copy) RCTDirectEventBlock onMouseEnter;
@@ -123,7 +123,7 @@ static NSString *RCTRecursiveAccessibilityLabel(RCTUIView *view) // TODO(macOS I
123
123
 
124
124
  @implementation RCTView {
125
125
  RCTUIColor *_backgroundColor; // TODO(OSS Candidate ISS#2710739)
126
- RCTEventDispatcher *_eventDispatcher; // TODO(OSS Candidate ISS#2710739)
126
+ id<RCTEventDispatcherProtocol> _eventDispatcher; // TODO(OSS Candidate ISS#2710739)
127
127
  #if TARGET_OS_OSX // [TODO(macOS GH#774)
128
128
  NSTrackingArea *_trackingArea;
129
129
  BOOL _hasMouseOver;
@@ -133,7 +133,7 @@ static NSString *RCTRecursiveAccessibilityLabel(RCTUIView *view) // TODO(macOS I
133
133
  }
134
134
 
135
135
  // [TODO(OSS Candidate ISS#2710739)
136
- - (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher
136
+ - (instancetype)initWithEventDispatcher:(id<RCTEventDispatcherProtocol>)eventDispatcher
137
137
  {
138
138
  if ((self = [self initWithFrame:CGRectZero])) {
139
139
  _eventDispatcher = eventDispatcher;
@@ -162,6 +162,9 @@ static NSString *RCTRecursiveAccessibilityLabel(RCTUIView *view) // TODO(macOS I
162
162
  _borderBottomEndRadius = -1;
163
163
  _borderStyle = RCTBorderStyleSolid;
164
164
  _hitTestEdgeInsets = UIEdgeInsetsZero;
165
+ #if TARGET_OS_OSX // TODO(macOS GH#774)
166
+ _transform3D = CATransform3DIdentity;
167
+ #endif // TODO(macOS GH#774)
165
168
 
166
169
  _backgroundColor = super.backgroundColor;
167
170
  }
@@ -708,17 +711,13 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : unused)
708
711
  }
709
712
  #endif // ]TODO(macOS GH#774)
710
713
 
714
+ #if DEBUG // TODO(macOS GH#774) description is a debug-only feature
711
715
  - (NSString *)description
712
716
  {
713
- NSString *superDescription = super.description;
714
- NSRange semicolonRange = [superDescription rangeOfString:@";"];
715
- if (semicolonRange.location == NSNotFound) { // [TODO(macOS GH#774)
716
- return [[superDescription substringToIndex:superDescription.length - 1] stringByAppendingFormat:@"; reactTag: %@; frame = %@; layer = %@>", self.reactTag, NSStringFromCGRect(self.frame), self.layer];
717
- } else { // ]TODO(macOS GH#774)
718
- NSString *replacement = [NSString stringWithFormat:@"; reactTag: %@;", self.reactTag];
719
- return [superDescription stringByReplacingCharactersInRange:semicolonRange withString:replacement];
720
- } // TODO(macOS GH#774)
717
+ // TODO(macOS GH#774): we shouldn't make assumptions on what super's description is. Just append additional content.
718
+ return [[super description] stringByAppendingFormat:@" reactTag: %@; frame = %@; layer = %@", self.reactTag, NSStringFromCGRect(self.frame), self.layer];
721
719
  }
720
+ #endif // TODO(macOS GH#774)
722
721
 
723
722
  #if TARGET_OS_OSX // [TODO(macOS GH#774)
724
723
  - (void)viewDidMoveToWindow
@@ -1169,6 +1168,19 @@ static CGFloat RCTDefaultIfNegativeTo(CGFloat defaultValue, CGFloat x)
1169
1168
  backgroundColor = _backgroundColor.CGColor;
1170
1169
  #endif
1171
1170
 
1171
+ #if TARGET_OS_OSX // [TODO(macOS GH#1035)
1172
+ CATransform3D transform = [self transform3D];
1173
+ CGPoint anchorPoint = [layer anchorPoint];
1174
+ if (CGPointEqualToPoint(anchorPoint, CGPointZero) && !CATransform3DEqualToTransform(transform, CATransform3DIdentity)) {
1175
+ // https://developer.apple.com/documentation/quartzcore/calayer/1410817-anchorpoint
1176
+ // This compensates for the fact that layer.anchorPoint is {0, 0} instead of {0.5, 0.5} on macOS for some reason.
1177
+ CATransform3D originAdjust = CATransform3DTranslate(CATransform3DIdentity, self.frame.size.width / 2, self.frame.size.height / 2, 0);
1178
+ transform = CATransform3DConcat(CATransform3DConcat(CATransform3DInvert(originAdjust), transform), originAdjust);
1179
+ // Enable edge antialiasing in perspective transforms
1180
+ [layer setAllowsEdgeAntialiasing:!(transform.m34 == 0.0f)];
1181
+ }
1182
+ [layer setTransform:transform];
1183
+ #endif // ]TODO(macOS GH#1035)
1172
1184
  if (useIOSBorderRendering) {
1173
1185
  layer.cornerRadius = cornerRadii.topLeft;
1174
1186
  layer.borderColor = borderColors.left;
@@ -215,15 +215,16 @@ RCT_CUSTOM_VIEW_PROPERTY(shouldRasterizeIOS, BOOL, RCTView)
215
215
 
216
216
  RCT_CUSTOM_VIEW_PROPERTY(transform, CATransform3D, RCTView)
217
217
  {
218
- #if !TARGET_OS_OSX // TODO(macOS GH#774)
218
+ #if TARGET_OS_OSX // [TODO(macOS GH#460)
219
+ CATransform3D transform = json ? [RCTConvert CATransform3D:json] : defaultView.layer.transform;
220
+ [view setTransform3D:transform];
221
+ [view setNeedsDisplay];
222
+ #else // ]TODO(macOS GH#460)]
219
223
  view.layer.transform = json ? [RCTConvert CATransform3D:json] : defaultView.layer.transform;
220
- // Enable edge antialiasing in perspective transforms
221
- view.layer.allowsEdgeAntialiasing = !(view.layer.transform.m34 == 0.0f);
222
- #elif TARGET_OS_OSX // [TODO(macOS GH#774)
223
- view.layer.sublayerTransform = json ? [RCTConvert CATransform3D:json] : defaultView.layer.sublayerTransform;
224
- // TODO: Improve this by enabling edge antialiasing only for transforms with rotation or skewing
225
- view.layer.edgeAntialiasingMask = !CATransform3DIsIdentity(view.layer.sublayerTransform) ? kCALayerLeftEdge | kCALayerRightEdge | kCALayerBottomEdge | kCALayerTopEdge : 0;
226
- #endif // ]TODO(macOS GH#774)
224
+ // Enable edge antialiasing in rotation, skew, or perspective transforms
225
+ view.layer.allowsEdgeAntialiasing =
226
+ view.layer.transform.m12 != 0.0f || view.layer.transform.m21 != 0.0f || view.layer.transform.m34 != 0.0f;
227
+ #endif // [TODO(macOS GH#460)]
227
228
  }
228
229
 
229
230
  RCT_CUSTOM_VIEW_PROPERTY(accessibilityRole, UIAccessibilityTraits, RCTView)
@@ -30,6 +30,7 @@
30
30
  RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)decoder)
31
31
  RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame : (CGRect)frame)
32
32
 
33
+ #if DEBUG // TODO(macOS GH#774) description is a debug-only feature
33
34
  - (NSString *)description
34
35
  {
35
36
  NSString *superDescription = [super description];
@@ -44,6 +45,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame : (CGRect)frame)
44
45
  NSStringFromUIEdgeInsets([self safeAreaInsetsIfSupportedAndEnabled]),
45
46
  NSStringFromUIEdgeInsets(_currentSafeAreaInsets)];
46
47
  }
48
+ #endif // TODO(macOS GH#774)
47
49
 
48
50
  - (BOOL)isSupportedByOS
49
51
  {
@@ -14,8 +14,8 @@ NS_ASSUME_NONNULL_BEGIN
14
14
  @property (nonatomic, assign) CGFloat horizontalScrollerHeight;
15
15
  @property (nonatomic, assign) CGFloat verticalScrollerWidth;
16
16
 
17
- - (instancetype)initWithVerticalScroller:(nullable NSScroller *)verticalScroller
18
- horizontalScroller:(nullable NSScroller *)horizontalScroller;
17
+ - (instancetype)initWithVerticalScrollerWidth:(CGFloat)verticalScrollerWidth
18
+ horizontalScrollerHeight:(CGFloat)horizontalScrollerHeight;
19
19
 
20
20
  @end
21
21
 
@@ -9,12 +9,12 @@
9
9
 
10
10
  @implementation RCTScrollContentLocalData
11
11
 
12
- - (instancetype)initWithVerticalScroller:(NSScroller *)verticalScroller
13
- horizontalScroller:(NSScroller *)horizontalScroller
12
+ - (instancetype)initWithVerticalScrollerWidth:(CGFloat)verticalScrollerWidth
13
+ horizontalScrollerHeight:(CGFloat)horizontalScrollerHeight;
14
14
  {
15
15
  if (self = [super init]) {
16
- _verticalScrollerWidth = NSWidth([verticalScroller frame]);
17
- _horizontalScrollerHeight = NSHeight([horizontalScroller frame]);
16
+ _verticalScrollerWidth = verticalScrollerWidth;
17
+ _horizontalScrollerHeight = horizontalScrollerHeight;
18
18
  }
19
19
  return self;
20
20
  }
@@ -18,15 +18,11 @@
18
18
  #import "RCTScrollView.h"
19
19
 
20
20
  @implementation RCTScrollContentView
21
- #if TARGET_OS_OSX // [TODO(macOS GH#774)
22
- {
23
- BOOL _hasHorizontalScroller;
24
- BOOL _hasVerticalScroller;
25
- }
26
- #endif // ]TODO(macOS GH#774)
27
21
 
28
22
  - (void)reactSetFrame:(CGRect)frame
29
23
  {
24
+ [super reactSetFrame:frame];
25
+
30
26
  #if !TARGET_OS_OSX // TODO(macOS GH#774)
31
27
  RCTScrollView *scrollView = (RCTScrollView *)self.superview.superview;
32
28
  #else // [TODO(macOS GH#774)
@@ -34,8 +30,6 @@
34
30
  RCTScrollView *scrollView = (RCTScrollView *)self.superview.superview.superview;
35
31
  #endif // ]TODO(macOS GH#774)
36
32
 
37
- [super reactSetFrame:frame];
38
-
39
33
  if (!scrollView) {
40
34
  return;
41
35
  }
@@ -43,7 +37,6 @@
43
37
  RCTAssert([scrollView isKindOfClass:[RCTScrollView class]], @"Unexpected view hierarchy of RCTScrollView component.");
44
38
 
45
39
  [scrollView updateContentSizeIfNeeded];
46
-
47
40
  #if TARGET_OS_OSX // [TODO(macOS GH#774)
48
41
  // On macOS scroll indicators may float over the content view like they do in iOS
49
42
  // or depending on system preferences they may be outside of the content view
@@ -52,21 +45,14 @@
52
45
  // the contents will overflow causing the scroll indicators to appear unnecessarily.
53
46
  NSScrollView *platformScrollView = [scrollView scrollView];
54
47
  if ([platformScrollView scrollerStyle] == NSScrollerStyleLegacy) {
55
- const BOOL nextHasHorizontalScroller = [platformScrollView hasHorizontalScroller];
56
- const BOOL nextHasVerticalScroller = [platformScrollView hasVerticalScroller];
57
-
58
- if (_hasHorizontalScroller != nextHasHorizontalScroller ||
59
- _hasVerticalScroller != nextHasVerticalScroller) {
60
-
61
- _hasHorizontalScroller = nextHasHorizontalScroller;
62
- _hasVerticalScroller = nextHasVerticalScroller;
63
-
64
- RCTScrollContentLocalData *localData =
65
- [[RCTScrollContentLocalData alloc]
66
- initWithVerticalScroller:[platformScrollView verticalScroller]
67
- horizontalScroller:[platformScrollView horizontalScroller]];
68
- [[[scrollView bridge] uiManager] setLocalData:localData forView:self];
69
- }
48
+ CGFloat horizontalScrollerHeight = [platformScrollView hasHorizontalScroller] ? NSHeight([[platformScrollView horizontalScroller] frame]) : 0;
49
+ CGFloat verticalScrollerWidth = [platformScrollView hasVerticalScroller] ? NSWidth([[platformScrollView verticalScroller] frame]) : 0;
50
+
51
+ RCTScrollContentLocalData *localData =
52
+ [[RCTScrollContentLocalData alloc]
53
+ initWithVerticalScrollerWidth:horizontalScrollerHeight
54
+ horizontalScrollerHeight:verticalScrollerWidth];
55
+ [[[scrollView bridge] uiManager] setLocalData:localData forView:self];
70
56
  }
71
57
  #endif // ]TODO(macOS GH#774)
72
58
  }
@@ -56,6 +56,7 @@
56
56
  self.scrollEnabled = YES;
57
57
  self.hasHorizontalScroller = YES;
58
58
  self.hasVerticalScroller = YES;
59
+ self.autohidesScrollers = YES;
59
60
  self.panGestureRecognizer = [[NSPanGestureRecognizer alloc] initWithTarget:self action:@selector(handleCustomPan:)];
60
61
  #else // ]TODO(macOS GH#774)
61
62
  [self.panGestureRecognizer addTarget:self action:@selector(handleCustomPan:)];
@@ -642,11 +643,6 @@ static inline void RCTApplyTransformationAccordingLayoutDirection(
642
643
  [self react_updateClippedSubviewsWithClipRect:clipRect relativeToView:clipView];
643
644
  _lastClippedToRect = bounds;
644
645
  }
645
-
646
- #if TARGET_OS_OSX // [TODO(macOS GH#774)
647
- [[self scrollView] setHasHorizontalScroller:[self isHorizontal:_scrollView]];
648
- [[self scrollView] setHasVerticalScroller:[self isVertical:_scrollView]];
649
- #endif // ]TODO(macOS GH#774)
650
646
  }
651
647
 
652
648
  #if TARGET_OS_OSX // [TODO(macOS GH#774)
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.0.0-dd8ec0d8a
1
+ VERSION_NAME=0.0.0-ddcc38f1b
2
2
  GROUP=com.facebook.react
3
3
 
4
4
  POM_NAME=ReactNative
@@ -156,12 +156,14 @@ public class ReactInstanceManager {
156
156
  /* accessed from any thread */
157
157
  private final JavaScriptExecutorFactory mJavaScriptExecutorFactory;
158
158
 
159
+ // See {@code ReactInstanceManagerBuilder} for description of all flags here.
159
160
  private @Nullable List<String> mViewManagerNames = null;
160
161
  private final @Nullable JSBundleLoader mBundleLoader;
161
162
  private final @Nullable String mJSMainModulePath; /* path to JS bundle root on Metro */
162
163
  private final List<ReactPackage> mPackages;
163
164
  private final DevSupportManager mDevSupportManager;
164
165
  private final boolean mUseDeveloperSupport;
166
+ private final boolean mRequireActivity;
165
167
  private @Nullable ComponentNameResolverManager mComponentNameResolverManager;
166
168
  private @Nullable RuntimeSchedulerManager mRuntimeSchedulerManager;
167
169
  private final @Nullable NotThreadSafeBridgeIdleDebugListener mBridgeIdleDebugListener;
@@ -216,6 +218,7 @@ public class ReactInstanceManager {
216
218
  @Nullable String jsMainModulePath,
217
219
  List<ReactPackage> packages,
218
220
  boolean useDeveloperSupport,
221
+ boolean requireActivity,
219
222
  @Nullable NotThreadSafeBridgeIdleDebugListener bridgeIdleDebugListener,
220
223
  LifecycleState initialLifecycleState,
221
224
  @Nullable UIImplementationProvider mUIImplementationProvider,
@@ -233,6 +236,7 @@ public class ReactInstanceManager {
233
236
 
234
237
  DisplayMetricsHolder.initDisplayMetricsIfNotInitialized(applicationContext);
235
238
 
239
+ // See {@code ReactInstanceManagerBuilder} for description of all flags here.
236
240
  mApplicationContext = applicationContext;
237
241
  mCurrentActivity = currentActivity;
238
242
  mDefaultBackButtonImpl = defaultHardwareBackBtnHandler;
@@ -241,6 +245,7 @@ public class ReactInstanceManager {
241
245
  mJSMainModulePath = jsMainModulePath;
242
246
  mPackages = new ArrayList<>();
243
247
  mUseDeveloperSupport = useDeveloperSupport;
248
+ mRequireActivity = requireActivity;
244
249
  Systrace.beginSection(
245
250
  Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "ReactInstanceManager.initDevSupportManager");
246
251
  mDevSupportManager =
@@ -558,16 +563,20 @@ public class ReactInstanceManager {
558
563
  * @param activity the activity being paused
559
564
  */
560
565
  @ThreadConfined(UI)
561
- public void onHostPause(Activity activity) {
562
- Assertions.assertNotNull(mCurrentActivity);
563
- Assertions.assertCondition(
564
- activity == mCurrentActivity,
565
- "Pausing an activity that is not the current activity, this is incorrect! "
566
- + "Current activity: "
567
- + mCurrentActivity.getClass().getSimpleName()
568
- + " "
569
- + "Paused activity: "
570
- + activity.getClass().getSimpleName());
566
+ public void onHostPause(@Nullable Activity activity) {
567
+ if (mRequireActivity) {
568
+ Assertions.assertCondition(mCurrentActivity != null);
569
+ }
570
+ if (mCurrentActivity != null) {
571
+ Assertions.assertCondition(
572
+ activity == mCurrentActivity,
573
+ "Pausing an activity that is not the current activity, this is incorrect! "
574
+ + "Current activity: "
575
+ + mCurrentActivity.getClass().getSimpleName()
576
+ + " "
577
+ + "Paused activity: "
578
+ + activity.getClass().getSimpleName());
579
+ }
571
580
  onHostPause();
572
581
  }
573
582
 
@@ -583,7 +592,8 @@ public class ReactInstanceManager {
583
592
  * this instance of {@link ReactInstanceManager}.
584
593
  */
585
594
  @ThreadConfined(UI)
586
- public void onHostResume(Activity activity, DefaultHardwareBackBtnHandler defaultBackButtonImpl) {
595
+ public void onHostResume(
596
+ @Nullable Activity activity, DefaultHardwareBackBtnHandler defaultBackButtonImpl) {
587
597
  UiThreadUtil.assertOnUiThread();
588
598
 
589
599
  mDefaultBackButtonImpl = defaultBackButtonImpl;
@@ -592,7 +602,7 @@ public class ReactInstanceManager {
592
602
 
593
603
  /** Use this method when the activity resumes. */
594
604
  @ThreadConfined(UI)
595
- public void onHostResume(Activity activity) {
605
+ public void onHostResume(@Nullable Activity activity) {
596
606
  UiThreadUtil.assertOnUiThread();
597
607
 
598
608
  mCurrentActivity = activity;
@@ -631,8 +641,8 @@ public class ReactInstanceManager {
631
641
  // activity is attached to window, we can enable dev support immediately
632
642
  mDevSupportManager.setDevSupportEnabled(true);
633
643
  }
634
- } else {
635
- // there is no activity, we can enable dev support
644
+ } else if (!mRequireActivity) {
645
+ // there is no activity, but we can enable dev support
636
646
  mDevSupportManager.setDevSupportEnabled(true);
637
647
  }
638
648
  }
@@ -666,7 +676,9 @@ public class ReactInstanceManager {
666
676
  * @param activity the activity being destroyed
667
677
  */
668
678
  @ThreadConfined(UI)
669
- public void onHostDestroy(Activity activity) {
679
+ public void onHostDestroy(@Nullable Activity activity) {
680
+ // In some cases, Activity may (correctly) be null.
681
+ // See mRequireActivity flag.
670
682
  if (activity == mCurrentActivity) {
671
683
  onHostDestroy();
672
684
  }