Skip to content

Deprecated api #853

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 12, 2021
Merged
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
12 changes: 6 additions & 6 deletions React/Base/macOS/RCTPlatformDisplayLink.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#import <CoreVideo/CVDisplayLink.h>
#import <CoreVideo/CVHostTime.h>

#import <libkern/OSAtomic.h>
#import <os/lock.h>

@interface RCTPlatformDisplayLink ()

Expand All @@ -30,7 +30,7 @@ @implementation RCTPlatformDisplayLink
__weak id _target;
NSRunLoop *_runLoop;
NSMutableArray<NSRunLoopMode> *_modes;
OSSpinLock _lock; // OS_SPINLOCK_INIT == 0
os_unfair_lock _lock; // OS_UNFAIR_LOCK_INIT == 0
}

+ (RCTPlatformDisplayLink *)displayLinkWithTarget:(id)target selector:(SEL)sel
Expand All @@ -47,15 +47,15 @@ static CVReturn RCTPlatformDisplayLinkCallBack(__unused CVDisplayLinkRef display
RCTPlatformDisplayLink *rctDisplayLink = (__bridge RCTPlatformDisplayLink*)displayLinkContext;

// Lock and check for invalidation prior to calling out to the runloop
OSSpinLockLock(&rctDisplayLink->_lock);
os_unfair_lock_lock(&rctDisplayLink->_lock);
if (rctDisplayLink->_runLoop != nil) {
CFRunLoopRef cfRunLoop = [rctDisplayLink->_runLoop getCFRunLoop];
CFRunLoopPerformBlock(cfRunLoop, kCFRunLoopDefaultMode, ^{
[rctDisplayLink tick];
});
CFRunLoopWakeUp(cfRunLoop);
}
OSSpinLockUnlock(&rctDisplayLink->_lock);
os_unfair_lock_unlock(&rctDisplayLink->_lock);
}
return kCVReturnSuccess;
}
Expand Down Expand Up @@ -98,10 +98,10 @@ - (void)removeFromRunLoop:(__unused NSRunLoop *)runloop forMode:(NSRunLoopMode)m
- (void)invalidate
{
if (_runLoop != nil) {
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
_runLoop = nil;
_modes = nil;
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);

// CVDisplayLinkStop attempts to acquire a mutex possibly held during the callback's invocation.
// Stop the display link outside of the lock to avoid deadlocking here.
Expand Down
4 changes: 2 additions & 2 deletions React/Views/RCTActivityIndicatorView.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ - (instancetype)initWithFrame:(CGRect)frame
{
if ((self = [super initWithFrame:frame])) {
self.displayedWhenStopped = NO;
self.style = NSProgressIndicatorSpinningStyle;
self.style = NSProgressIndicatorStyleSpinning;
}
return self;
}
Expand Down Expand Up @@ -82,7 +82,7 @@ - (void)updateLayer
[super updateLayer];
if (_color != nil) {
CGFloat r, g, b, a;
[[_color colorUsingColorSpaceName:NSCalibratedRGBColorSpace] getRed:&r green:&g blue:&b alpha:&a];
[[_color colorUsingColorSpace:[NSColorSpace genericRGBColorSpace]] getRed:&r green:&g blue:&b alpha:&a];

CIFilter *colorPoly = [CIFilter filterWithName:@"CIColorPolynomial"];
[colorPoly setDefaults];
Expand Down
6 changes: 3 additions & 3 deletions React/Views/RCTProgressViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ @implementation RCTConvert (RCTProgressViewManager)

#if TARGET_OS_OSX // [TODO(macOS GH#774)
RCT_ENUM_CONVERTER(NSProgressIndicatorStyle, (@{
@"default": @(NSProgressIndicatorBarStyle),
@"bar": @(NSProgressIndicatorBarStyle),
}), NSProgressIndicatorBarStyle, integerValue)
@"default": @(NSProgressIndicatorStyleBar),
@"bar": @(NSProgressIndicatorStyleBar),
}), NSProgressIndicatorStyleBar, integerValue)
#else // ]TODO(macOS GH#774)
RCT_ENUM_CONVERTER(
UIProgressViewStyle,
Expand Down
2 changes: 1 addition & 1 deletion React/Views/RCTSlider.m
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ @implementation RCTSlider {
- (instancetype)initWithFrame:(NSRect)frameRect
{
if (self = [super initWithFrame:frameRect]) {
self.cell.controlSize = NSRegularControlSize;
self.cell.controlSize = NSControlSizeRegular;
((RCTSliderCell*)self.cell).delegate = self;
}
return self;
Expand Down
8 changes: 4 additions & 4 deletions React/Views/RCTSwitch.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ @implementation RCTSwitch
- (instancetype)initWithFrame:(CGRect)frame
{
if ((self = [super initWithFrame:frame])) {
self.buttonType = NSSwitchButton;
self.buttonType = NSButtonTypeSwitch;
self.title = @""; // default is "Button"
}
return self;
Expand All @@ -34,20 +34,20 @@ - (void)setOn:(BOOL)on animated:(BOOL)animated
}
#else // [TODO(macOS GH#774)
- (void)setOn:(BOOL)on animated:(BOOL)animated {
self.state = on ? NSOnState : NSOffState;
self.state = on ? NSControlStateValueOn : NSControlStateValueOff;
}
#endif // ]TODO(macOS GH#774)

#if TARGET_OS_OSX

- (BOOL)on
{
return self.state == NSOnState;
return self.state == NSControlStateValueOn;
}

- (void)setOn:(BOOL)on
{
self.state = on ? NSOnState : NSOffState;
self.state = on ? NSControlStateValueOn : NSControlStateValueOff;
}

#endif // ]TODO(macOS GH#774)
Expand Down