facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.22k stars 24.33k forks source link

`ReactNoCrashSoftException: "Cannot find EventEmitter for receivedTouches"` warning in Android Native UI Component #46501

Open dekim1028 opened 1 month ago

dekim1028 commented 1 month ago

Description

We are creating an Android Native UI Component consisting of ViewPager2 and RecyclerView. When a touch occurs in RecyclerView, the following error occurs.

Steps to reproduce

  1. Run the project.
  2. Scroll through the thumbnail list.

React Native Version

0.75.3

Affected Platforms

Runtime - Android

Output of npx react-native info

System:
  OS: macOS 14.1
  CPU: (12) arm64 Apple M2 Pro
  Memory: 96.50 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.11.1
    path: ~/.nvm/versions/node/v20.11.1/bin/node
  Yarn: Not Found
  npm:
    version: 10.2.4
    path: ~/.nvm/versions/node/v20.11.1/bin/npm
  Watchman:
    version: 2023.10.23.00
    path: /usr/local/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.4
      - iOS 17.4
      - macOS 14.4
      - tvOS 17.4
      - visionOS 1.1
      - watchOS 10.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.18034.62.2412.12266719
  Xcode:
    version: 15.3/15E204a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.11
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.75.3
    wanted: 0.75.3
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: false

Stacktrace or Logs

Unhandled SoftException
com.facebook.react.bridge.ReactNoCrashSoftException: Cannot find EventEmitter for receivedTouches: ReactTag[2131230852] UIManagerType[2] EventName[topTouchStart]
    at com.facebook.react.uimanager.events.ReactEventEmitter.receiveTouches(ReactEventEmitter.java:102)
    at com.facebook.react.uimanager.events.TouchEvent.dispatchModern(TouchEvent.kt:124)
    at com.facebook.react.uimanager.events.EventDispatcherImpl$DispatchEventsRunnable.run(EventDispatcherImpl.java:376)
    at android.os.Handler.handleCallback(Handler.java:958)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
    at android.os.Looper.loopOnce(Looper.java:230)
    at android.os.Looper.loop(Looper.java:319)
    at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:235)
    at java.lang.Thread.run(Thread.java:1012)

Unhandled SoftException
com.facebook.react.bridge.ReactNoCrashSoftException: Cannot find EventEmitter for receivedTouches: ReactTag[2131230852] UIManagerType[2] EventName[topTouchMove]
    at com.facebook.react.uimanager.events.ReactEventEmitter.receiveTouches(ReactEventEmitter.java:102)
    at com.facebook.react.uimanager.events.TouchEvent.dispatchModern(TouchEvent.kt:124)
    at com.facebook.react.uimanager.events.EventDispatcherImpl$DispatchEventsRunnable.run(EventDispatcherImpl.java:376)
    at android.os.Handler.handleCallback(Handler.java:958)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
    at android.os.Looper.loopOnce(Looper.java:230)
    at android.os.Looper.loop(Looper.java:319)
    at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:235)
    at java.lang.Thread.run(Thread.java:1012)
Unhandled SoftException
com.facebook.react.bridge.ReactNoCrashSoftException: Cannot find EventEmitter for receivedTouches: ReactTag[2131230852] UIManagerType[2] EventName[topTouchEnd]
    at com.facebook.react.uimanager.events.ReactEventEmitter.receiveTouches(ReactEventEmitter.java:102)
    at com.facebook.react.uimanager.events.TouchEvent.dispatchModern(TouchEvent.kt:124)
    at com.facebook.react.uimanager.events.EventDispatcherImpl$DispatchEventsRunnable.run(EventDispatcherImpl.java:376)
    at android.os.Handler.handleCallback(Handler.java:958)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
    at android.os.Looper.loopOnce(Looper.java:230)
    at android.os.Looper.loop(Looper.java:319)
    at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:235)
    at java.lang.Thread.run(Thread.java:1012)

Reproducer

https://github.com/dekim1028/error

Screenshots and Videos

https://github.com/user-attachments/assets/86d636c7-4ecc-4666-a49e-208b88e701af

dekim1028 commented 1 month ago

@cortinico Is there any confirmation on this issue?

cortinico commented 1 month ago

@cortinico Is there any confirmation on this issue?

Nope not yet.

dekim1028 commented 1 month ago

@cortinico Do you have any suspicions about the cause of this phenomenon? I'm curious why this error occurs.

cortinico commented 1 month ago

@cortinico Do you have any suspicions about the cause of this phenomenon? I'm curious why this error occurs.

Hey @dekim1028 I briefly looked into this. What you're seeing is not an error but a warning (ReactNoCrashSoftException).

We make those warnings for debugging purposes.

I have a couple of follow-ups for you:

  1. Is the functionality of your apps affected in any form?
  2. Is this happening both on Old and New Architecture?
ilber commented 1 month ago

Hey @cortinico I have the same problem on my app when integrating a native view. I don't have the new architecture enabled and the error appears as soon as I click the native view. Many of those warnings are printed:

 Unhandled SoftException com.facebook.react.bridge.ReactNoCrashSoftException: Cannot find EventEmitter for receivedTouches: ReactTag[2131230898] UIManagerType[2] EventName[topTouchMove]
    at com.facebook.react.uimanager.events.ReactEventEmitter.receiveTouches(ReactEventEmitter.java:102)
    at com.facebook.react.uimanager.events.TouchEvent.dispatchModern(TouchEvent.kt:124)
    at com.facebook.react.uimanager.events.EventDispatcherImpl$DispatchEventsRunnable.run(EventDispatcherImpl.java:376)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
    at android.os.Looper.loopOnce(Looper.java:226)
    at android.os.Looper.loop(Looper.java:313)
    at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:235)
    at java.lang.Thread.run(Thread.java:920)

Isn't UIManagerType[2] related to fabric? Why is that used even when I don't have it enabled? Maybe the problem is with my native view, but I don't really get the reason for this warning.

Are these warnings displayed only in Debug?

Thanks for your help. Let me know how can I help you to understand more about this.

cortinico commented 1 month ago

Are these warnings displayed only in Debug?

Yes those are debug only messages