Android TextInput setting selection props beyond 0 on mount crash
See original GitHub issueWhen I set selection
props on <TextInput />
that is above 0 (e.g. { start: 1, end: 1 }
), it will crash at setSpan()
…
e.g.
<TextInput multiline={true} selection={{ start: 1, end: 1 }}>
<Text>abc</Text>
</TextInput>
It seems like the text are not set before selection is applied, thereby causing the crash. Crash log stack trace provided below.
Environment
Environment:
OS: macOS High Sierra 10.13.3
Node: 9.2.0
Yarn: 1.3.2
npm: 5.5.1
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 3.0 AI-171.4443003
Packages: (wanted => installed)
react: 16.2.0 => 16.2.0
react-native: 0.53.2 => 0.53.2
Expected Behavior
I would expect it to not crash and set the selection correctly.
Actual Behavior
It crashes with the following stack trace…
setSpan (1 ... 1) ends beyond length 0
Error while updating property 'selection' of a view managed by: AndroidTextInput
null
setSpan (1 ... 1) ends beyond length 0
updateViewProp
ViewManagersPropertyCache.java:92
setProperty
ViewManagerPropertyUpdater.java:129
updateProps
ViewManagerPropertyUpdater.java:48
updateProperties
ViewManager.java:34
createView
NativeViewHierarchyManager.java:233
execute
UIViewOperationQueue.java:153
dispatchPendingNonBatchedOperations
UIViewOperationQueue.java:1010
doFrameGuarded
UIViewOperationQueue.java:981
doFrame
GuardedFrameCallback.java:31
doFrame
ReactChoreographer.java:136
doFrame
ChoreographerCompat.java:107
run
Choreographer.java:856
doCallbacks
Choreographer.java:670
doFrame
Choreographer.java:603
run
Choreographer.java:844
handleCallback
Handler.java:739
dispatchMessage
Handler.java:95
loop
Looper.java:148
main
ActivityThread.java:5417
invoke
Method.java
run
ZygoteInit.java:726
main
ZygoteInit.java:616
Steps to Reproduce
https://snack.expo.io/@lxcid/textinput-selection-crash
Open the snack in Android and uncomment the line with selection={{ start: 1, end: 1 }}
…
<TextInput
// selection={{ start: 0, end: 0 }} // Uncomment and it does not crash
// selection={{ start: 1, end: 1 }} // Uncomment and it crash in android
style={styles.paragraph}
multiline={true}>
Issue Analytics
- State:
- Created 6 years ago
- Reactions:8
- Comments:16 (5 by maintainers)
Top Results From Across the Web
TextInput - React Native
TextInput. A foundational component for inputting text into the app via a keyboard. Props provide configurability for several features, ...
Read more >User Manual - DJI Air 2S
The remote controller works at both 2.4 and 5.8 GHz, and is capable of selecting the best transmission channel automatically without latency. The...
Read more >Carrier Configuration | Android Open Source Project
The set of values for a particular device is determined by querying the following components in order: The carrier app (this is optional,...
Read more >Reference Manual - CodeMirror
Create a set of changes and a new selection by running the given function for each ... You can either return a single...
Read more >Bug listing with status RESOLVED with resolution OBSOLETE ...
{10,12}: sysprof-modules crashes system when playing music" ... new chinese input method" status:RESOLVED resolution:OBSOLETE severity:normal · Bug:233881 ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
still have same issue in react native 0.60.5.
Closing, as #22723 was recently merged and will be available in 0.60 release. Thanks @shenyute!