Closed joaquin-gs closed 3 months ago
As an additional observation, not even the original example code is working. It doesn't matter if I add or delete the renderButton
property, it doesn't output anything.
renderButton is required to render the dropdown button, it take selectedItem as an argument like here
renderButton={(selectedItem, isOpened) => {
return (
<View style={styles.dropdownButtonStyle}>
{selectedItem && (
<Icon name={selectedItem.icon} style={styles.dropdownButtonIconStyle} />
)}
<Text style={styles.dropdownButtonTxtStyle}>
{(selectedItem && selectedItem.title) || 'Select your mood'}
</Text>
<Icon name={isOpened ? 'chevron-up' : 'chevron-down'} style={styles.dropdownButtonArrowStyle} />
</View>
);
}}
For renderItem, to render the item correctly in your example add item.title to render it
https://snack.expo.dev/@adelredaa97/mad-yellow-chocolate
check this example
This is my first time trying to use this component, so I read the documentation and follow the usage instructions. According to that, I only needed to change the data but I only see '[object Object]' in the button as well as for each option in the dropdown.
Can someone please tell me what I did wrong?
Here is my code:
Thanks for any help.