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

269
Visualizações
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 Respostas
Responde à pergunta

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