Answer the question
In order to leave comments, you need to log in
React Native How to change true/false on click?
There is such a code, when clicked, the state changes to "false" once only when clicked. How to make boolean value change permanently to false/true when pressing ?
const [passVissible, setPassVissible] = useState(true);
<TouchableOpacity onPress={() => setPassVissible(false) }>
<Text>{passVissible}</Text>
</TouchableOpacity>
Answer the question
In order to leave comments, you need to log in
TouchableOpacity onPress={() => {setPassVissible(prevpassVissible => !prevpassVissible)}}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question