Skip to content

App crashes when editing text on Samsung Android 15 #53598

Description

@borysenko-oleksandr

Description

We encountered an issue on Samsung devices running the latest version of Android.
When a user starts using the magnifier to edit text, the app crashes.

I found a similar problem described here. Maybe someone has already fixed a similar bug or has some ideas on how to get around it. Maybe there is a way to completely disable the possibility of using the magnifier?

Steps to reproduce

  1. Open the app and navigate to any screen with a text input field (TextView).
  2. Clear the text so the field is completely empty.
  3. Tap inside the field to place the text cursor.
  4. Long-press on the cursor or try to drag the selection handle (magnifier appears).

Actual Result:
The app crashes with NullPointerException in android.widget.Editor$HandleView.updateMagnifier.

Expected Result:
User should be able to interact with the cursor and magnifier without app crashing.

React Native Version

0.77

Affected Platforms

Runtime - Android

Output of npx @react-native-community/cli info

System:
  OS: macOS 14.7.8
  CPU: (10) arm64 Apple M1 Pro
  Memory: 134.91 MB / 16.00 GB
  Shell:
    version: 3.2.57
    path: /bin/bash
Binaries:
  Node:
    version: 20.9.0
    path: /usr/local/bin/node
  Yarn:
    version: 1.22.21
    path: /usr/local/bin/yarn
  npm:
    version: 10.2.4
    path: /usr/local/bin/npm
  Watchman:
    version: 2024.10.21.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /Users/oborysenko/.gem/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2025.1 AI-251.25410.109.2511.13752376
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 22.0.1
    path: /usr/bin/javac
  Ruby:
    version: 2.7.8
    path: /opt/homebrew/opt/ruby@2.7/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.77.2
    wanted: 0.77.2
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Stacktrace or Logs

java.lang.NullPointerException: Attempt to invoke virtual method 'int android.text.Layout.getLineForOffset(int)' on a null object reference at android.widget.Editor$HandleView.getLineForOffset(Editor.java:6136) at android.widget.Editor$HandleView.obtainMagnifierShowCoordinates(Editor.java:6385) at android.widget.Editor$HandleView.updateMagnifier(Editor.java:6509) at android.widget.Editor$SelectionHandleView.onTouchEvent(Editor.java:7872) at android.view.View.performOnTouchCallback(View.java:17047) at android.view.View.dispatchTouchEvent(View.java:17004) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3353) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3023) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3353) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3023) at android.widget.PopupWindow$PopupDecorView.dispatchTouchEvent(PopupWindow.java:2921) at android.view.View.dispatchPointerEvent(View.java:17329) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:9551) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:9268) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:8590) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:8647) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:8613) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:8813) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:8621) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:8870) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:8594) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:8647) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:8613) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:8621) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:8594) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:12432) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:12327) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:12283) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:12582) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:385) at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method) at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:313) at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:12531) at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:12679) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1751) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1760) at android.view.Choreographer.doCallbacks(Choreographer.java:1216) at android.view.Choreographer.doFrame(Choreographer.java:1127) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1707) at android.os.Handler.handleCallback(Handler.java:959) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loopOnce(Looper.java:257) at android.os.Looper.loop(Looper.java:342) at android.app.ActivityThread.main(ActivityThread.java:9634) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:619) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:929)

MANDATORY Reproducer

you can use any app with TextView

Screenshots and Videos

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions