Skip to content
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

[Switch] make sure wasOn is set properly #1871

Merged
merged 1 commit into from
Jul 6, 2023
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
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;
Saadnajmi marked this conversation as resolved.
Show resolved Hide resolved
@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