react-native-dropdown-picker icon indicating copy to clipboard operation
react-native-dropdown-picker copied to clipboard

Category Parent sorts items reversed

Open azwinlam opened this issue 3 years ago • 6 comments

NOTE The items don't need to be sorted, This will be done automatically.

However, this sort is reversed. My items are sorted from Z-A.

Anyone figure out the code to reverse this? using the npm installation if possible.

azwinlam avatar Aug 04 '21 14:08 azwinlam

Not sure exactly what the code is doing here but the results of a grep -ri sort src/ results in this chunk of code as the only place in the entire codebase that is using the string 'sort'

https://github.com/hossein-zare/react-native-dropdown-picker/blob/51e08081a6cde261667fabe3f980300a3a888e8d/src/components/Picker.js#L309-L365

If you have never seen https://github.com/ds300/patch-package - you should check it out. It means that you can just reach right into node_modules, hack around (adding debug statements or whatever to trace the code and understand it, solve your problem etc) and your work may be preserved across npm/yarn installs and in source control for your colleagues.

If you determine there is some issue here patch-package also helps you file a PR so it is then fixed in the next official version

mikehardy avatar Aug 04 '21 14:08 mikehardy

Yes, I am having the same issue. And with a little testing, have discovered that the sort simply reverses the order, it does not sort anything...

jbrucemarr avatar Jan 18 '22 19:01 jbrucemarr

Items are still sorted from Z-A

azwinlam avatar May 12 '22 06:05 azwinlam

Have you found a work around?

alsvader avatar May 23 '22 04:05 alsvader

This issue still seems to occur. I'm going to go about a temporary solution and reverse my input list.

zaiisao avatar Sep 06 '22 05:09 zaiisao

This only seems to affect child items, not the parent or items with no parent. A simple arr.reverse() before building out the child schema solves the issue and can be easily removed in the future.

Viaboom avatar Sep 07 '22 18:09 Viaboom