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

365
Visualizações
onChangeText for InputField Causing Runtime Error in React-Native

I'm using React-Native and "Formik" to try to create a text input field. I define a constant input field as the following: textinput and then try to embed it in a container using the following function: enter image description here The onChangeText line is what's causing the error; when I get rid of "username" the error disappears, but I need to call handleChange with that argument. (Additionally, whenever I try to call anything on the values parameter, it gives me the error that it is undefined).

Any advice?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

So the longer answer is that onChangeText is requiring a callback function, (exactly like onClick for instance)

So basically you have to pass {handleChange} and not {handleChange()} or it will call your function each time it rerenders

You issue is that you had a parameter, in that case you can define an arrow function directly here like I told you in the comments and this arrow function will contain a call to your function with your parameter:

onChangeText={() => {handleChange("username")}}
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