Selecting the placeholder item causes a crash/duplicate placeholder items
See original GitHub issueDescribe 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
- Select a non-placeholder item
- Select the placeholder item
- See error:
TypeError: TypeError: Cannot read property 'label' of undefined
.
- Add an item object with a value of
null
to theitems
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'
}
]
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Can’t repro, closing thanks.
I faced with the same problem, I downgraded react native version to 0.63.0, it resolved the problem