picker: Android Fatal Native Exception

When attempting to open the picker on Android, I get:

Fatal native exception 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:2609)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2698)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2698)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2698)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2698)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2698)
	at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:465)
	at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1849)
	at android.app.Activity.dispatchTouchEvent(Activity.java:3993)
	at com.gasbuddy.MainActivity.dispatchTouchEvent(MainActivity.java:43)
	at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69)
	at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:423)
	at android.view.View.dispatchPointerEvent(View.java:13674)
	at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5482)
	at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5285)
	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4788)
	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4841)
	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4807)
	at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4947)
	at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4815)
	at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5004)
	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4788)
	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4841)
	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4807)
	at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4815)
	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4788)
	at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7505)
	at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7474)
	at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7435)
	at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7630)
	at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:188)
	at android.os.MessageQueue.nativePollOnce(Native Method)
	at android.os.MessageQueue.next(MessageQueue.java:336)
	at android.os.Looper.loop(Looper.java:174)
	at android.app.ActivityThread.main(ActivityThread.java:7356)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

React: 17.0.1 React Native: 0.64.0-rc4 React Native Picker: 1.9.11

About this issue

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

Most upvoted comments

Are you using this with @react-navigation? I’ve just had this same issue since upgrading to 0.64 and found that this problem occurred on screens where I had enabled gestures (gestureEnabled: true in screenOptions).

After lots of hours facing this issue our team discovered that in our case this package “react-native-snap-carousel” was causing the issue, I am not sure yet why but we deleted the carousel component and pickers of all the screens worked again. The really weird thing is that we used carousel package on different screens than pickers but when we go to any carousel view and return to picker view it fails.

they are working on a fix.

@mbouxin Do you happen to have an issue we can track on this?

https://github.com/facebook/react-native/issues/31245

I am not using any kind of carousel, swipe, or moving component to affect or interfere with the picker itself. Picker’s inside a View and that View inside a stack.

“react”: “16.13.1”, “react-native”: “0.64.0”, “@react-native-picker/picker”: “^1.9.8”, “@react-navigation/bottom-tabs”: “^5.11.2”, “@react-navigation/material-top-tabs”: “^5.3.10”, “@react-navigation/native”: “^5.8.10”, “@react-navigation/stack”: “^5.12.8”

@sylvainbaronnet react-native-snap-carousel is causing that bug on the repository it has not been updated since May 2020, so we decided to use react-native-swiper-flatlist and react-native-fast-image instead our app is running again and pickers are working as is expected. Maybe for others facing this bug, the problem is in another depreciated package.

This was a bug on React Native’s side, should be fixed on React Native 0.64.2

@kevinvangelder this is close-able react-native 0.64.2 is out with the fix for this included

Here is the commit that will be cherry picked for .64.2 facebook/react-native@b0e8c1e And thats the issue for the discussion https://github.com/react-native-community/releases/issues/224

Hi all the problem is from react-native and they are working on a fix. Basically their problem is because they try to use the id of the inflated picker while it is not set.

If it is of any use to someone, I temporarily fixed the problem on my project by making the following modifications

In TextViewImpl.java and CheckedTextViewImpl.java

4a5
> import android.view.View;
23a25,33
>     private View pickerView;
>     public int getId() {
>         return pickerView.getId();
>     }
> 
>     public void setPickerView(View pickerView) {
>         this.pickerView = pickerView;
>     }
> 

In ReactPickerManager.java

188a189,194
>       if (convertView instanceof TextViewImpl) {
>         ((TextViewImpl) convertView).setPickerView(parent);
>       } else if (convertView instanceof CheckedTextViewImpl) {
>         ((CheckedTextViewImpl) convertView).setPickerView(parent);
>       }
> 

It definitely is a bypass that should not be included in the sources but it solves the issue without changing used packages

I have the same problem with my project. Also, I use react-native-snap-carousel. I was trying to delete react-native-snap-carousel but it did not give a result.
So I’m not sure about it’s related.

I also use react-native-snap-carousel in the app that has this issue, on another one where we don’t use that lib, the picker doesn’t crash on Android.

(gestureEnabled: true in screenOptions).

You save me 👍

@kevinvangelder I recommend you to keep it opens because mine is on another package