question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cursor in TextInput jumps when using in Modal/Dialog

See original GitHub issue

Current behaviour

I’m using a TextInput inside a Dialog. When entering text somewhere in the middle, the cursor jumps back before that newly entered character. When deleting a character, the cursor jumps before the previous character.

Expected behaviour

Code sample

const [value, setValue] = useState("");

return (
  <Portal>
    <Dialog visible={props.visible} dismissable={false}>
      <Dialog.Title>Title</Dialog.Title>
      <Dialog.Content>
        <TextInput value={value} onChangeText={setValue} />
     </Dialog.Content>
   </Dialog>
  </Portal>
);

Screenshots (if applicable)

Peek 2021-02-25 11-01

What have you tried

Your Environment

software version
ios or android android
react-native 0.63.4
react-native-paper 4.7.2
node 14.15.4
npm 7.5.4

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
raajnadarcommented, Jul 15, 2022

Pass the state value to the defaultValue prop it will make the input uncontrolled and the issue will get solved

0reactions
alexandreandriessecommented, Jul 15, 2022

I still have this problem, and it’s annoying !

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - Cursor in TextInput jumps when using in Modal/Dialog -
I'm using a TextInput inside a Dialog . When entering text somewhere in the middle, the cursor jumps back before that newly entered...
Read more >
TextInput cursor jump to right end when the input is empty
So this method will prevent you from getting cursor jumping to the right. There is another props called caretHidden. You can use them...
Read more >
Modal Dialog Example | APG | WAI - W3C
The text of this dialog describes design considerations for initial focus and accessible descriptions in dialogs with large amounts of text.
Read more >
Modal - Bootstrap
Use Bootstrap's JavaScript modal plugin to add dialogs to your site for lightboxes, user notifications, or completely custom content.
Read more >
Modal dialog - Examples - Components - Atlassian Design ...
A modal dialog displays content that requires user interaction, ... jump between projects, and get back to work quickly with our new look...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found