Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mdere opened this issue Sep 30, 2018 · 8 comments

Comments

@mdere
Copy link

mdere commented Sep 30, 2018

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
Copy link
Author

mdere commented Sep 30, 2018

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

@comanzanares
Copy link

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?

@sergiulucaci
Copy link

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>
  )}}                                  
/>

@mc2147
Copy link

mc2147 commented Jun 18, 2019

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

@ajinkyadesai-git
Copy link

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?

@akiladevinda
Copy link

Any updates regarding to this ?

@akiladevinda
Copy link

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

@diragb
Copy link

diragb commented Sep 20, 2020

any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants