react-native: Unable to find JSIModule for class UIManager

Description

After update to React native 0.64.0 many people have Unable to find JSIModule for class UIManager crash. There was no crash on the 0.63.4.

Related issues

https://github.com/software-mansion/react-native-gesture-handler/issues/1284 https://github.com/react-native-community/releases/issues/221#issuecomment-805540303

React Native version:

React native info System: OS: macOS 11.2.3 CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 1.08 GB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 15.12.0 - /usr/local/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 7.6.3 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.10.1 - /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: 29, 30 Build Tools: 28.0.3, 29.0.2, 30.0.1 System Images: android-21 | Google APIs Intel x86 Atom, android-22 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom, android-24 | Google APIs Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom, android-30 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86 Atom Android NDK: Not Found IDEs: Android Studio: 4.1 AI-201.8743.12.41.7199119 Xcode: 12.4/12D4e - /usr/bin/xcodebuild Languages: Java: 1.8.0_282 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.1 => 17.0.1 react-native: 0.64.0 => 0.64.0 react-native-macos: Not Found npmGlobalPackages: *react-native*: Not Found

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. Render PanGestureHandler
  2. Render RNCamera
  3. Press on camera view port

Logcat

Logcat 2021-03-26 15:55:59.361 18259-18259/com.jsimodule E/InputEventReceiver: Exception dispatching input event. 2021-03-26 15:55:59.361 18259-18259/com.jsimodule E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback 2021-03-26 15:55:59.363 18259-18259/com.jsimodule E/MessageQueue-JNI: java.lang.IllegalArgumentException: Unable to find JSIModule for class UIManager at com.facebook.react.bridge.JSIModuleRegistry.getModule(JSIModuleRegistry.java:24) at com.facebook.react.bridge.CatalystInstanceImpl.getJSIModule(CatalystInstanceImpl.java:564) at com.facebook.react.uimanager.UIManagerHelper.getUIManager(UIManagerHelper.java:90) at com.facebook.react.uimanager.UIManagerHelper.getUIManager(UIManagerHelper.java:46) at com.facebook.react.uimanager.UIManagerHelper.getUIManagerForReactTag(UIManagerHelper.java:40) at com.facebook.react.animated.NativeAnimatedNodesManager.handleEvent(NativeAnimatedNodesManager.java:505) at com.facebook.react.animated.NativeAnimatedNodesManager.onEventDispatch(NativeAnimatedNodesManager.java:483) at com.facebook.react.uimanager.events.EventDispatcherImpl.dispatchEvent(EventDispatcherImpl.java:116) at com.facebook.react.uimanager.JSTouchDispatcher.handleTouchEvent(JSTouchDispatcher.java:74) at com.facebook.react.ReactRootView.dispatchJSTouchEvent(ReactRootView.java:283) at com.facebook.react.ReactRootView.onInterceptTouchEvent(ReactRootView.java:201) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2664) at com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView.dispatchTouchEvent(RNGestureHandlerEnabledRootView.java:39) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2742) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2742) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2742) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2742) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2742) at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:488) at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1871) at android.app.Activity.dispatchTouchEvent(Activity.java:4125) at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69) at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:446) at android.view.View.dispatchPointerEvent(View.java:14568) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:6016) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5819) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5310) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5367) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5333) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5485) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5341) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5542) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5314) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5367) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5333) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5341) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5314) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:8080) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:8031) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7992) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:8203) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:220) at android.os.MessageQueue.nativePollOnce(Native Method) 2021-03-26 15:55:59.363 18259-18259/com.jsimodule E/MessageQueue-JNI: at android.os.MessageQueue.next(MessageQueue.java:335) at android.os.Looper.loop(Looper.java:183) at android.app.ActivityThread.main(ActivityThread.java:7656) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) 2021-03-26 15:55:59.364 18259-18259/com.jsimodule D/AndroidRuntime: Shutting down VM
--------- beginning of crash

2021-03-26 15:55:59.366 18259-18259/com.jsimodule E/AndroidRuntime: FATAL EXCEPTION: main Process: com.jsimodule, PID: 18259 java.lang.IllegalArgumentException: Unable to find JSIModule for class UIManager at com.facebook.react.bridge.JSIModuleRegistry.getModule(JSIModuleRegistry.java:24) at com.facebook.react.bridge.CatalystInstanceImpl.getJSIModule(CatalystInstanceImpl.java:564) at com.facebook.react.uimanager.UIManagerHelper.getUIManager(UIManagerHelper.java:90) at com.facebook.react.uimanager.UIManagerHelper.getUIManager(UIManagerHelper.java:46) at com.facebook.react.uimanager.UIManagerHelper.getUIManagerForReactTag(UIManagerHelper.java:40) at com.facebook.react.animated.NativeAnimatedNodesManager.handleEvent(NativeAnimatedNodesManager.java:505) at com.facebook.react.animated.NativeAnimatedNodesManager.onEventDispatch(NativeAnimatedNodesManager.java:483) at com.facebook.react.uimanager.events.EventDispatcherImpl.dispatchEvent(EventDispatcherImpl.java:116) at com.facebook.react.uimanager.JSTouchDispatcher.handleTouchEvent(JSTouchDispatcher.java:74) at com.facebook.react.ReactRootView.dispatchJSTouchEvent(ReactRootView.java:283) at com.facebook.react.ReactRootView.onInterceptTouchEvent(ReactRootView.java:201) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2664) at com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView.dispatchTouchEvent(RNGestureHandlerEnabledRootView.java:39) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2742) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2742) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2742) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2742) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2742) at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:488) at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1871) at android.app.Activity.dispatchTouchEvent(Activity.java:4125) at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69) at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:446) at android.view.View.dispatchPointerEvent(View.java:14568) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:6016) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5819) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5310) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5367) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5333) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5485) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5341) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5542) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5314) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5367) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5333) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5341) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5314) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:8080) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:8031) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7992) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:8203) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:220) 2021-03-26 15:55:59.366 18259-18259/com.jsimodule E/AndroidRuntime: at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:335) at android.os.Looper.loop(Looper.java:183) at android.app.ActivityThread.main(ActivityThread.java:7656) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

--------- beginning of system

2021-03-26 15:55:59.386 18259-18259/com.jsimodule I/Process: Sending signal. PID: 18259 SIG: 9

Expected Results

No crash

Snack, code example, screenshot, or link to a repository:

https://github.com/Bardiamist/jsimodule

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 57
  • Comments: 46 (15 by maintainers)

Commits related to this issue

Most upvoted comments

We are working on a fix that’s currently on review.

@ejanzer, @sharifhh, @mikehardy thanks for looking into this.

I agree with @ejanzer that this is caused by views that are not directly managed by React Native. In particular, we are referring to views that are not created by this method:

https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java#L140-L141

I’ll analyze what’s the proper solution here and update the issue

Can we get a patch until RN 0.64.2 is released?
This is quite an issue for apps using RN 0.64 in production.

Fixed in 0.64.2

Hi, any update on this issue? Thanks for all!

I’m not using react-native-tab-view or @react-native-picker/picker. I downgraded RN to 0.63.4 until a fix has been found in 0.64.

The problem here is happening because the View getId() function is returning an even number and in react native code if the id is even it will use FABRIC and JSI and UIManager doesn’t support that, so it is breaking, now the question is why it generates even number, I tried to downgrade to react-native 0.63.4 and it worked, after that I upgraded back to 0.64 and did a small trick in the library that is crashing, I did the following findViewById(R.id.ID_OF_THE_ROOT_LAYOUT).setId(10023);

I believe this should be closed, as there is a commit on master and it’s been picked to release-0.65 as well

@Bardiamist I was able to resolve my case. It was caused by the usage of react-native-tab-view (v3.0.0) and @react-native-picker/picker (v1.12.0) on the same screen.

When I downgraded react-native-tab-view to v2.16.0 the error disappeared.

More details here -> https://github.com/satya164/react-native-tab-view/issues/1157

Got the same issue when using react-native-pager-view. For your case, the different between react-native-tab-view v2.16.0 and v3.0.0 is that v3 used pager-view so maybe that’s the root cause?

Normally that will have no effect if I understand correctly as the android code is pre-built and depended on as an aar, running react native from source has its own documentation. It can certainly work though if you follow it through

any progress?

I found that pressing my location button on react-native-maps reproduces the same crash on Android

I think @mdvacca is probably the right person to weigh in on this one! It seems like the JS touch handler assumes it’s only dealing with views that were created by React (in which case an even id == fabric) but that’s clearly… not always the case?

@Bardiamist I was able to resolve my case. It was caused by the usage of react-native-tab-view (v3.0.0) and @react-native-picker/picker (v1.12.0) on the same screen. When I downgraded react-native-tab-view to v2.16.0 the error disappeared.

More details here -> https://github.com/satya164/react-native-tab-view/issues/1157

@mikehardy, it worked, Thanks

It is

On Fri 4 Jun 2021 at 18:01, Juan S. Escobar @.***> wrote:

@mikehardy https://github.com/mikehardy could you tell me if the fix is in v0.64.2? I don’t see it referenced in the change log

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/facebook/react-native/issues/31245#issuecomment-854837212, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOVCFJGACVQT6QDVYZAFFTTRD2HFANCNFSM4Z277OKA .

– Erwan

@ebaynaud web search for building / running react native from source

@mtroskot I think the way it goes is that as soon as that commit lands on master you post a cherry pick request to the RN064.1 and RN0.65 cherry picks conversation - which I have just done 😃

in my case using react-native-image-crop-tools is crashing when trying to move the crop box with the finger, this module is using UIManager directly

I was able to easily reproduce this issue with:

just mount this on some image and try to zoom with two fingers (even clicking into it make a crash)

import React, { Component } from 'react';
import { View, PanResponder, Dimensions } from 'react-native';

class ZoomView extends Component {
  constructor(props) {
    super(props);
    this._panResponder = PanResponder.create({
      onPanResponderMove: (e, { dy }) => {
        const { height: windowHeight } = Dimensions.get(`window`);
        return this.props.onZoomProgress(Math.min(Math.max((dy * -1) / windowHeight, 0), 0.5));
      },
      onMoveShouldSetPanResponder: (ev, { dx }) => {
        return dx !== 0;
      },
      onPanResponderGrant: () => {
        return this.props.onZoomStart();
      },
      onPanResponderRelease: () => {
        return this.props.onZoomEnd();
      },
    });
  }
  render() {
    return (
      <View style={{ flex: 1, width: `100%` }}>
        {this.props.children}
      </View>
    );
  }
}

export default ZoomView;

@sharifhh that’s great digging - if I git blame on there it all seems to point to @mdvacca and possibly @ejanzer (going from this https://github.com/facebook/react-native/commit/0a12f3ea77840c218fd9d67d0e3f2ea068cb8c5f) - I think they might know more about the even/odd partitioning of dispatch event handling and specifically in the last commit how what appears to be a new exception raised affects other modules. Hopefully one of them has time to share their wisdom here on the crash as I think it’s related to that change