question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android crash on press select

See original GitHub issue

Describe the bug
When i click on the select on Android the application crash.

This is the log from the Android Studio console:

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.wtaapp, PID: 4475
    com.facebook.react.bridge.NoSuchKeyException: label
        at com.facebook.react.bridge.ReadableNativeMap.getNullableValue(ReadableNativeMap.java:137)
        at com.facebook.react.bridge.ReadableNativeMap.getNullableValue(ReadableNativeMap.java:141)
        at com.facebook.react.bridge.ReadableNativeMap.getString(ReadableNativeMap.java:192)
        at com.facebook.react.views.picker.ReactPickerManager$ReactPickerAdapter.getView(ReactPickerManager.java:126)
        at com.facebook.react.views.picker.ReactPickerManager$ReactPickerAdapter.getDropDownView(ReactPickerManager.java:112)
        at android.widget.Spinner$DropDownAdapter.getDropDownView(Spinner.java:1022)
        at android.widget.Spinner$DropDownAdapter.getView(Spinner.java:1018)
        at android.widget.Spinner.measureContentWidth(Spinner.java:860)
        at android.widget.Spinner$DropdownPopup.computeContentWidth(Spinner.java:1255)
        at android.widget.Spinner$DropdownPopup.show(Spinner.java:1281)
        at android.widget.Spinner.performClick(Spinner.java:784)
        at android.support.v7.widget.AppCompatSpinner.performClick(AppCompatSpinner.java:443)
        at android.view.View$PerformClick.run(View.java:24931)
        at android.os.Handler.handleCallback(Handler.java:808)
        at android.os.Handler.dispatchMessage(Handler.java:101)
        at android.os.Looper.loop(Looper.java:166)
        at android.app.ActivityThread.main(ActivityThread.java:7523)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)

To Reproduce
This is my configuration:

render() {
    let styleShadow = {}
    if (this.props.shadow) {
      styleShadow = {
        shadowColor: config.colors.black,
        shadowOffset: { width: 0, height: 3 },
        shadowOpacity: 0.15
      }
    }

    const style = [{
      paddingLeft: this.props.icon ? 40 : 15,
      paddingRight: 15,
      paddingTop: 10,
      paddingBottom: 10,
      backgroundColor: config.colors.white,
      borderColor: this.state.borderColor,
      borderWidth: 1,
      fontFamily: config.fonts.poppins,
      borderRadius: 10,
    }, styleShadow]

    return (
      <View style={[{
        marginBottom: 15,
        position: 'relative'
      }]}>
        <PickerSelect
          style={{
            inputAndroid: style,
            inputIOS: style,
            done: { color: config.colors.red },
            placeholder: { color: config.colors.black }
          }}
          items={this.props.items}
          onValueChange={this.props.onChangeText}
          placeholder={this.props.placeholder}
          value={this.props.value}
          useNativeAndroidPickerStyle={false}
          doneText="Confirm"
        />
      </View>
    )
  }

Smartphone:

  • Device: Huawei P8 lite 2017
  • OS: Android 8.0.0
  • react-native-picker-select version: 6.2.0
  • react-native version: 0.59.5
  • react version: 16.8.3

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
gregogalantecommented, Jul 23, 2019

@gregogalante, noticed you closed this issue. Did you find a resolution to this? We’re getting the exact same error whenever we pass an empty array of items to the picker. Same details / env as you.

Right now we’re working around it by populating optimistically and then loading in the data from the API so the items are never empty.

My problem was related to the placeholder props. I pass a string as props insthead of an object with same keys like an option object.

3reactions
kaylakantolacommented, Mar 1, 2021

I was also experiencing the same crash. Similar solution to above. I was already passing in a placeholder object like so -

placeholder={{label: someLabel, value: someValue}}

BUT, I discovered someLabel and someValue were undefined. So I had to ensure that those values were getting thru, and then it worked.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android studio app crashes on the button click - Stack Overflow
The product form is shown every time when I click on the Add new Product button. But I can't select a product in...
Read more >
Crashes - Android Developers
An Android app crashes whenever there's an unexpected exit caused by an unhandled exception or signal. An app that is written using Java...
Read more >
Why do my apps keep crashing on Android, How to fix it
To do this, go to Settings -> Apps and select the app that keeps crashing. Tap on the app's name and then tap...
Read more >
Long pressing on text to select it instantly crashes the app.
If I long press on any text in the app to start the selection process (highlight for copy/paste), the app instantly crashes.
Read more >
Troubleshooting Mobile - Android - Teamfight Tactics Support
You're settling in on the couch to play on your phone, ready to climb the ranks and master some team comps when, suddenly,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found