Friday, May 17, 2024
163
rated 0 times [  166] [ 3]  / answers: 1 / hits: 37219  / 8 Years ago, fri, august 26, 2016, 12:00:00

I am using react native switch component and I want to change the color of switch when I turn it OFF.



I can add onTintColor property to change the color when it is turned on.



Is there any way to change the color while turning it OFF?


More From » react-native

 Answers
6

onTintColor has been deprecated try the following.



  <Switch 
trackColor={{true: 'red', false: 'grey'}}
onValueChange={this.toggleSwitch}
value={true}/>


this works


[#60911] Wednesday, August 24, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
madelyn

Total Points: 449
Total Questions: 100
Total Answers: 100

Location: Seychelles
Member since Fri, May 7, 2021
3 Years ago
;