Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	components/ModalDropdown.js
  • Loading branch information
sohobloo committed Mar 23, 2017
2 parents c32c9d9 + 5dec7d4 commit 88b8412
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ Prop | Type | Optional | Default | Description
`onDropdownWillShow`| func | Yes | | Trigger when dropdown will show by touching the button. **Return `false` can cancel the event.**
`onDropdownWillHide`| func | Yes | | Trigger when dropdown will hide by touching the button. **Return `false` can cancel the event.**
`onSelect` | func | Yes | | Trigger when option row touched with selected `index` and `value`. **Return `false` can cancel the event.**
`accessible` | bool | Yes | true | Set accessibility of dropdown modal and dropdown rows

### Methods
Method | Description
Expand Down
9 changes: 7 additions & 2 deletions components/ModalDropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default class ModalDropdown extends Component {
defaultValue: PropTypes.string,
options: PropTypes.array,

accessible: PropTypes.bool,
animated: PropTypes.bool,
showsVerticalScrollIndicator: PropTypes.bool,

Expand Down Expand Up @@ -68,6 +69,7 @@ export default class ModalDropdown extends Component {

this.state = {
disabled: props.disabled,
accessible: props.accessible !== false,
loading: props.options == null,
showDropdown: false,
buttonText: props.defaultValue,
Expand Down Expand Up @@ -150,6 +152,7 @@ export default class ModalDropdown extends Component {
return (
<TouchableOpacity ref={button => this._button = button}
disabled={this.props.disabled}
accessible={this.props.accessible}
onPress={this._onButtonPress.bind(this)}>
{
this.props.children ||
Expand Down Expand Up @@ -182,7 +185,8 @@ export default class ModalDropdown extends Component {
transparent={true}
onRequestClose={this._onRequestClose.bind(this)}
supportedOrientations={['portrait', 'portrait-upside-down', 'landscape', 'landscape-left', 'landscape-right']}>
<TouchableWithoutFeedback onPress={this._onModalPress.bind(this)}>
<TouchableWithoutFeedback accessible={this.props.accessible}
onPress={this._onModalPress.bind(this)}>
<View style={styles.modal}>
<View style={[styles.dropdown, this.props.dropdownStyle, frameStyle]}>
{this.state.loading ? this._renderLoading() : this._renderDropdown()}
Expand Down Expand Up @@ -279,7 +283,8 @@ export default class ModalDropdown extends Component {
this.props.renderRow(rowData, rowID, highlighted);
let preservedProps = {
key: key,
onPress: () => this._onRowPress(rowData, sectionID, rowID, highlightRow)
accessible: this.props.accessible,
onPress: () => this._onRowPress(rowData, sectionID, rowID, highlightRow),
};
if (TOUCHABLE_ELEMENTS.find(name => name == row.type.displayName)) {
var props = {...row.props};
Expand Down

0 comments on commit 88b8412

Please sign in to comment.