sohobloo / react-native-modal-dropdown

A react-native dropdown/picker/selector component for both Android & iOS.
MIT License
1.19k stars 477 forks source link

RenderRow with image and Text #179

Open KarthikBaleneni opened 6 years ago

KarthikBaleneni commented 6 years ago

Hi,

I'm wondering if there is a possibility to display both image and text in row by allowing arrays with key value pair index for the following dropdown.


<ModalDropdown enableEmptySections={true} dropdownStyle={styles.dropdown_2_dropdown} renderRow={this.displayRow.bind(this)} textStyle={styles.dropdown_2_text} style={styles.dropdown} defaultValue={i18n.t('selcode')} onSelect={(idx, value) => this._selectedCountry(idx, value)} options={this.state.stCountryList} />

Array like this

options=[{img:'../.png,value:'opotion1},{img:'../.png,value:'option2}]

so that

RenderRow function render will be like

 displayRow = (data) => {
        return (
            <TouchableHighlight>
                <Img  source='require( {`${data.img}`})/>
                <Text style={styles.dropdown_label}>{`${data.value}`}</Text>
            </TouchableHighlight>
        )
    }