n4kz / react-native-material-dropdown

Material dropdown with consistent behaviour on iOS and Android
Other
732 stars 597 forks source link

When both label and value are provided selectedItemColor colors all items #200

Open tamarr opened 4 years ago

tamarr commented 4 years ago

When providing both label and value in data, setting selectedItemColor will result in all items in the dropdown getting the selectedItemColor

const dropdownOptions = options.map((optionId) => {
      return {
        label: this.state.options[optionId]['name'],
        value: optionId
      }
});

  return   <Dropdown
                    containerStyle={styles.dropdown}
                    value={currentOptionName}
                    data={dropdownOptions}
                    itemColor={'black'}
                    textColor={'black'}
                    selectedItemColor={'red}
                    onChangeText={(optionId, idx, data) => {this.optionSelected(optionId)}}
                  />
satasuk01 commented 4 years ago

Yep I face this problem too after passing value to Dropdown.