Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

199
Vistas
Validating input text field, do not accept first character as a number and special character

Allow valid case and prevent invalid case in Input text field

The input field must accept the following:

Valid cases
qw12@ qwe12
qweryt@123

And not accept the following:

Invalid case
1a@
@qwe1
1@qwer

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You could do that making you textInput a controlled component

const [textInputValue, setTextInputValue] = useState('')

  const onTextInputChange = (newText) => {
    //Here you can manipulate the value of the textinput as you want

    setTextInputValue(newText)
  }

  return (
    <View style={styles.container}>
      <TextInput style={styles.textInput} value={textInputValue} onChangeText={onTextInputChange} />
    </View>
  );

consider that with this solution you might experience some flickering issues if the user type faster than react-native is able to update the native view.

Otherwise you can try to implement it natively, for instance here's an example of a custom wrapper for the TextInput component which allows to pass a regex to whitelist allowed characters

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda