sohobloo/react-native-modal-dropdown

How set object array as options instead if normal array

Opened this issue · 1 comments

I have checked the example and found that we can set the object as options but not sure how to implement it. Can you please explain step by step how we can achieve it?
A quick reply will be much appreciated.

How I did it was by passing array of an objects in the options and using renderRow function-

here "option.label" is my object key.
renderRow={(option,index,isSelected)=>{ return( <View style={{paddingHorizontal:5,paddingVertical:5}}> <Text style={{fontFamily:theme.textFont,fontSize:14,color:option.value==this.state.selectedPreset.value?theme.textColor:'#cfcfcf'}}>{option.label}</Text> </View> ) }}

Sorry if answer was unformatted. I am new here