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

Unable to find JSIModule for class UIManager #31245

Closed
Bardiamist opened this issue Mar 26, 2021 · 46 comments
Closed

Unable to find JSIModule for class UIManager #31245

Bardiamist opened this issue Mar 26, 2021 · 46 comments
Labels
Needs: Triage 🔍 Resolution: Locked This issue was locked by the bot.

Comments

@Bardiamist
Copy link
Contributor

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

software-mansion/react-native-gesture-handler#1284
react-native-community/releases#221 (comment)

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

@DanielMarkiel
Copy link

@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 -> satya164/react-native-tab-view#1157

@tien
Copy link

tien commented Mar 30, 2021

@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 -> satya164/react-native-tab-view#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?

@sharifhh
Copy link

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);

@mikehardy
Copy link
Contributor

@sharifhh fascinating! Can you point to the conditional in the react-native code that branches on even/odd view ids? And is there some specific library with an R.id.<ID_OF_THE_ROOT_LAYOUT> that is indigestible, or is that maybe any library ?

@sharifhh
Copy link

@mikehardy I guess it will happen in any library since android studio auto generates the ids for the views.

https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/uimanager/JSTouchDispatcher.java
line 85 you can see that there is
mTargetTag = findTargetTagAndSetCoordinates(ev);
this one goes and get the id, currently in my code it always returned as 2131230840 (I am not sure what that number means)
then line 86 dispatches that event

then here: https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerHelper.java
line 40 it calls "getUIManagerType"
This one returns FABRIC because as you can see in the implementation here:

public static int getUIManagerType(int reactTag) {

it checks if the reactTag is even or not.
then here again: https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerHelper.java line 85 it sees that the uiManagerType is FABRIC so it tries to call JSIModule for UIManager,

As far as I know UIManager is deprecated right? why does it contain a code that uses JSIModule for UIManager? I don't think it will be supported right?
For more details feel free to contact me, I can go throw the whole tree stack with you

@mikehardy
Copy link
Contributor

@sharifhh that's great digging - if I git blame on there it all seems to point to @mdvacca and possibly @ejanzer (going from this 0a12f3e) - 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

@ejanzer
Copy link

ejanzer commented Mar 30, 2021

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?

@mikehardy
Copy link
Contributor

@ejanzer thanks for chiming in! This is vague, apologies, and I'm not sure at all if it advances things but most (all?) of the crashes appear tied to the PanGestureHandler in the crash stack, and that one does create a View per installation documentation:

https://github.com/software-mansion/react-native-gesture-handler/blame/master/docs/docs/getting-started.md#L94

Update your MainActivity.java file (or wherever you create an instance of ReactActivityDelegate), so that it overrides the method responsible for creating ReactRootView instance and then use the root view wrapper provided by this library.

+  @Override
+  protected ReactActivityDelegate createReactActivityDelegate() {
+    return new ReactActivityDelegate(this, getMainComponentName()) {
+      @Override
+      protected ReactRootView createRootView() {
+       return new RNGestureHandlerEnabledRootView(MainActivity.this);
+      }
+    };
+  }

Unfortunately git blame indicates this chunk of docs has existed for 3 years so it is a weak lead but maybe something about the even/odd view creation assertion was changed slightly in react-native (it does appear so?) and is only now surfacing this as a crash?

@mdvacca
Copy link
Contributor

mdvacca commented Apr 1, 2021

@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

@johanpoirier
Copy link

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

@HimiGame
Copy link

@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 -> satya164/react-native-tab-view#1157

solve ~ thx

@tanmay-patil
Copy link

@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 -> satya164/react-native-tab-view#1157

In my case I face this same issue when I use datepicker along with react-native-snap-carousel

@tanmay-patil
Copy link

Does anyone have any fix for this yet?

@HimiGame
Copy link

Does anyone have any fix for this yet?

downgraded react-native-tab-view to v2.16.0 can solve my error

@johanpoirier
Copy link

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.

@tobob
Copy link

tobob commented Apr 22, 2021

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;

@Pointotech
Copy link

So no one knows how to fix this, except by downgrading arbitrary libraries until it stops happening? And there's some crazy even-number/odd-number scheme involved? What is going on here?

@Pointotech
Copy link

For the record, I was able to work around this bug by using react-native 0.64.0 in combination with react-native-tab-view 2.16.0. Something in react-native-tab-view 3.0.1 makes the app run into this react-native bug, if I understand correctly.

@JesperLekland
Copy link

@mdvacca Did you make any progress on this? The only option for us currently is to downgrade React Native :/

@kneza23
Copy link

kneza23 commented Apr 26, 2021

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

@efstathiosntonas
Copy link

efstathiosntonas commented Apr 27, 2021

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

@mikehardy
Copy link
Contributor

mikehardy commented Apr 27, 2021

@efstathiosntonas interesting

It creates a View directly itself: https://github.com/hhunaid/react-native-image-crop-tools/blob/5c3ab05dca20cefe542fd3824a40cef0ae2d2541/android/src/main/java/com/parsempo/ImageCropTools/ImageCropViewManager.kt#L31

going in to here https://github.com/ArthurHub/Android-Image-Cropper/blob/2a4a425668bfff1329dd5bfb1b80b0829bb4cc67/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImageView.java#L178

Then the id for that View is apparently indigestible: https://github.com/hhunaid/react-native-image-crop-tools/blob/5c3ab05dca20cefe542fd3824a40cef0ae2d2541/android/src/main/java/com/parsempo/ImageCropTools/ImageCropViewManager.kt#L39

So, still seems to be the same case of "JSIModule is making an assumption about View ids that is no longer valid" and I believe we are still waiting for @mdvacca to report any findings as promised above

kelset pushed a commit that referenced this issue May 12, 2021
…UIManager registered

Summary:
This diff refactors the UIManagerHelper.getUIManager method to return null when there's no UIManager registered for the uiManagerType received as a parameter.

This is necessary to workaround: #31245

changelog: [changed] UIManagerHelper.getUIManager now returns null when there's no UIManager registered for the uiManagerType received as a parameter

Reviewed By: fkgozali

Differential Revision: D28242592

fbshipit-source-id: c3a4979bcf6e547d0f0060737e41bbf19860a984
@mikehardy
Copy link
Contributor

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

danilobuerger pushed a commit to feastr/react-native that referenced this issue May 13, 2021
…UIManager registered

Summary:
This diff refactors the UIManagerHelper.getUIManager method to return null when there's no UIManager registered for the uiManagerType received as a parameter.

This is necessary to workaround: facebook#31245

changelog: [changed] UIManagerHelper.getUIManager now returns null when there's no UIManager registered for the uiManagerType received as a parameter

Reviewed By: fkgozali

Differential Revision: D28242592

fbshipit-source-id: c3a4979bcf6e547d0f0060737e41bbf19860a984
@daothithuong
Copy link

@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 -> satya164/react-native-tab-view#1157

I fixed it this way

savv pushed a commit to savv/react-native-savv that referenced this issue May 20, 2021
…UIManager registered

Summary:
This diff refactors the UIManagerHelper.getUIManager method to return null when there's no UIManager registered for the uiManagerType received as a parameter.

This is necessary to workaround: facebook#31245

changelog: [changed] UIManagerHelper.getUIManager now returns null when there's no UIManager registered for the uiManagerType received as a parameter

Reviewed By: fkgozali

Differential Revision: D28242592

fbshipit-source-id: c3a4979bcf6e547d0f0060737e41bbf19860a984
kelset pushed a commit that referenced this issue May 26, 2021
…UIManager registered

Summary:
This diff refactors the UIManagerHelper.getUIManager method to return null when there's no UIManager registered for the uiManagerType received as a parameter.

This is necessary to workaround: #31245

changelog: [changed] UIManagerHelper.getUIManager now returns null when there's no UIManager registered for the uiManagerType received as a parameter

Reviewed By: fkgozali

Differential Revision: D28242592

fbshipit-source-id: c3a4979bcf6e547d0f0060737e41bbf19860a984
@ebaynaud
Copy link

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

@mikehardy do you know if using master or 64-stable in package.json instead of 0.64.1 could be a workaround? When is this aar pre-built?

@mikehardy
Copy link
Contributor

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

@kirx76
Copy link

kirx76 commented Jun 3, 2021

some solutions? i have a simple modal with useState[true/false] and button to open the modal. when i click on this button like 4-5 times before modal is showing, i have that crash. it may crash after 2-7 repeats. and error are same...

@mikehardy
Copy link
Contributor

@kirx76 the solutions are all here. Use react-native 0.63.x or wait for 0.64.2 and/or 0.65 or build from source with the patch.

@escobar5
Copy link

escobar5 commented Jun 4, 2021

@mikehardy could you tell me if the fix is in v0.64.2? I don't see it referenced in the change log

@ebaynaud
Copy link

ebaynaud commented Jun 4, 2021 via email

@mikehardy
Copy link
Contributor

It's almost the only thing in the changelog?

@escobar5
Copy link

escobar5 commented Jun 4, 2021

sorry, I must have missed it, thanks

@tamago3keran
Copy link

I tried to build it in the following way, but it did not improve.

  1. npm install ( also watchman )
  2. apply a patch ( ref. https://github.com/BulbEnergy/react-native/commit/88174742327ae8c730c7eec9d333706882c1ac7a )
diff `node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerHelper.java`
     CatalystInstance catalystInstance = context.getCatalystInstance();
-    return uiManagerType == FABRIC
-        ? (UIManager) catalystInstance.getJSIModule(JSIModuleType.UIManager)
-        : catalystInstance.getNativeModule(UIManagerModule.class);
+    try {
+      return uiManagerType == FABRIC
+          ? (UIManager) catalystInstance.getJSIModule(JSIModuleType.UIManager)
+          : catalystInstance.getNativeModule(UIManagerModule.class);
+    } catch (IllegalArgumentException ex) {
+      // TODO T67518514 Clean this up once we migrate everything over to bridgeless mode
+      ReactSoftException.logSoftException(
+          "UIManagerHelper",
+          new ReactNoCrashSoftException(
+              "Cannot get UIManager for UIManagerType: " + uiManagerType));
+      return catalystInstance.getNativeModule(UIManagerModule.class);
+    }
  1. run npx react-native start and run-android

Is there some solutions to this problem?

@Bardiamist
Copy link
Contributor Author

Fixed in 0.64.2

@tamago3keran
Copy link

tamago3keran commented Jun 6, 2021

@Bardiamist Thank you so much.

@pallaviMN
Copy link

how to update jar file in the location - C:\Users\pallavi.mn\Documents\ROCInsights\node_modules\react-native\android\com\facebook\react\react-native\0.64.0 - i want to update UIManager class
image

@mikehardy
Copy link
Contributor

If you are updating jars or specific classes I must say you are completely on your own and need to have the sufficient skill / experience to do so, as it is not recommended and you will be on your own to fix any problems.
If you are already using 0.64.0, why not update to 0.64.2 where it is already fixed? The update is trivial

There is literally nothing necessary other than changing the dependency, vastly simpler than any sort of back-port to 0.64.0

https://react-native-community.github.io/upgrade-helper/?from=0.64.0&to=0.64.2

@pallaviMN
Copy link

pallaviMN commented Jun 20, 2021

@mikehardy , Thanks a lot, But i getting an error
image
Can i just update the version in package.json and do npm install?

@mikehardy
Copy link
Contributor

You do not need to do the upgrade no, you can just update the version in package.json and re-install yes

@pallaviMN
Copy link

@mikehardy, it worked, Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs: Triage 🔍 Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests