react native TextInput event text value code example

Example 1: react native textinput

import React, { Component } from 'react';
import { TextInput } from 'react-native';

export default function UselessTextInput() {
  const [textInputValue, setTextInputValue] = React.useState('');

  return (
    <TextInput
      style={{ 
    	height: 40, 
    	borderColor: 'gray', 
    	borderWidth: 1,
    	placeholderTextColor: 'gray',
    }}
      onChangeText={text => setTextInputValue(text)}
      value={textInputValue}
	  placeholder="Insert your text!"
    />
  );
}

Example 2: textinput onpress react native

<TouchableOpacity onPress={() => console.log("Pressed")}>
  <TextInput
   pointerEvents="none"
  />
</TouchableOpacity>