From b45e8686375653e14a9681e0a1ed1c91668ad57b Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Tue, 27 Oct 2026 04:49:38 -0700 Subject: [PATCH] Inline native Switch props in JSX (#59481) Summary: Remove the intermediate platform prop objects so native Switch prop overrides are explicit in the JSX on both platforms. Behaviour is unchanged. Changelog: [Internal] Differential Revision: D127565462 --- .../Libraries/Components/Switch/Switch.js | 60 ++++++++----------- 1 file changed, 26 insertions(+), 34 deletions(-) diff --git a/packages/react-native/Libraries/Components/Switch/Switch.js b/packages/react-native/Libraries/Components/Switch/Switch.js index 5c296fbcd02b..5e7cf328a24d 100644 --- a/packages/react-native/Libraries/Components/Switch/Switch.js +++ b/packages/react-native/Libraries/Components/Switch/Switch.js @@ -238,59 +238,51 @@ const Switch: component( if (Platform.OS === 'android') { const {onTintColor, tintColor, ...androidProps} = restProps; - const platformProps = { - accessibilityState: _accessibilityState, - enabled: _disabled !== true, - on: value === true, - style, - thumbTintColor: thumbColor, - trackColorForFalse: trackColorForFalse, - trackColorForTrue: trackColorForTrue, - trackTintColor: value === true ? trackColorForTrue : trackColorForFalse, - }; - return ( ); } else { - const platformProps = { - accessibilityState: _accessibilityState, - disabled, - onTintColor: trackColorForTrue, - style: StyleSheet.compose( - {alignSelf: 'flex-start' as const}, - StyleSheet.compose( - style, - ios_backgroundColor == null - ? null - : { - backgroundColor: ios_backgroundColor, - borderRadius: 16, - }, - ), - ), - thumbTintColor: thumbColor, - tintColor: trackColorForFalse, - value: value === true, - }; - return ( ); }