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

Some items turn gray when scrolling #445

Closed Martomate closed 10 months ago

Martomate commented 3 years ago

Describe the bug
When there are many items in the dropdown some items turn gray as if they are selected. This happens when it's possible to scroll and the gray items are the ones who appear when you scroll. Items can even turn back to black again after scrolling up and down some more.

This is the same issue as #433.

To Reproduce
Steps to reproduce the behavior:

  1. Open the dropdown
  2. Scroll down
  3. Some of the now visible items might be gray
  4. Scroll up
  5. Some of the top items might now have turned gray

Expected behavior
Only the selected item should be gray

Screenshots
See #433 for a screen shot

Additional details

Reproduction and/or code sample

const options = [...Array(20).keys()].map(m => ({ value: m, label: `${m}` }));
<Select items={options} onValueChange={console.log} />
Martomate commented 3 years ago

Apparently this problem could be fixed by simply adding a placeholder to the Select. The bug still exists of course, but this is a viable solution for us.

basitmir commented 2 years ago

any solution regarding this @Martomate

Martomate commented 2 years ago

The workaround that worked for us was to add placeholder={{ label: strings.select, value: null }} to the Select tag (which was imported using import Select from 'react-native-picker-select'). We haven't looked more into it since my collegue found this workaround, so I don't have any new information to give. There is no new version of this library so it's probably not fixed yet.

basitmir commented 2 years ago

The workaround that worked for us was to add placeholder={{ label: strings.select, value: null }} to the Select tag (which was imported using import Select from 'react-native-picker-select'). We haven't looked more into it since my collegue found this workaround, so I don't have any new information to give. There is no new version of this library so it's probably not fixed yet.

Thank you for the reply @Martomate yes I think this is the workaround for it i.e by not setting the color for placeholder

lfkwtz commented 10 months ago

dupe of #433 and #169