react-native-picker / picker

Picker is a cross-platform UI component for selecting an item from a list of options.
MIT License
1.52k stars 289 forks source link

Touching the middle part of picker (not Icon on the right) crashes the app #237

Closed khofesh closed 3 years ago

khofesh commented 3 years ago

"react": "17.0.1", "react-native": "0.64.0", "@react-native-picker/picker": "^1.12.0",

https://user-images.githubusercontent.com/31060467/113234262-2283a000-92cb-11eb-83f6-9bad53589685.mp4

the error details look the same to this issue (https://github.com/react-native-picker/picker/issues/220)

GaylordP commented 3 years ago

Hello,

I have been facing the same issue since 0.64.

It would be interesting to have a reliable answer on this subject; various users mention solutions but no "official" answer :/

milule commented 3 years ago

I have a same issue too when upgrage react native 0.64

Naturalclar commented 3 years ago

Seems like the issue happens when the picker is combined with other native modules on version 0.64 https://github.com/facebook/react-native/issues/31245

Using picker on a new React Native project (v0.64) works fine I'll continue to investigate in the issue

AyyanNiazi commented 3 years ago

I have same issue; @react-native-picker/picker ^1.14.0 react-native 0.64.0

doesn't matter where I click it cause to crash

mahmoud2802 commented 3 years ago

hello I have same issue

SaeedBoroo commented 3 years ago

I have same issue; @react-native-picker/picker ^1.14.0 react-native 0.64.0

when I click Icon picker it works. but when I click another space crashed.

pdpd123 commented 3 years ago

Facing the exact same issue as well

AlphaJuliettOmega commented 3 years ago

:<

Just upgraded to .64 on one branch while a developer added this library on another branch now we have an app crash on a new feature - mega disappointing

Left my comment on the wrong issue, one of these is a duplicate: https://github.com/react-native-picker/picker/issues/221

AlphaJuliettOmega commented 3 years ago

Hello,

I have been facing the same issue since 0.64.

It would be interesting to have a reliable answer on this subject; various users mention solutions but no "official" answer :/

Would you be able to share any links or insight on possible solutions?

khofesh commented 3 years ago

Seems like the issue happens when the picker is combined with other native modules on version 0.64 facebook/react-native#31245

Using picker on a new React Native project (v0.64) works fine I'll continue to investigate in the issue

You're right. My picker component works on RN 0.64. I'm figuring out which component when combined with the picker crashes the app.

khofesh commented 3 years ago

So i managed to get the error

###### without gesture handler
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:2646)
 at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3141)
 at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2746)
 at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3141)
 at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2746)
 at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3141)
 at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2746)
 at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3141)
 at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2746)
 at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3141)
 at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2746)
 at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:498)
 at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1853)
 at android.app.Activity.dispatchTouchEvent(Activity.java:4059)
 at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69)
 at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:456)
 at android.view.View.dispatchPointerEvent(View.java:13782)
 at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5816)
 at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5607)
 at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5104)
 at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5157)
 at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5123)
 at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5263)
 at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5131)
 at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5320)
 at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5104)
 at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5157)
 at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5123)
 at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5131)
 at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5104)
 at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7940)
 at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7909)
 at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7860)
 at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:8086)
 at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:250)
 at android.os.MessageQueue.nativePollOnce(Native Method)
 at android.os.MessageQueue.next(MessageQueue.java:336)
 at android.os.Looper.loop(Looper.java:181)
 at android.app.ActivityThread.main(ActivityThread.java:7551)
 at java.lang.reflect.Method.invoke(Native Method)
 at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:995)
AlphaJuliettOmega commented 3 years ago

The absolutely bizzare thing for me, was that I removed react-native-snap-carousel and implemented my carousel with a different library, some swiper and the error disappeared, just noting here in case it helps anyone.

For whatever reason, the horizontal flatlist or some kind of handler in the other carousel library, caused picker to crash when you click on the label, not the arrow - if you visit the view with the carousel before the view with the picker.

khofesh commented 3 years ago

@AlphaJuliettOmega I tried, no luck. It still crashes. We disable the picker component until we figure this out.

HishamMubarak commented 3 years ago

The absolutely bizzare thing for me, was that I removed react-native-snap-carousel and implemented my carousel with a different library, some swiper and the error disappeared, just noting here in case it helps anyone.

For whatever reason, the horizontal flatlist or some kind of handler in the other carousel library, caused picker to crash when you click on the label, not the arrow - if you visit the view with the carousel before the view with the picker.

We used the same react-native-snap-carousel package. Commented out wherever we used that package and deleted that package from package.json and tried, Picker is now working without any crash. Switched to react-native-swiper-flatlist and it is working fine alongside react-native-picker

onmotion commented 3 years ago

I assume it's related to https://github.com/henninghall/react-native-date-picker/issues/301

java666p commented 3 years ago

Hey are using react-native-tab-view ? For me the same issue started when I upgraded to react-native-tab-view from 2.16.0 to 3.0.0 in my react-native 0.64 project. The picker was crashing when I picked the middle part but when I press only the arrow it works. So I resolved it my case by downgrading back react-native-tab-view to 2.16.0. I think the problem had to do with react-native-tab-view using react-native-pager-view in their latest update.

jretamalc commented 3 years ago

Same problem here, is there any solution?

pdpd123 commented 3 years ago

I solved it back not upgrading to 0.6 RN. Just curious, why do you have to upgrade from 0.5 to 0.6? I would suggest staying with 0.5.x a bit longer if you can

jretamalc @.***>于2021年4月19日 周一下午10:31写道:

Same problem here, is there any solution?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/react-native-picker/picker/issues/237#issuecomment-822513038, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASQNW4UJDPS6TGIHAG4WN3TTJQ5D3ANCNFSM42GBB37Q .

khofesh commented 3 years ago

I solved it back not upgrading to 0.6 RN. Just curious, why do you have to upgrade from 0.5 to 0.6? I would suggest staying with 0.5.x a bit longer if you can jretamalc @.***>于2021年4月19日 周一下午10:31写道: Same problem here, is there any solution? — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#237 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASQNW4UJDPS6TGIHAG4WN3TTJQ5D3ANCNFSM42GBB37Q .

Everytime new version of RN is released, we make new branch, then upgrade RN, and list which works and which doesn't.

boybeo68 commented 3 years ago

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

onmotion commented 3 years ago

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

Yes, but not turning on gestureEnabled param manually

Slals commented 3 years ago

Same issue. I think it is not related to react-navigation. When I use the Picker inside a screen it works as expected. But when used inside a modal with Modalize (Bottom modal) there is something that makes the app crash when tapping in the picker. The weird part is that tapping in the bottom arrow in the Picker does not crash the app. It only crashes on real device.

Im on RN 0.64.0 using @react-native-picker/picker 1.15.0

Tried to disable all gesture features on the modal does not avoid the crash.

I dont find real insight in logcat.

AlphaJuliettOmega commented 3 years ago

@Slals I don't know why, but if you read comments above carefully

react-native-snap-carousel and a certain version of react-native-tab-view cause the picker to hard crash the app with no error message.

I'm using RNN so it's definitely not react-navigation (I don't have react-navigation in my project where I also had the crash.

I'm hoping it's an obscure peer dependency api update that those two crash causing culprits have in common that the picker just needs to be able to sidestep.

lehaBay commented 3 years ago

I have the the same issue only when picker on same screens with react-native-pager-view. I'm using: "react-native": "0.64.0" "@react-native-picker/picker": "1.15.0", "react-native-pager-view": "^5.1.5",

LinusdP commented 3 years ago

Same issue. I think it is not related to react-navigation. When I use the Picker inside a screen it works as expected. But when used inside a modal with Modalize (Bottom modal) there is something that makes the app crash when tapping in the picker. The weird part is that tapping in the bottom arrow in the Picker does not crash the app. It only crashes on real device.

Im on RN 0.64.0 using @react-native-picker/picker 1.15.0

Tried to disable all gesture features on the modal does not avoid the crash.

I dont find real insight in logcat.

I have the same issue in a modal. Pressing the picker on the "text"-part causes the crash but. It worls fine when using the using the icon. It also works fine with Pickers in a normal screen.

I'm on RN 0.64.1.

khofesh commented 3 years ago

I think this needs to be closed.. we'll wait RN-0.65 https://github.com/facebook/react-native/issues/31245#issuecomment-834629217

https://github.com/facebook/react-native/commit/c317f558f7e5549dffeda1950613ff9844f409e9

arnaudambro commented 3 years ago

I don't think this issue should be closed.

I also don't think @drneyx deserves all this thumbs down, because for now he is right : that's the only solution !

And finally, I really think this should be documented in the README: don't use RN 0.64 if you want to use react-native-picker/picker

Dassine commented 3 years ago

Here is the solution that worked for me:

https://github.com/react-native-picker/picker/issues/225 https://github.com/lawnstarter/react-native-picker-select/issues/442

suma1892 commented 3 years ago

just add enabled={false} and use ref to call Picker

Screen Shot 2021-07-16 at 19 51 15
on29-dev commented 2 years ago

The only way to handle this bug is using ref and method of ref? Then, why does this props enabled exist? It would be false always.