react-native-material-dropdown icon indicating copy to clipboard operation
react-native-material-dropdown copied to clipboard

Able to custom render dropdown items but not able to display it correctly after selected

Open mdere opened this issue 6 years ago • 8 comments

image

image

                    <Dropdown
                        dropdownPosition={0}
                        containerStyle={{
                            marginTop: 20,
                            width: '100%',
                            backgroundColor: '#FFFFFF',
                            borderRadius: 4,
                            borderStyle: 'solid',
                            borderWidth: 1,
                            borderColor: '#EDEDED',
                            height: 48,
                            borderLeftWidth: 4,
                            justifyContent: 'center',
                            paddingBottom: 4
                        }}
                        inputContainerStyle={{
                            borderBottomColor: 'transparent',
                            paddingLeft: 4
                        }}
                        data={cardTypes}
                        valueExtractor={({value, icon}) => {
                            return (
                                <Text
                                    style={{
                                        textAlign: 'center'
                                    }}>
                                    <Image
                                        style={{
                                            width: 31.5,
                                            height: 20,
                                            paddingRight: 10
                                        }}
                                        source={icon} />
                                    <Text>  {value}</Text>
                                </Text>
                            )
                        }}/>

mdere avatar Sep 30 '18 22:09 mdere

Alright - so I partially just solved it just now by taking the same function in valueExtractor and added it to prop renderBase....but now the issue the dropdown goes away?

image

mdere avatar Sep 30 '18 22:09 mdere

Hey, how did you get to actually render what's inside valueExtractor? I tried with your example but still rendering as before. Anything else to consider?

comanzanares avatar Oct 10 '18 17:10 comanzanares

Refer to label extractor in order to customize dropdown items, something like

<MaterialDropdown
  // other props
  labelExtractor={({value, icon}) => (
    <Text style={{ textAlign: 'center' }}>
      <Image  source={icon}  />
      <Text>  {value}</Text>
    </Text>
  )}}                                  
/>

sergiulucaci avatar Apr 12 '19 07:04 sergiulucaci

I'm facing the same problem now with valueExtractor and labelExtractor. Is there still a way to render custom dropdown items?

mc2147 avatar Jun 18 '19 15:06 mc2147

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?

ajinkyadesai-git avatar Dec 24 '19 15:12 ajinkyadesai-git

Any updates regarding to this ?

akiladevinda avatar Jan 24 '20 06:01 akiladevinda

@mdere can you please provide the code that preview selected item

akiladevinda avatar Jan 24 '20 07:01 akiladevinda

any updates?

diragb avatar Sep 20 '20 15:09 diragb