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.

Selecting the placeholder item causes a crash/duplicate placeholder items

See original GitHub issue

Describe the bug
The app crashes if you select the placeholder item after selecting another item.

This occurs regardless of whether a placeholder is provided.

Adding an item object with value: null results in duplicate placeholder items appearing in the dropdown.

To Reproduce

Crash

  1. Select a non-placeholder item
  2. Select the placeholder item
  3. See error: TypeError: TypeError: Cannot read property 'label' of undefined.

  1. Add an item object with a value of null to the items array.

Expected behaviour
The placeholder item should just be selected. There should only be one placeholder item.

Screenshots
See below.

Smartphone (please complete the following information):

  • Device: Samsung S6
  • OS: Android 7.0
  • react-native-picker-select version: 6.0.0
  • react-native version: 0.55
  • react version: 16.3.1

Reproduction and/or code sample

Crash

      const items = [
           {
              label: 'Packed By Owner',
              value: 'packed_owner'
           }
       ]
      <RNPickerSelect
        items={items}
        onValueChange={onChange}
        value={value}
      />

Duplicate placeholders

const items = [
           {
               label: 'Select items...',
               value: null
           },
           {
              label: 'Packed By Owner',
              value: 'packed_owner'
           }
       ]

screenshot_20190225-162208

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ylaccommented, Mar 5, 2019

Can’t repro, closing thanks.

0reactions
ArturCherkanovcommented, May 4, 2021

I faced with the same problem, I downgraded react native version to 0.63.0, it resolved the problem

Read more comments on GitHub >

github_iconTop Results From Across the Web

UITextField crashes app if keyboard is set to specific language ...
From exception, it looks like it is crashing because of an empty placeholder value. Try adding some text value to Placeholder Text.
Read more >
Placeholder content moving between layouts when switching ...
A slide converted from a layout with few objects to a duplicate layout with many objects fills in the few objects correctly, based...
Read more >
4.16 updated project crashes - Skel_ & LinkerPlaceholder
I have a project in 4.15 that is stable but upgrading it to 4.16 it crashes so much. Play in editor, compile, migrate...
Read more >
Why PowerPoint crashes and how to prevent it - BrightCarbon
If you add in a smaller image as a placeholder you can even animate it. At the last minute all you have to...
Read more >
PowerPoint unexpectedly puts content into placeholders
Remove the checkmark next to "Automatic layout for inserted objects" (it's at the bottom of the list); Note that you can also disable...
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