Skip to content

Commit

Permalink
Merge pull request #47 from jdoyle65/master
Browse files Browse the repository at this point in the history
Add modalOnResponderTerminationRequest property
  • Loading branch information
feyy authored Oct 31, 2016
2 parents 3ae69a4 + 2b18c31 commit bee4777
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 @@ -77,6 +77,7 @@ You can check [index.js](https://github.com/xgfe/react-native-datepicker/blob/ma
| showIcon | true | `boolean` | Controller whether or not show the icon |
| placeholder | '' | `string` | The placeholder show when this.props.date is falsy |
| onDateChange | - | `function` | This is called when the user confirm the picked date or time in the UI. The first and only argument is a date or time string representing the new date and time formatted by [moment.js](http://momentjs.com/) with the given format property. |
| modalOnResponderTerminationRequest | - | `function` | Set the callback for React Native's [Gesture Responder System](https://facebook.github.io/react-native/docs/gesture-responder-system.html#responder-lifecycle)'s call to `onResponderTerminationRequest`. By default this will reject a termination request, but can be overidden in case the View under the Modal is implementing custom gesture responders, and you wish for those to be overidden in certain cases. |

## Instance Methods

Expand Down
9 changes: 7 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,9 @@ class DatePicker extends Component {
>
<Animated.View
style={[Style.datePickerCon, {height: this.state.animatedHeight}, customStyles.datePickerCon]}
onStartShouldSetResponder={e => true}
onMoveShouldSetResponder={e => true}
onResponderTerminationRequest={this.props.modalOnResponderTerminationRequest}
>
<DatePickerIOS
date={this.state.date}
Expand Down Expand Up @@ -311,7 +314,8 @@ DatePicker.defaultProps = {
// whether or not show the icon
showIcon: true,
disabled: false,
placeholder: ''
placeholder: '',
modalOnResponderTerminationRequest: e => true
};

DatePicker.propTypes = {
Expand All @@ -328,7 +332,8 @@ DatePicker.propTypes = {
showIcon: React.PropTypes.bool,
disabled: React.PropTypes.bool,
onDateChange: React.PropTypes.func,
placeholder: React.PropTypes.string
placeholder: React.PropTypes.string,
modalOnResponderTerminationRequest: React.PropTypes.func
};

export default DatePicker;

0 comments on commit bee4777

Please sign in to comment.