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.

Changing TextInput selection after setting text crash

See original GitHub issue

When TextInput selection is updated after changing the text (using InteractionManager.runAfterInteractions to wait for the change to apply) RN crashes. You get error like “setSpan(4 … 4) ends beyond length” which indicates that the text field text has not changed like you would expect when using runAfterInteractions. React Native version:

info React Native Environment Info: System: OS: macOS 10.14.4 CPU: (8) x64 Intel® Core™ i7-7700HQ CPU @ 2.80GHz Memory: 34.23 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node Yarn: 1.12.3 - /usr/local/bin/yarn npm: 6.9.0 - ~/.nvm/versions/node/v10.16.0/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1 Android SDK: API Levels: 24, 25, 26, 27, 28 Build Tools: 23.0.1, 25.0.0, 25.0.2, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.3 System Images: android-25 | Google Play Intel x86 Atom, android-26 | Google APIs Intel x86 Atom IDEs: Android Studio: 3.4 AI-183.6156.11.34.5522156 Xcode: 10.1/10B61 - /usr/bin/xcodebuild npmPackages: react: 16.8.3 => 16.8.3 react-native: 0.59.9 => 0.59.9

Steps To Reproduce

  1. Change controlled TextInput value in code
  2. Change TextInput selection to be after the inserted text using InteractionManager.runAfterInteractions

or just run the example in repo I linked and press the button.

Describe what you expected to happen: Selection changes to place after inserted text

Snack, code example, or link to a repository: https://github.com/Vaintti/RNTextInputBug

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:8
  • Comments:16

github_iconTop GitHub Comments

1reaction
anilioscommented, Nov 28, 2019

I am also having same issue… don’t know how to fix…

Screenshot_20191128-131822_Good Neighbour

1reaction
blohamencommented, Aug 13, 2019

Have similar issue on RN 0.60.4

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native TextInput ref causes weird crash /lockup
In this case your TextInput value stores in this.state.text . And this component focuses the input on componentDidMount by using ...
Read more >
<input type="text"> - HTML: HyperText Markup Language | MDN
A Boolean attribute which, if present, means this field cannot be edited by the user. Its value can, however, still be changed by...
Read more >
Fixed issues in InDesign - Adobe Support
InDesign crashes on clicking the Applying Text Wrap option Select Subject in a few cases. InDesign crashes on saving after deleting an ...
Read more >
GameTextInput | Android Developers
Set up your build · Make sure gradle.properties contains the following lines: · Import the game-text-input package and add it to your target...
Read more >
expo crashes when i type in textinput : r/reactnative - Reddit
I am making an app with react native, and I have my text input to search up items, but when ever I go...
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