diff --git a/React/Base/RCTUIKit.h b/React/Base/RCTUIKit.h index f4192078cab878..132e3c6f9fb723 100644 --- a/React/Base/RCTUIKit.h +++ b/React/Base/RCTUIKit.h @@ -546,7 +546,7 @@ typedef UISwitch RCTUISwitch; #else @interface RCTUISwitch : NSSwitch NS_ASSUME_NONNULL_BEGIN -@property (nonatomic, assign, getter=isOn) BOOL on; +@property (nonatomic, getter=isOn) BOOL on; - (void)setOn:(BOOL)on animated:(BOOL)animated; diff --git a/React/Base/macOS/RCTUIKit.m b/React/Base/macOS/RCTUIKit.m index 8f53be98da82fa..37fc992afedb87 100644 --- a/React/Base/macOS/RCTUIKit.m +++ b/React/Base/macOS/RCTUIKit.m @@ -642,7 +642,7 @@ - (BOOL)isOn - (void)setOn:(BOOL)on { - self.state = on ? NSControlStateValueOn : NSControlStateValueOff; + [self setOn:on animated:NO]; } - (void)setOn:(BOOL)on animated:(BOOL)animated { diff --git a/React/Views/RCTSwitchManager.m b/React/Views/RCTSwitchManager.m index df1d1dba5a062e..cb623ddd175e96 100644 --- a/React/Views/RCTSwitchManager.m +++ b/React/Views/RCTSwitchManager.m @@ -46,7 +46,7 @@ - (void)onChange:(RCTSwitch *)sender if ([view isKindOfClass:[RCTSwitch class]]) { [(RCTSwitch *)view setOn:value animated:NO]; } else { - RCTLogError(@"view type must be UISwitch"); + RCTLogError(@"view type must be RCTUISwitch"); // [macOS] } }]; }