diff --git a/.nx/version-plans/version-plan-1792088305769.md b/.nx/version-plans/version-plan-1792088305769.md new file mode 100644 index 000000000000..5621a1a5839f --- /dev/null +++ b/.nx/version-plans/version-plan-1792088305769.md @@ -0,0 +1,5 @@ +--- +__default__: patch +--- + +Fix macOS crashes when setting a shadow color or scroll indicator insets, and two compiler warnings diff --git a/nx.json b/nx.json index 06f7fc86f307..6b2e8c592e8e 100644 --- a/nx.json +++ b/nx.json @@ -21,7 +21,7 @@ "versionActionsOptions": { "currentVersionResolver": "registry", "currentVersionResolverMetadata": { - "tag": "latest" + "tag": "0.81-stable" } }, "useLegacyVersioning": false diff --git a/packages/react-native/Libraries/Network/RCTInspectorNetworkReporter.mm b/packages/react-native/Libraries/Network/RCTInspectorNetworkReporter.mm index 74d8155832cd..17f6e55093b7 100644 --- a/packages/react-native/Libraries/Network/RCTInspectorNetworkReporter.mm +++ b/packages/react-native/Libraries/Network/RCTInspectorNetworkReporter.mm @@ -126,7 +126,7 @@ + (void)reportResponseEnd:(NSNumber *)requestId encodedDataLength:(int)encodedDa #endif } -+ (void)reportRequestFailed:(NSNumber *)requestId cancelled:(bool)cancelled ++ (void)reportRequestFailed:(NSNumber *)requestId cancelled:(BOOL)cancelled { NetworkReporter::getInstance().reportRequestFailed(requestId.stringValue.UTF8String, cancelled); diff --git a/packages/react-native/React/Base/RCTUIKit.h b/packages/react-native/React/Base/RCTUIKit.h index 8f1094a71ed4..5212a2d4bcbd 100644 --- a/packages/react-native/React/Base/RCTUIKit.h +++ b/packages/react-native/React/Base/RCTUIKit.h @@ -247,11 +247,8 @@ typedef NS_ENUM(NSInteger, UIViewContentMode) { }; // UIInterface.h/NSUserInterfaceLayout.h -enum : NSInteger -{ - UIUserInterfaceLayoutDirectionLeftToRight = NSUserInterfaceLayoutDirectionLeftToRight, - UIUserInterfaceLayoutDirectionRightToLeft = NSUserInterfaceLayoutDirectionRightToLeft, -}; +#define UIUserInterfaceLayoutDirectionLeftToRight NSUserInterfaceLayoutDirectionLeftToRight +#define UIUserInterfaceLayoutDirectionRightToLeft NSUserInterfaceLayoutDirectionRightToLeft // RCTActivityIndicatorView.h typedef NS_ENUM(NSInteger, UIActivityIndicatorViewStyle) { diff --git a/packages/react-native/React/Views/RCTView.m b/packages/react-native/React/Views/RCTView.m index 0a4efc1fff0a..f94888eaf065 100644 --- a/packages/react-native/React/Views/RCTView.m +++ b/packages/react-native/React/Views/RCTView.m @@ -143,6 +143,7 @@ @implementation RCTView { NSTrackingArea *_trackingArea; BOOL _hasMouseOver; BOOL _mouseDownCanMoveWindow; + NSColor *_innerShadowColor; #endif // macOS] NSMutableDictionary *accessibilityActionsNameMap; NSMutableDictionary *accessibilityActionsLabelMap; @@ -731,11 +732,8 @@ - (NSString *)description #if TARGET_OS_OSX // [macOS - (void)setShadowColor:(CGColorRef)shadowColor { - if (_shadowColor != shadowColor) - { - _shadowColor = shadowColor; - [self didUpdateShadow]; - } + _innerShadowColor = shadowColor != NULL ? [NSColor colorWithCGColor:shadowColor] : nil; + [self didUpdateShadow]; } - (void)setShadowOffset:(CGSize)shadowOffset @@ -768,11 +766,7 @@ - (void)setShadowRadius:(CGFloat)shadowRadius -(void)didUpdateShadow { NSShadow *shadow = [NSShadow new]; - NSColor *baseShadowColor = nil; - if (_shadowColor != NULL) { - baseShadowColor = [NSColor colorWithCGColor:_shadowColor]; - } - shadow.shadowColor = [baseShadowColor colorWithAlphaComponent:[self shadowOpacity]]; + shadow.shadowColor = [_innerShadowColor colorWithAlphaComponent:[self shadowOpacity]]; shadow.shadowOffset = [self shadowOffset]; shadow.shadowBlurRadius = [self shadowRadius]; [self setShadow:shadow]; diff --git a/packages/react-native/React/Views/ScrollView/RCTScrollView.m b/packages/react-native/React/Views/ScrollView/RCTScrollView.m index eb79ff326143..8ebf55d60573 100644 --- a/packages/react-native/React/Views/ScrollView/RCTScrollView.m +++ b/packages/react-native/React/Views/ScrollView/RCTScrollView.m @@ -1505,6 +1505,18 @@ - (void)setContentInsetAdjustmentBehavior:(UIScrollViewContentInsetAdjustmentBeh _scrollView.contentInsetAdjustmentBehavior = behavior; _scrollView.contentOffset = contentOffset; } +#else // [macOS] No-op setters, so setting these props from JS doesn't crash +- (void)setScrollIndicatorInsets:(__unused UIEdgeInsets)value +{ +} + +- (void)setVerticalScrollIndicatorInsets:(__unused UIEdgeInsets)value +{ +} + +- (void)setAutomaticallyAdjustsScrollIndicatorInsets:(__unused BOOL)automaticallyAdjusts +{ +} #endif // [macOS] #pragma clang diagnostic pop // [macOS]