Closed mfernandezgarcia closed 1 year ago
Are you trying to show the text in label
for each row when the dropdown is opened and when it's selected? If so, try the following to see whether it solves your issue.
<SelectDropdown
data={zones.map(zone => ({ value: zone.id, label: zone.name }))}
buttonTextAfterSelection={(selectedItem) => selectedItem.label}
rowTextForSelection={(item) => item.label}
// other props
/>
Are you trying to show the text in
label
for each row when the dropdown is opened and when it's selected? If so, try the following to see whether it solves your issue.<SelectDropdown data={zones.map(zone => ({ value: zone.id, label: zone.name }))} buttonTextAfterSelection={(selectedItem) => selectedItem.label} rowTextForSelection={(item) => item.label} // other props />
Yass, that's exactly what solved the problem!! Thanks
I am trying to pass the "data" prop
data={zones.map(zone => ({ value: zone.id, label: zone.name, }))}
But React Native is given me the following error: " ERROR Error: Objects are not valid as a React child (found: object with keys {value, label}). If you meant to render a collection of children, use an array instead."
I want to show the user a value but then I need to find the object given its id, is it possible?