0

Is there any way to put an abject in the label of item?

<RNPickerSelect 
/* bunch of attributes*/
// the standard object
 items={[ {label:'1 hour', value:'1'},
           {label:'2 Hours', value:'2'},
                ...]}
// what I want to do
items={[
 { label:()=> {<><Icon name='clock' size={20}/><Text>1 Hour</Text></>},
   value:'1'},
    ...]}
 />

The problem as of the docs is that label accepts only string type. so, is there any prop or a way to put a complex object in label instead of a string?

  • related https://stackoverflow.com/questions/52552916/react-native-picker-with-image-icon – diedu Oct 05 '20 at 02:31
  • I'm quite surprised that there isn't any lib that allow you to customize item rendering, I think you'll have to implement it from scratch – diedu Oct 05 '20 at 02:33

0 Answers0