Skip to content

Commit 26912bd

Browse files
elicwhitefacebook-github-bot
authored andcommitted
Delete thumbTintColor, tintColor, onTintColor props
Summary: Deprecations for these props were added in 0.57, June 2018, in this commit: 965adee#diff-6ee4e62c750fcd87064f152f53214a05, with warnings added in 9a4fd6b#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 965adee#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
1 parent 8e5fac8 commit 26912bd

File tree

1 file changed

+9
-39
lines changed

1 file changed

+9
-39
lines changed

Libraries/Components/Switch/Switch.js

+9-39
Original file line numberDiff line numberDiff line change
@@ -113,48 +113,18 @@ class Switch extends React.Component<Props> {
113113
...props
114114
} = this.props;
115115

116-
// Support deprecated color props.
117-
let _thumbColor = thumbColor;
118-
let _trackColorForFalse = trackColor?.false;
119-
let _trackColorForTrue = trackColor?.true;
120-
121-
// TODO: Remove support for these props after a couple releases.
122-
const {thumbTintColor, tintColor, onTintColor} = (props: $FlowFixMe);
123-
if (thumbTintColor != null) {
124-
_thumbColor = thumbTintColor;
125-
if (__DEV__) {
126-
console.warn(
127-
'Switch: `thumbTintColor` is deprecated, use `thumbColor` instead.',
128-
);
129-
}
130-
}
131-
if (tintColor != null) {
132-
_trackColorForFalse = tintColor;
133-
if (__DEV__) {
134-
console.warn(
135-
'Switch: `tintColor` is deprecated, use `trackColor` instead.',
136-
);
137-
}
138-
}
139-
if (onTintColor != null) {
140-
_trackColorForTrue = onTintColor;
141-
if (__DEV__) {
142-
console.warn(
143-
'Switch: `onTintColor` is deprecated, use `trackColor` instead.',
144-
);
145-
}
146-
}
116+
const trackColorForFalse = trackColor?.false;
117+
const trackColorForTrue = trackColor?.true;
147118

148119
if (Platform.OS === 'android') {
149120
const platformProps = {
150121
enabled: disabled !== true,
151122
on: value === true,
152123
style,
153-
thumbTintColor: _thumbColor,
154-
trackColorForFalse: _trackColorForFalse,
155-
trackColorForTrue: _trackColorForTrue,
156-
trackTintColor:
157-
value === true ? _trackColorForTrue : _trackColorForFalse,
124+
thumbTintColor: thumbColor,
125+
trackColorForFalse: trackColorForFalse,
126+
trackColorForTrue: trackColorForTrue,
127+
trackTintColor: value === true ? trackColorForTrue : trackColorForFalse,
158128
};
159129

160130
return (
@@ -172,7 +142,7 @@ class Switch extends React.Component<Props> {
172142

173143
const platformProps = {
174144
disabled,
175-
onTintColor: _trackColorForTrue,
145+
onTintColor: trackColorForTrue,
176146
style: StyleSheet.compose(
177147
{height: 31, width: 51},
178148
StyleSheet.compose(
@@ -185,8 +155,8 @@ class Switch extends React.Component<Props> {
185155
},
186156
),
187157
),
188-
thumbTintColor: _thumbColor,
189-
tintColor: _trackColorForFalse,
158+
thumbTintColor: thumbColor,
159+
tintColor: trackColorForFalse,
190160
value: value === true,
191161
};
192162

0 commit comments

Comments
 (0)