Switch using deprecated props according to react native
See original GitHub issue**Explain what you did**
Using listItem in flatList
<ListItem roundAvatar title={${item.name}} titleStyle={{ paddingLeft: 20, fontSize: 16 }} rightTitle={item.mode} rightTitleStyle={Styles.flatListItemRightTitle} leftIcon={<Icon name={item.icon} size={23} color={colors.primary} />} hideChevron switchButton={item.switch} switched={item.switched} switchOnTintColor={colors.primary} switchThumbTintColor={colors.primary} switchTintColor={colors.background} containerStyle={{ borderBottomWidth: 0, marginTop:15, marginBottom: 15 }} onPress={item.onPress} onSwitch={item.onSwitch} />
Expected behaviour
A switch in listItem working with no yellow box warnings
Describe the bug Deprecated props on switch warning This is the current implementation @xavier-villelegier which is causing the deprecated warning. According to react native 0.57.xx documentation, tintColor changes to trackColor e.t.c Switch props should be updated in this library’s implementation of the switch in listItem.js
{switchButton && hideChevron && ( <View style={styles.switchContainer}> <Switch onValueChange={onSwitch} disabled={disabled ? disabled : switchDisabled} onTintColor={switchOnTintColor} thumbTintColor={switchThumbTintColor} tintColor={switchTintColor} value={switched}] /> </View> )}
To Reproduce We highly recommend that you re-create the bug on Snack. If not, list the steps that a reviewer can take to reproduce the behaviour:
Steps
- Add listItem to FlatList
- Use any of the switch props for the listItem
- Open flatList
- See warning
Possible Solution Update Switch props to use new props
Your Environment (please complete the following information):
| software | version |
|---|---|
| react-native-elements | 0.19.1 |
| react-native | 0.57.5 |
| yarn | v1.12.1 |
Issue Analytics
- State:
- Created 5 years ago
- Comments:5

Top Related StackOverflow Question
@iamdarknight Okay I see that they have deprecated these three props:
onTintColor,thumbTintColorandtintColor.As we’re working on the v1, we deploy a v0.19.x only if it’s a critical bug, which is not the case here for now. Moreover, the
ListItemhas been fully rewritten, and much more modular, as you can pass anything you want to theSwitchcomponent, so this won’t happen anymore in the v1.You can test it out by running
npm i -S react-native-elements@beta, and have a look at thev1.0.0-beta7ListItem documentation@iamdarknight You can go through the release notes of the betas to have an idea of the changes, but you can also wait for the official v1, we’ll surely do a migration guide 👍