facebook / react-native

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

Cannot find EventEmitter for receivedTouches on native library after upgrading to RN 0.71.7 #37462

Open uuzelac opened 1 year ago

uuzelac commented 1 year ago

New Version

0.71.7

Old Version

0.65.1

Build Target(s)

Android device in debug/release build

Output of react-native info

System: OS: macOS 12.6.1 CPU: (10) arm64 Apple M1 Pro Memory: 93.38 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 19.0.1 - ~/.nvm/versions/node/v19.0.1/bin/node Yarn: Not Found npm: 8.19.2 - ~/.nvm/versions/node/v19.0.1/bin/npm Watchman: Not Found Managers: CocoaPods: 1.12.1 - /Users/urosuzelac/.rvm/gems/ruby-2.7.6/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0 Android SDK: Not Found IDEs: Android Studio: 2021.3 AI-213.7172.25.2113.9123335 Xcode: 14.0.1/14A400 - /usr/bin/xcodebuild Languages: Java: 11.0.16.1 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: 0.71.7 => 0.71.7 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Issue and Reproduction Steps

After upgrading to the newer version of React Native we noticed that we have an issue with one of our native modules. Our native module is responsible for video playback. It is a custom written video player on native side using ExoPlayer on Android and AVPlayer on iOS. If we have multiple videos on the same page if one of the videos goes to fullscreen mode and return to the normal size other videos become unresponsive to touch events so we cannot trigger show/hide controls on rest of the players. This effect just Android OS and everything is ok with iOS side.

This is the error type of message that we receive while we try to tap on the videos that are not responsive any more.

Unhandled SoftException com.facebook.react.bridge.ReactNoCrashSoftException: Cannot find EventEmitter for receivedTouches: ReactTag[2131361976] UIManagerType[2] EventName[topTouchMove] at com.facebook.react.uimanager.events.ReactEventEmitter.receiveTouches(ReactEventEmitter.java:13) at com.facebook.react.uimanager.events.k.d(TouchEvent.java:7) at com.facebook.react.uimanager.events.e$c.run(EventDispatcherImpl.java:117) at android.os.Handler.handleCallback(Handler.java:942) at android.os.Handler.dispatchMessage(Handler.java:99) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:1) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:38)

and this error message

Unhandled SoftException com.facebook.react.bridge.ReactNoCrashSoftException: Cannot get UIManager for UIManagerType: 2 at com.facebook.react.uimanager.x0.h(UIManagerHelper.java:118) at com.facebook.react.uimanager.x0.g(UIManagerHelper.java:2) at com.facebook.react.animated.n.m(NativeAnimatedNodesManager.java:18) at com.facebook.react.animated.n.onEventDispatch(NativeAnimatedNodesManager.java:7) at com.facebook.react.uimanager.events.e.g(EventDispatcherImpl.java:28) at com.facebook.react.uimanager.m.a(JSTouchDispatcher.java:55) at com.facebook.react.uimanager.m.e(JSTouchDispatcher.java:6) at com.facebook.react.b0.c(ReactRootView.java:32) at com.facebook.react.uimanager.events.h.b(NativeGestureUtil.java:5) at j6.e.r(ReactScrollView.java:1) at j6.e.onInterceptTouchEvent(ReactScrollView.java:23) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2653) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802) at com.swmansion.gesturehandler.react.k.dispatchTouchEvent(RNGestureHandlerRootView.kt:23) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802) at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:500) at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1905) at android.app.Activity.dispatchTouchEvent(Activity.java:4263) at k.j.dispatchTouchEvent(WindowCallbackWrapper.java:3) at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:458)

We downgraded some of the third party libraries that we believe can cause this type of issue. We also try to downgrade some of the libraries on Android Native side but that didn't help.

We are also using the exact same player library version on one of our projects that is using React Native version 0.70.6 and we don't have that issue. The codebase between those two project are pretty similar as well as third party libraries that we are using, so we believe that something is changed how React Native handle Activity/Fragments on Android side.

Any idea for the solution would be helpful :)

cortinico commented 1 year ago

Have you turned on the New Architecture by any chance?

uuzelac commented 1 year ago

Hi Nicola, No we didn't enable new architecture since not all libraries that we are using are supported by the new architecture. However, we are using hermes engine but that was already turned on before the upgrade.

cortinico commented 1 year ago

Hi Nicola, No we didn't enable new architecture since not all libraries that we are using are supported by the new architecture. However, we are using hermes engine but that was already turned on before the upgrade.

Great thanks for the clarification. Your stacktrace looked suspicious hence I wanted to ask this.

uuzelac commented 1 year ago

@cortinico Do you have any suggestion what should we try so that we can have more understanding about the problem? Thanks

cortinico commented 1 year ago

We are also using the exact same player library version on one of our projects that is using React Native version 0.70.6 and we don't have that issue. The codebase between those two project are pretty similar as well as third party libraries that we are using, so we believe that something is changed how React Native handle Activity/Fragments on Android side.

Sadly, due to this, is really hard to help. If you were to reproduce your issue on 0.71 with just your module, it would be way easier to tell you what's happening

yahacom commented 1 year ago

I faced same issue. My native module operates with Tuya Video View for IP Camera. And I also catch same errors when try to work with touches.

Robert6321 commented 6 months ago

Hey, was a solution ever found for this problem ? I noticed that UIManagerType 2 points to the Fabric architecture but I am using the plain old Native UI component. Not sure why this error is coming for me. Please help!

react-native-bot commented 1 day ago

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.