Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

362
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!