From 26912bd9798aeb38931466b8ddcd3a48973b0528 Mon Sep 17 00:00:00 2001 From: Eli White Date: Thu, 6 Feb 2020 01:56:11 -0800 Subject: [PATCH] Delete thumbTintColor, tintColor, onTintColor props Summary: Deprecations for these props were added in 0.57, June 2018, in this commit: https://github.com/facebook/react-native/commit/965adee109b86cc36f39a713237ade9592f13dad#diff-6ee4e62c750fcd87064f152f53214a05, with warnings added in https://github.com/facebook/react-native/commit/9a4fd6b78d83ad932d8fcc903b4c3d55b943e296#diff-6ee4e62c750fcd87064f152f53214a05 It has been a couple releases now, so let's clean up the component code and finally remove support. For instructions on how to migrate off these props, see the commit summary of https://github.com/facebook/react-native/commit/965adee109b86cc36f39a713237ade9592f13dad#diff-6ee4e62c750fcd87064f152f53214a05 Changelog: [Breaking][General] Switch: Remove support for thumbTintColor, tintColor, onTintColor props (deprecated in 0.57) Reviewed By: cpojer Differential Revision: D19760913 fbshipit-source-id: 8fdcf7af99fecadecf3157c00e6d1cbab8e63268 --- Libraries/Components/Switch/Switch.js | 48 +++++---------------------- 1 file changed, 9 insertions(+), 39 deletions(-) diff --git a/Libraries/Components/Switch/Switch.js b/Libraries/Components/Switch/Switch.js index 36fba9446b8d1f..0a9edc8b60c366 100644 --- a/Libraries/Components/Switch/Switch.js +++ b/Libraries/Components/Switch/Switch.js @@ -113,48 +113,18 @@ class Switch extends React.Component { ...props } = this.props; - // Support deprecated color props. - let _thumbColor = thumbColor; - let _trackColorForFalse = trackColor?.false; - let _trackColorForTrue = trackColor?.true; - - // TODO: Remove support for these props after a couple releases. - const {thumbTintColor, tintColor, onTintColor} = (props: $FlowFixMe); - if (thumbTintColor != null) { - _thumbColor = thumbTintColor; - if (__DEV__) { - console.warn( - 'Switch: `thumbTintColor` is deprecated, use `thumbColor` instead.', - ); - } - } - if (tintColor != null) { - _trackColorForFalse = tintColor; - if (__DEV__) { - console.warn( - 'Switch: `tintColor` is deprecated, use `trackColor` instead.', - ); - } - } - if (onTintColor != null) { - _trackColorForTrue = onTintColor; - if (__DEV__) { - console.warn( - 'Switch: `onTintColor` is deprecated, use `trackColor` instead.', - ); - } - } + const trackColorForFalse = trackColor?.false; + const trackColorForTrue = trackColor?.true; if (Platform.OS === 'android') { const platformProps = { enabled: disabled !== true, on: value === true, style, - thumbTintColor: _thumbColor, - trackColorForFalse: _trackColorForFalse, - trackColorForTrue: _trackColorForTrue, - trackTintColor: - value === true ? _trackColorForTrue : _trackColorForFalse, + thumbTintColor: thumbColor, + trackColorForFalse: trackColorForFalse, + trackColorForTrue: trackColorForTrue, + trackTintColor: value === true ? trackColorForTrue : trackColorForFalse, }; return ( @@ -172,7 +142,7 @@ class Switch extends React.Component { const platformProps = { disabled, - onTintColor: _trackColorForTrue, + onTintColor: trackColorForTrue, style: StyleSheet.compose( {height: 31, width: 51}, StyleSheet.compose( @@ -185,8 +155,8 @@ class Switch extends React.Component { }, ), ), - thumbTintColor: _thumbColor, - tintColor: _trackColorForFalse, + thumbTintColor: thumbColor, + tintColor: trackColorForFalse, value: value === true, };