Skip to content

Commit 8d42fc4

Browse files
zhongwuzwreact-native-bot
authored andcommitted
iOS: Fixes Switch component incorrectly renders as toggled on even though value prop is hardcoded to false (#50049)
Summary: Fixes #50026 ## Changelog: [IOS] [FIXED] - [Fabric] iOS: Fixes Switch component incorrectly renders as toggled on even though value prop is hardcoded to false Pull Request resolved: #50049 Test Plan: Repro please see #50026. Reviewed By: javache Differential Revision: D71307864 Pulled By: cipolleschi fbshipit-source-id: 57238296842229cf2f23a3f44134f43e27b54609
1 parent 2760184 commit 8d42fc4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/react-native/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
6060
const auto &newSwitchProps = static_cast<const SwitchProps &>(*props);
6161

6262
// `value`
63-
if (oldSwitchProps.value != newSwitchProps.value) {
63+
if (!_isInitialValueSet || oldSwitchProps.value != newSwitchProps.value) {
6464
BOOL shouldAnimate = _isInitialValueSet == YES;
6565
[_switchView setOn:newSwitchProps.value animated:shouldAnimate];
6666
}

0 commit comments

Comments
 (0)