Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

198
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda