Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .nx/version-plans/version-plan-1792088305769.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
__default__: patch
---

Fix macOS crashes when setting a shadow color or scroll indicator insets, and two compiler warnings
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"versionActionsOptions": {
"currentVersionResolver": "registry",
"currentVersionResolverMetadata": {
"tag": "latest"
"tag": "0.81-stable"
}
},
"useLegacyVersioning": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
7 changes: 2 additions & 5 deletions packages/react-native/React/Base/RCTUIKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
14 changes: 4 additions & 10 deletions packages/react-native/React/Views/RCTView.m
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ @implementation RCTView {
NSTrackingArea *_trackingArea;
BOOL _hasMouseOver;
BOOL _mouseDownCanMoveWindow;
NSColor *_innerShadowColor;
#endif // macOS]
NSMutableDictionary<NSString *, NSDictionary *> *accessibilityActionsNameMap;
NSMutableDictionary<NSString *, NSDictionary *> *accessibilityActionsLabelMap;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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];
Expand Down
12 changes: 12 additions & 0 deletions packages/react-native/React/Views/ScrollView/RCTScrollView.m
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
Loading