androidiosreactjsreact-nativetintcolor

React Native - Why we use the tintColor property for Image component?


When i use tintColor property it fills the whole image to the color i specified to the tintColor property. Is i am using it wrong or its job is the same what i get? Can anyone tell for what purpose this property is used for <Image/> component and what is the proper use of this property? A little example will be more appreciated. Thanks !!!

Reference link


Solution

  • As per the documentation, tintColor changes the color of all the non-transparent pixels to the tintColor (taken word for word).

    So for example, in one of my React Native packages, I use have an increment asset - https://github.com/hannigand/react-native-ui-stepper/blob/master/assets/increment.png - which has a blue + sign. Using tintColor, another User can recolour the blue (non-transparent pixel) to any colour they desire.