Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on Samsung devices in TextInput #30882

Closed
Levin-nik opened this issue Feb 4, 2021 · 5 comments
Closed

Crash on Samsung devices in TextInput #30882

Levin-nik opened this issue Feb 4, 2021 · 5 comments
Labels
Resolution: Duplicate Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@Levin-nik
Copy link

Description

We ran into a problem in our application.
Firebase Crashlytics send crashes from Samsung devices

TextView.java line 17181
android.widget.TextView.semSetSelection

Stack trace:

Fatal Exception: java.lang.IndexOutOfBoundsException: setSpan (27 ... 27) ends beyond length 0
       at android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:1335)
       at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:694)
       at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:686)
       at android.text.Selection.setSelection(Selection.java:94)
       at android.text.Selection.setSelection(Selection.java:78)
       at android.widget.TextView.semSetSelection(TextView.java:17181)
       at android.widget.TextView.semSetSelection(TextView.java:17195)
       at android.widget.Editor$InsertionHandleView.updateSelection(Editor.java:6869)
       at android.widget.Editor$HandleView.positionAtCursorOffset(Editor.java:5686)
       at android.widget.Editor$HandleView.filterOnTouchUp(Editor.java:5543)
       at android.widget.Editor$HandleView.onTouchEvent(Editor.java:6126)
       at android.widget.Editor$InsertionHandleView.onTouchEvent(Editor.java:6798)
       at android.view.View.dispatchTouchEvent(View.java:14368)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3863)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3551)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3863)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3551)
       at android.widget.PopupWindow$PopupDecorView.dispatchTouchEvent(PopupWindow.java:2860)
       at android.view.View.dispatchPointerEvent(View.java:14636)
       at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:6582)
       at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:6360)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5796)
       at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5849)
       at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5815)
       at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5971)
       at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5823)
       at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:6028)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5796)
       at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5849)
       at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5815)
       at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5823)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5796)
       at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:9032)
       at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:8889)
       at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:8842)
       at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:9169)
       at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:194)
       at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
       at android.os.MessageQueue.next(MessageQueue.java:336)
       at android.os.Looper.loop(Looper.java:197)
       at android.app.ActivityThread.main(ActivityThread.java:8167)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)

React Native version:

System:
    OS: macOS 11.1
    CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
    Memory: 152.44 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 15.3.0 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.0.14 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.0 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
    Android SDK:
      API Levels: 28, 29, 30
      Build Tools: 28.0.3, 29.0.2, 30.0.2
      System Images: android-22 | Google APIs Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom_64, android-30 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.6953283
    Xcode: 12.4/12D4e - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_271 - /Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.3 => 0.63.3 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
@safaiyeh
Copy link
Contributor

safaiyeh commented Feb 6, 2021

Hi @Levin228 thanks for the issue! There is a nice discussion here: #29063 about the same issue. I recommend posting there to give more context/urgency. Closing this issue as a duplicate

@jocoders
Copy link

I have the same crash on react-native 0.63.2:

Fatal Exception: java.lang.IndexOutOfBoundsException: setSpan (1 ... 1) ends beyond length 0
       at android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:1309)
       at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:680)
       at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:672)
       at android.text.Selection.setSelection(Selection.java:76)
       at android.widget.TextView.semSetSelection(TextView.java:13272)
       at android.widget.EditText.setSelection(EditText.java:150)
       at com.facebook.react.views.textinput.ReactEditText.setSelection(ReactEditText.java:308)
       at com.facebook.react.views.textinput.ReactEditText.maybeSetSelection(ReactEditText.java:302)
       at com.facebook.react.views.textinput.ReactTextInputManager.updateExtraData(ReactTextInputManager.java:291)
       at com.facebook.react.views.textinput.ReactTextInputManager.updateExtraData(ReactTextInputManager.java:84)
       at com.facebook.react.uimanager.NativeViewHierarchyManager.updateViewExtraData(NativeViewHierarchyManager.java:149)
       at com.facebook.react.uimanager.UIViewOperationQueue$UpdateViewExtraData.execute(UIViewOperationQueue.java:240)
       at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:917)
       at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:1028)
       at com.facebook.react.uimanager.UIViewOperationQueue.access$2600(UIViewOperationQueue.java:48)
       at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1088)
       at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)
       at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:175)
       at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:85)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:909)
       at android.view.Choreographer.doCallbacks(Choreographer.java:723)
       at android.view.Choreographer.doFrame(Choreographer.java:655)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
       at android.os.Handler.handleCallback(Handler.java:790)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:7025)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)

Any ideas how to solve it?

Copy link

github-actions bot commented Nov 7, 2023

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Nov 7, 2023
Copy link

This issue was closed because it has been stalled for 7 days with no activity.

@fabOnReact
Copy link
Contributor

Do you still experience this issue?

I have four years of experience maintaining facebook/react-native and I specialize in the Text and TextInput components. I currently have 58 facebook/react-native PRs.

If you still experience this issue, I will prepare a patched release with the fix.

Thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Duplicate Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

4 participants