lawnstarter / react-native-picker-select

🔽 A Picker component for React Native which emulates the native <select> interfaces for iOS and Android
https://npmjs.com/package/react-native-picker-select
MIT License
1.74k stars 497 forks source link

Crashes in production only - Android and iOS #487

Open RGDEV2022 opened 1 year ago

RGDEV2022 commented 1 year ago

Describe the bug
Works in the Expo Go simulator for both Android and iOS. But crashes in production for both. On iOS, it crashes when you try to open the picker. On Android it crashes before opening a component that has the picker import.

To Reproduce

  1. Use the basic setup guide to setup a test picker.
  2. Open the component in a production version of the application.

Expected behavior
Should behave the same as when tested inside the simulator with no crashes.

Screenshots
n/a.

Additional details

Reproduction and/or code sample

<RNPickerSelect
      value={props.value}
      placeholder={props.placeholder}
      textInputProps={{ multiline: props.multiline }}
      pickerProps={{ numberOfLines: 10 }}
      useNativeAndroidPickerStyle={false}
      style={{
        inputIOS: {
          fontSize: 14,
          minHeight: 40,
          paddingLeft: 10,
          paddingRight: 10,
          borderRadius: 4,
          backgroundColor: 'white',
          shadowColor: '#000',
          shadowOffset: { width: 0, height: 1 },
          shadowOpacity: 0.1,
          shadowRadius: 5,
          elevation: 5
        },
        inputAndroid: {
          fontSize: 14,
          minHeight: 40,
          paddingLeft: 10,
          paddingRight: 10,
          borderRadius: 4,
          backgroundColor: 'white',
          shadowColor: '#000',
          shadowOffset: { width: 0, height: 1 },
          shadowOpacity: 0.1,
          shadowRadius: 5,
          elevation: 5
        }
      }}
      onValueChange={(value) => props.setValue(value)}
      items={props.items}
    />
RGDEV2022 commented 1 year ago

Here's an issue I saw describing the same stack trace I receive for the error https://stackoverflow.com/questions/65741312/react-native-project-crashes-only-on-ios-release-build-when-using-picker

YoannBuzenet commented 1 year ago

Having the same problem here, everything works well on Expo and xCode. On production it crashes when the picker is opened.

DId you find a way ?

cjohnson318 commented 1 year ago

Can confirm that this SO resolution does not work for this problem. If anyone has pointers on how to fix this, that would be great.

SokolovRU commented 1 year ago

Hello everyone. Today I faced this problem. Initially, the array that I passed to the object was empty and I filled it with a request to the server. On emulators and launching through expo - everything is cool! But when I did the build, the application crashed.

By poking, I realized that it was necessary to pass an initially non-empty array, filled it with local data and then updated it. The component started working.

If this is relevant to you, please describe it.

veyselkoru commented 1 year ago

On Expo it causes this error mentioned below "Invariant Violation: requireNativeComponent: "RNCAndroidDialogPicker" was not found in the UIManager."

andrewjmac commented 1 year ago

Did anyone manage to solve this? Thanks

veyselkoru commented 1 year ago

@andrewjmac Remove react-native-picker-select and use only @react-native-picker/picker it's not working well together. I gave up to use it and I wrote my own picker

andrewjmac commented 1 year ago

@veyselkoru Thanks for the reply, I've done just that!

20chad16 commented 1 year ago

Any fix for this?

diegodsp commented 1 year ago

Same problema here, the app crashes only on production at the both iOS and Android systems!

amanmanhas commented 1 year ago

Facing same problem, any fix?

amanmanhas commented 1 year ago

@20chad16 @diegodsp I solved this problem by passing placeholder={ label: '', value: '' } like this. I am getting error because I am passing null in placeholder label placeholder={ label: null, value: null, }

I don't know why I am not getting this error in development May be this is your problem

andrewjmac commented 1 year ago

@amanmanhas Did this solve it in the production build? That fix works in development but didn't in production for me.

20chad16 commented 1 year ago

@andrewjmac @amanmanhas

I just added a placeholder and am receiving the same error on an iPhone with testflight

amanmanhas commented 1 year ago

@amanmanhas Did this solve it in the production build? That fix works in development but didn't in production for me.

Yes, it's fixed for me in production also

andrewjmac commented 1 year ago

Out of curiosity what version of android have you tested your production on? I think it was fine on older versions but kept breaking for me on new ones.

Thanks, Andy

On 22 Jan 2023, at 04:01, amanmanhas @.***> wrote:



@amanmanhashttps://github.com/amanmanhas Did this solve it in the production build? That fix works in development but didn't in production for me.

Yes, it's fixed for me in production also

— Reply to this email directly, view it on GitHubhttps://github.com/lawnstarter/react-native-picker-select/issues/487#issuecomment-1399398442, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACE6XWPDDM7EVJVWK3QR5LLWTSWI5ANCNFSM6AAAAAAQ2SBPFE. You are receiving this because you were mentioned.Message ID: @.***>

jimmy123A commented 1 year ago

It appears that this package internally uses @react-native-community/picker. I solved this after installing this lib.

It works in Expo Go because this library is supported by default, but the pod wasn't natively linked this is why the app was crashing.

moak commented 1 year ago

It appears that this package internally uses @react-native-community/picker. I solved this after installing this lib.

It works in Expo Go because this library is supported by default, but the pod wasn't natively linked this is why the app was crashing.

crashes for me even with @react-native-picker/picker installed 🤔 , which version do you use of the renamed library @react-native-picker/picker ?

jimmy123A commented 1 year ago

@moak I'm using the latest version. Did you make sure to rebuild the native app after installing the lib?

Ashwini8088 commented 1 year ago

did anyone found solution?

GeroWalther commented 1 year ago

I also have the same issue! It works on Expo Go but not in production. empty string instead of null in placeholder did also not work for me. should I get @react-native-community/picker ? Or can you guys recommend another library?

felipesilva-plank commented 9 months ago

it worked for me on IOS after installing @react-native-picker/picker, but still crashes on android. I am using expo 0.10.13 and eas cli for build.

waleed2000x commented 4 months ago

antdesign for RN works all fine!