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

flexDirection: 'row' ? #124

Open Dror-Bar opened 6 years ago

Dror-Bar commented 6 years ago

Is there a way to give the ModalDropdown flexDirection: 'row' style? I want it to contain a row of items rather than a column.

icazevedo commented 6 years ago

I also was experiencing this bug. I found a simple workaround: wrap all children components in a View and give it the desired style. It worked fine to me.

Dror-Bar commented 6 years ago

Interesting, I thought I tried that but I'll give it another go.

therise3107 commented 6 years ago

Hello guys is there any solution? I tried the wrapping children components in View but it did not work. Thanks in advance.

Dror-Bar commented 6 years ago

@therise3107 While I haven't tried it myself yet, you could probably achieve something like this with the built-in method renderRow. The method gives you complete control on how the dropdown is going to look. For example:

<ModalDropdown options={this.state.options} renderRow={this._renderRow} onSelect={this._onSelect} />

And add the method:

_renderRow(rowData, rowID, highlighted) {
  return (
    <View style={styles.row}>
      {more stuff here...}
    </View>
  );
}