Delete thumbTintColor, tintColor, onTintColor props

Summary:
Deprecations for these props were added in 0.57, June 2018, in this commit: 965adee109 (diff-6ee4e62c750fcd87064f152f53214a05), with warnings added in 9a4fd6b78d (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 965adee109 (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
This commit is contained in:
Eli White 2020-02-06 01:56:11 -08:00 коммит произвёл Facebook Github Bot
Родитель 8e5fac89bb
Коммит 26912bd979
1 изменённых файлов: 9 добавлений и 39 удалений

Просмотреть файл

@ -113,48 +113,18 @@ class Switch extends React.Component<Props> {
...props ...props
} = this.props; } = this.props;
// Support deprecated color props. const trackColorForFalse = trackColor?.false;
let _thumbColor = thumbColor; const trackColorForTrue = trackColor?.true;
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.',
);
}
}
if (Platform.OS === 'android') { if (Platform.OS === 'android') {
const platformProps = { const platformProps = {
enabled: disabled !== true, enabled: disabled !== true,
on: value === true, on: value === true,
style, style,
thumbTintColor: _thumbColor, thumbTintColor: thumbColor,
trackColorForFalse: _trackColorForFalse, trackColorForFalse: trackColorForFalse,
trackColorForTrue: _trackColorForTrue, trackColorForTrue: trackColorForTrue,
trackTintColor: trackTintColor: value === true ? trackColorForTrue : trackColorForFalse,
value === true ? _trackColorForTrue : _trackColorForFalse,
}; };
return ( return (
@ -172,7 +142,7 @@ class Switch extends React.Component<Props> {
const platformProps = { const platformProps = {
disabled, disabled,
onTintColor: _trackColorForTrue, onTintColor: trackColorForTrue,
style: StyleSheet.compose( style: StyleSheet.compose(
{height: 31, width: 51}, {height: 31, width: 51},
StyleSheet.compose( StyleSheet.compose(
@ -185,8 +155,8 @@ class Switch extends React.Component<Props> {
}, },
), ),
), ),
thumbTintColor: _thumbColor, thumbTintColor: thumbColor,
tintColor: _trackColorForFalse, tintColor: trackColorForFalse,
value: value === true, value: value === true,
}; };