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

263
Views
How to change cursor position when press in TextInput

For example i have a TextInput like this

<ScrollView style={{flex: 1}}>
      <TextInput
        placeholder="Input"
        style={{fontSize: 50}}
        value={'Sample text'}
      />
</ScrollView>

So normally, when we click on the TextInput, it will automatic show caret at the end of text ( on android ), no matter where we click, at the first time, it will have the caret at the end, like this

enter image description here

BUT HOW can we set the caret in where we click, for example when we click the "m" letter, it will have caret after the "m", like this

enter image description here

Problem is, as i said, on android we always have the the caret at the end first, then if we click other, the caret will more to that, like this

enter image description here

I mean, it not a problem when text is short, but imagine, the text will like this

enter image description here

And we want to edit some text that already exist, so it scroll all the way down to the bottom (because the bottom contain the lastest text)

So my question is

HOW CAN WE SET THE CARET ON WHERE WE TOUCH (OR CLICK), NOT FROM LASTEST WORD IN TEXTINPUT?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You need to request focus to this TextInput.

<TextInput
    placeholder="Input"
    autofocus={true}
    style={{fontSize: 50}}
    value={'Sample text'}
  />

Or if it will not be working, write this please https://github.com/react-native-modal/react-native-modal/issues/516

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!