picker icon indicating copy to clipboard operation
picker copied to clipboard

Arrange Picker Items Alphabetically

Open nahidmbstu opened this issue 4 years ago • 1 comments

How can i Arrange Picker Items Alphabetically ?

nahidmbstu avatar Oct 10 '21 11:10 nahidmbstu

@nahidmbstu

You can have something like this to sort items alphabetically before rendering them to picker

const SortedPicker = () => {
const unsortedList = [{label:'test1',value:1},{label:'test3', value:3}.,{label:'test2', value:2}]
const arrangedItems = [...unsortedList.sort((a,b)=>a.label > b.label)]

return (
	<Picker>
		{arrangedItems.map((item)=><Picker.item {...item} />
    </Picker>
)

}

Naturalclar avatar Oct 15 '21 02:10 Naturalclar