Reputation: 53
What is the way to change the color of the icon to red if the condition is greater than 0 and if it is equal to zero then it will be gray
<TouchableOpacity
onPress={() => {
if (Object.values(selectedItems).length > 0)
navigation.navigate('total', {
selectedItems: Object.values(selectedItems),
});
}}
>
<Icon size={40} color="white" name="barrel" />
</TouchableOpacity>
Upvotes: 1
Views: 554
Reputation: 5937
<Icon size={40} color={condition ? "red" : "gray"} name="barrel" />
should work
Upvotes: 4