P粉7014918972023-08-15 18:29:16
You should set your state variable to a string, like this:
const [temperatureColor, setTemperatureColor] = useState("navyblue");
Then update the value like this:
setTemperatureColor(isChecked ? "navyblue" : "red");
And use that string value in your JSX like this:
<View style={{ color: temperatureColor }}></View>
Hope this helps.