react native inputtext enforce focus code example

Example: react native textinput lost focus after charter type

Your TextInput components are being recreated and re-rendered each time you type something.

there are two main. solution i gusess:

use  onBlur={}

and  user autoFocus={true}

=======================================================================
or other solutions is blow you can use TextInput like this
const handleChange = (event) => {
        const {name, type, text} = event;
        setValues({...values, [name]: text})
    }


const MyTextInput = ({ valueVar, name, type, onChange }) => {
   return (
        <TextInput
            style={styles.textInputStyle}
            value={valueVar}
            onChangeText={text => onChange({ name, type, text })}
        />
   );
};


in return (

<MyTextInput
  name="email"
  type="text"
  valueVar={values.email}
onChange={handleChange}
/>
)