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 is jumping when delete symbols from the middle of value

See original GitHub issue

Problem: When use value property, that goes from state variable, and delete characters from the middle of value, cursor is jumping to last character.

Please, take a look at the attached gif: 20210311_101727

OS: Android Version: 2.0.1

How to reproduce: Example of code:

const App = () => {
  const [value, setValue] = useState('');

  const onChangeText = useCallback(
    (formatted: string) => setValue(formatted),
    [],
  );

  return (
    <SafeAreaView>
      <ScrollView>
        <View>
          <TextInputMask
            value={value}
            onChangeText={onChangeText}
            mask={'+1 ([000]) [000] [00] [00]'}
            style={styles.input}
          />
        </View>
      </ScrollView>
    </SafeAreaView>
  );
};

Repo to reproduce: https://github.com/abramovslava/jumping-cursor-react-native-text-input-mask

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
martintreurnichtcommented, Mar 26, 2021

@abramovslava Ok i see, you’re using version 2. That version is no longer supported, it was created by the previous maintainer, please upgrade to the latest version. I can confirm that it no longer happens on the latest

2reactions
7dpcommented, Jul 7, 2021

still jumping on v3.1.4

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to stop cursor from jumping to the end of input
I start facing the problem when I try to delete/add a digit somewhere in the middle and then cursor immediately moves to the...
Read more >
The Curious Case of Cursor Jumping - Mutually Human
It usually happens when the app is programmatically setting/changing the value of the text field in a keydown , keypress , or keyup...
Read more >
Cursor jumping/automatically archiving and deleting emails
I use Outlook for personal and work email on my Macbook Air and recently have had major problems when typing emails. The cursor...
Read more >
Preserve cursor position when filtering out characters from a ...
If we put the cursor in the middle of the input and try to insert a number, we can see that the cursor...
Read more >
Computer Cursor Keeps Jumping Around – What To Do - Alphr
Stop the Cursor Jumping in Windows 10 · Mouse Issue · Update the Mouse Driver · Uninstall the Mouse · Remove Extra Mice...
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