I have multiple color strings coming in from the DB. For each color, I convert it to lowercase then pass it in the inline styles:
const color-picker-item = color => (
<View style={{backgroundColor: color.toLowerCase()}} />
)
This worked fine when the colors being passed are valid css color strings like 'RED' and 'WHITE' but now I'm getting funky color strings that just show up as a default white. Is there a way to change this default color, so if color is not a valid string color then display this other color instead.
I checked this solution out but it uses new Option.style
which isn't working with react native. Any other recommendations?
It also looks like the non valid colors have more than 1 word so I may do a white space check instead but hoping for another solution!