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

120
Views
glitch in react native clipboard while typing anything into TextInput

is there anyway to handle the input text context menu or detect the paste event. whenever i'm using clipboard functionality it causes the glitch while typing anything because clipboard.getString() awaits each time typing anything into the textbox.

i'm allowing user to enter only 10 digits in the TextInput, if user copies numbers from somewhere and pasted into TextInput it trims the last two digits, i.e. phone number 70XXXXXXXX -> in this case if user copies number which does not have leading +91 or 91 or 0 it works okay, but if number is like this +9170XXXXXXXXXX in this case it trims the last 2 digits and in textInput and it enters like 9170XXXXXX while it should be pasted as 70XXXXXXXX. -> this case is handled but it causes the glitch everytime user types anyting it awaits to check for the clipboard data.

<TextInput
  value={this.state.value}
  keyboardType="numeric"
  maxLength={10}
  onChangeText={async (val) => {
    let clipData = await Clipboard.getString();
    if (clipData) {
      let replacedValue = clipData.replace(/ /g, "").slice(-10);
      Clipboard.setString("");
      this.setState("value", replacedValue);
    } else {
        this.setState("value", val);
    }
  }}
/>
about 4 years ago · Santiago Trujillo
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!