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

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

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 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!