Home » Android » React-native <Picker /> on android crashes app after render

React-native <Picker /> on android crashes app after render

Posted by: admin May 14, 2020 Leave a comment

Questions:

Here the component:

<Picker
  selectedValue={'item1'}
  onValueChange={(value) => onDismiss(value)}>
    <Picker.Item key={'item1'} label={'item1'} value={'item1'} />
    <Picker.Item key={'item2'} label={'item2'} value={'item2'} />
    <Picker.Item key={'item3'} label={'item3'} value={'item3'} />
</Picker>

nothing unusual, no additional libraries just RN^0.29.0
Works absolutely fine in debug mode, but if it being rendered in production, app crashes right after render (i see the rendered scene for a moment and then fatal crash).

I’m sure that was not happening some time ago, but rolling back doesn’t help. I do not know what have cause this issue or when exactly it appeared.

I’ve tried to do cd android && ./gradlew clean, i’ve tried to remove some properties etc – nothing helps.

However, while i was building-rebuilding prod app (react-native run-android --variant=release) about 40 times, it actually worked few times: render ended up succesfully, then i’m leaving the scene with picker, and when i’m trying to get there again (render Picker again, it starts crashing). No idea what it is.
As you see, i’ve even hardcoded items there, but it doesn’t help.

Any guesses?

How to&Answers: