Skip to content

Commit

Permalink
[Switch] make sure wasOn is set properly (microsoft#1871)
Browse files Browse the repository at this point in the history
  • Loading branch information
Saadnajmi authored Jul 6, 2023
1 parent e76df51 commit 28dd130
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion React/Base/RCTUIKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion React/Base/macOS/RCTUIKit.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion React/Views/RCTSwitchManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
}];
}
Expand Down

0 comments on commit 28dd130

Please sign in to comment.