react-native-material-dropdown
react-native-material-dropdown copied to clipboard
How i can set dynamic data on dropdown
We can use this array let data = [{ value: 'English', }, { value: 'Hindi', }, ];
and i want to decode this array on drop down
let data = [{ id:'6' name: 'English', }, { id:'7' name: 'Hindi', }, ];
Please help if someone know how i can set dynamic data on drop-down
kishanverma26 you can't do that. You need 'value' key in your data object otherwise data will not show in dropdown. I mean you can't use other key's in your object like 'id' and 'name' except 'value' key.
Then this dropdown is useless
please use : valueExtractor ={({id})=>id} // this one extract the value from your data labelExtractor ={({name})=>name} //this one extracts the label note "id" and "name" depends on ur data model i just used kish' example model
how to implement if there is no key as 'value' in Data array object, please provide an example OR how to use value/labelExtractor to display Dropdown items?