hossein-zare / react-native-dropdown-picker

A single / multiple, categorizable, customizable, localizable and searchable item picker (drop-down) component for react native which supports both Android & iOS.
https://hossein-zare.github.io/react-native-dropdown-picker-website/
MIT License
970 stars 294 forks source link

BadgeDotColors aren't deterministic #650

Open hassant4 opened 1 year ago

hassant4 commented 1 year ago

Seems like they change quite randomly actually, for example if you pass three possible items, and select all three - two of them may be the same badge dot color despite passing through three badgeDotColors.

Was this the intended functionality? Ideally we should be able to define the individual badge dot color for each item in items

hossein-zare commented 1 year ago

Was this the intended functionality?

Not randomly, Based on ASCII Code.

Ideally we should be able to define the individual badge dot color for each item in items

You can add the feature and submit a PR.

yaylinda commented 1 year ago

Yeah, I am also trying to use the badgeDotColors and find it the ASCII code mapping to be not very intuitive.

For my use-case, each item's value is a UUID string. Adding together the ascii code values for each character in the item.value string is kind of meaningless, and could cause collisions.

Maybe the badgeDotColors prop could be a Map<string, string>, mapping item value to a hex code. Or the prop could simply be a callback function that the user could define and pass to it.

bahaaTuffaha commented 9 months ago

I tried to modify the code to just view colors same order as the array but its not working as it should be 🥲... have you guys found any solution to this?