react-native-macos 0.0.0-9c5b39c5b → 0.0.0-9c995215a

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.
@@ -17,5 +17,5 @@ exports.version = {
17
17
  major: 0,
18
18
  minor: 0,
19
19
  patch: 0,
20
- prerelease: '9c5b39c5b',
20
+ prerelease: '9c995215a',
21
21
  };
@@ -183,7 +183,8 @@ __attribute__((used)) RCT_EXTERN void RCTEnableNewArchitectureViolationReporting
183
183
 
184
184
  // When reporting is enabled, trigger an assertion.
185
185
  __attribute__((used)) RCT_EXTERN void RCTEnforceNotAllowedForNewArchitecture(id context, NSString *extra);
186
-
187
- // When reporting is enabled, warn about the violation. Use this to prepare a specific callsite
186
+ // When reporting is enabled, trigger an error but do not crash. Use this to prepare a specific callsite
188
187
  // for stricter enforcement. When ready, switch it to use the variant above.
189
- __attribute__((used)) RCT_EXTERN void RCTWarnNotAllowedForNewArchitecture(id context, NSString *extra);
188
+ __attribute__((used)) RCT_EXTERN void RCTErrorNotAllowedForNewArchitecture(id context, NSString *extra);
189
+ // When reporting is enabled, log an message. When ready, switch it to use the variant above.
190
+ __attribute__((used)) RCT_EXTERN void RCTLogNotAllowedForNewArchitecture(id context, NSString *extra);
@@ -274,11 +274,20 @@ void RCTEnforceNotAllowedForNewArchitecture(id context, NSString *extra)
274
274
  RCTAssert(0, @"%@", getNewArchitectureViolationMessage(context, extra));
275
275
  }
276
276
 
277
- void RCTWarnNotAllowedForNewArchitecture(id context, NSString *extra)
277
+ void RCTErrorNotAllowedForNewArchitecture(id context, NSString *extra)
278
278
  {
279
279
  if (!newArchitectureViolationReporting) {
280
280
  return;
281
281
  }
282
282
 
283
- RCTLogWarn(@"%@", getNewArchitectureViolationMessage(context, extra));
283
+ RCTLogError(@"%@", getNewArchitectureViolationMessage(context, extra));
284
+ }
285
+
286
+ void RCTLogNotAllowedForNewArchitecture(id context, NSString *extra)
287
+ {
288
+ if (!newArchitectureViolationReporting) {
289
+ return;
290
+ }
291
+
292
+ RCTLogInfo(@"%@", getNewArchitectureViolationMessage(context, extra));
284
293
  }
@@ -60,7 +60,7 @@ NSArray<Class> *RCTGetModuleClasses(void)
60
60
  void RCTRegisterModule(Class);
61
61
  void RCTRegisterModule(Class moduleClass)
62
62
  {
63
- RCTWarnNotAllowedForNewArchitecture(
63
+ RCTLogNotAllowedForNewArchitecture(
64
64
  @"RCTRegisterModule()", [NSString stringWithFormat:@"'%@' was registered unexpectedly", moduleClass]);
65
65
 
66
66
  static dispatch_once_t onceToken;
@@ -28,7 +28,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
28
28
  RCTVersionMajor: @(0),
29
29
  RCTVersionMinor: @(0),
30
30
  RCTVersionPatch: @(0),
31
- RCTVersionPrerelease: @"9c5b39c5b",
31
+ RCTVersionPrerelease: @"9c995215a",
32
32
  };
33
33
  });
34
34
  return __rnVersion;
@@ -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
 
@@ -85,6 +85,7 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg
85
85
  // This helps to only update state from `scrollViewDidScroll` in case
86
86
  // some other part of the system scrolls scroll view.
87
87
  BOOL _isUserTriggeredScrolling;
88
+ BOOL _shouldUpdateContentInsetAdjustmentBehavior;
88
89
 
89
90
  CGPoint _contentOffsetWhenClipped;
90
91
  }
@@ -108,6 +109,7 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg
108
109
  _scrollView.delaysContentTouches = NO;
109
110
  ((RCTEnhancedScrollView *)_scrollView).overridingDelegate = self;
110
111
  _isUserTriggeredScrolling = NO;
112
+ _shouldUpdateContentInsetAdjustmentBehavior = YES;
111
113
  [self addSubview:_scrollView];
112
114
 
113
115
  _containerView = [[UIView alloc] initWithFrame:CGRectZero];
@@ -253,7 +255,8 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg
253
255
  }
254
256
  }
255
257
 
256
- if (oldScrollViewProps.contentInsetAdjustmentBehavior != newScrollViewProps.contentInsetAdjustmentBehavior) {
258
+ if ((oldScrollViewProps.contentInsetAdjustmentBehavior != newScrollViewProps.contentInsetAdjustmentBehavior) ||
259
+ _shouldUpdateContentInsetAdjustmentBehavior) {
257
260
  auto const contentInsetAdjustmentBehavior = newScrollViewProps.contentInsetAdjustmentBehavior;
258
261
  if (contentInsetAdjustmentBehavior == ContentInsetAdjustmentBehavior::Never) {
259
262
  scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
@@ -264,6 +267,7 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg
264
267
  } else if (contentInsetAdjustmentBehavior == ContentInsetAdjustmentBehavior::Always) {
265
268
  scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAlways;
266
269
  }
270
+ _shouldUpdateContentInsetAdjustmentBehavior = NO;
267
271
  }
268
272
 
269
273
  MAP_SCROLL_VIEW_PROP(disableIntervalMomentum);
@@ -377,6 +381,11 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg
377
381
  {
378
382
  const auto &props = *std::static_pointer_cast<const ScrollViewProps>(_props);
379
383
  _scrollView.contentOffset = RCTCGPointFromPoint(props.contentOffset);
384
+ // We set the default behavior to "never" so that iOS
385
+ // doesn't do weird things to UIScrollView insets automatically
386
+ // and keeps it as an opt-in behavior.
387
+ _scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
388
+ _shouldUpdateContentInsetAdjustmentBehavior = YES;
380
389
  _state.reset();
381
390
  _isUserTriggeredScrolling = NO;
382
391
  [super prepareForRecycle];
@@ -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
 
@@ -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)
@@ -9,7 +9,6 @@
9
9
 
10
10
  #import <React/RCTUtils.h>
11
11
  #import <React/RCTViewComponentView.h>
12
- #import <UIKit/UIGestureRecognizerSubclass.h>
13
12
 
14
13
  #import "RCTConversions.h"
15
14
  #import "RCTTouchableComponentViewProtocol.h"
@@ -95,7 +95,7 @@ RCT_EXPORT_MODULE()
95
95
 
96
96
  - (void)setBridge:(RCTBridge *)bridge
97
97
  {
98
- RCTWarnNotAllowedForNewArchitecture(self, @"RCTViewManager must not be initialized for the new architecture");
98
+ RCTErrorNotAllowedForNewArchitecture(self, @"RCTViewManager must not be initialized for the new architecture");
99
99
  _bridge = bridge;
100
100
  }
101
101
 
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.0.0-9c5b39c5b
1
+ VERSION_NAME=0.0.0-9c995215a
2
2
  GROUP=com.facebook.react
3
3
 
4
4
  POM_NAME=ReactNative
@@ -22,5 +22,5 @@ public class ReactNativeVersion {
22
22
  "major", 0,
23
23
  "minor", 0,
24
24
  "patch", 0,
25
- "prerelease", "9c5b39c5b");
25
+ "prerelease", "9c995215a");
26
26
  }
@@ -22,7 +22,7 @@ constexpr struct {
22
22
  int32_t Major = 0;
23
23
  int32_t Minor = 0;
24
24
  int32_t Patch = 0;
25
- std::string_view Prerelease = "9c5b39c5b";
25
+ std::string_view Prerelease = "9c995215a";
26
26
  } ReactNativeVersion;
27
27
 
28
28
  } // namespace facebook::react
@@ -10,7 +10,7 @@
10
10
  #include <react/debug/react_native_assert.h>
11
11
 
12
12
  #if defined(__OBJC__) && defined(__cplusplus)
13
- #if TARGET_OS_MAC && TARGET_OS_IPHONE
13
+ #if TARGET_OS_MAC
14
14
 
15
15
  #include <memory>
16
16
 
@@ -7,8 +7,7 @@
7
7
 
8
8
  #include "ManagedObjectWrapper.h"
9
9
 
10
- #if defined(__OBJC__) && defined(__cplusplus)
11
- #if TARGET_OS_MAC && TARGET_OS_IPHONE
10
+ #if TARGET_OS_MAC
12
11
 
13
12
  namespace facebook {
14
13
  namespace react {
@@ -35,4 +34,3 @@ void wrappedManagedObjectDeleter(void *cfPointer) noexcept
35
34
  @end
36
35
 
37
36
  #endif
38
- #endif
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-macos",
3
- "version": "0.0.0-9c5b39c5b",
3
+ "version": "0.0.0-9c995215a",
4
4
  "bin": "./cli.js",
5
5
  "description": "React Native for macOS",
6
6
  "license": "MIT",
@@ -85,7 +85,7 @@ GEM
85
85
  colored2 (~> 3.1)
86
86
  nanaimo (~> 0.3.0)
87
87
  rexml (~> 3.2.4)
88
- zeitwerk (2.6.4)
88
+ zeitwerk (2.6.6)
89
89
 
90
90
  PLATFORMS
91
91
  ruby
@@ -13,7 +13,7 @@
13
13
  "dependencies": {
14
14
  "react": "17.0.2",
15
15
  "react-native-macos": "1000.0.0",
16
- "react-native": "0.0.0-9c5b39c5b"
16
+ "react-native": "0.0.0-9c995215a"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@babel/core": "^7.12.9",