diff --git a/README.md b/README.md index be5f49f..ce68a9a 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,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.** +`onLongPress` | func | Yes | | Trigger when the button has received `onLongPress` event `accessible` | bool | Yes | true | Set accessibility of dropdown modal and dropdown rows `keyboardShouldPersistTaps` | enum('always', 'never', 'handled') | Yes | 'never' | See react-native `ScrollView` props diff --git a/components/ModalDropdown.js b/components/ModalDropdown.js index 4dc5342..aa8e516 100644 --- a/components/ModalDropdown.js +++ b/components/ModalDropdown.js @@ -171,6 +171,7 @@ export default class ModalDropdown extends Component { disabled={disabled} accessible={accessible} onPress={this._onButtonPress} + onLongPress={this._onButtonLongPress} > { children || @@ -196,6 +197,12 @@ export default class ModalDropdown extends Component { } }; + _onButtonLongPress = () => { + if (this.props.onLongPress) { + this.props.onLongPress(); + } + } + _renderModal() { const {animated, accessible, dropdownStyle} = this.props; const {showDropdown, loading} = this.state;