activate and deactivate textInput

StackOverflow I’m trying to make a button to change the boolean value from true to false and vise versa in order to change editable value in textInput. This is how far I got till this momment:

  const [change, setChange] = useState(true);
  const [text, setText] = useState("");

  const textEdit = () => {
    change === true ? setChange(false) : setChange(true);


for some reason after hitting below TouchableOpacity, it won’t change the state or there must be a problem in my code that prevent react from changing the state of “change” in the below text input

          style={{ width: "100%", height: 100, backgroundColor: "gray" }}
          placeholder={"write something"}
          onChangeText={(text) => setText(text)}

          onPress={() => {
          <Text style={{ color: "blue" }}>Change</Text>


Because you don’t call function textEdit on press. Just update like this:

onPress={() => {

Or cleaner: