Skip to content

Commit

Permalink
Merge pull request #98 from thurber/feature/allow-override-of-ios-con…
Browse files Browse the repository at this point in the history
…firm-button-disabling-behavior

add a new prop: neverDisableConfirmIOS
  • Loading branch information
mmazzarolo authored Oct 18, 2017
2 parents bbd95df + eee50f7 commit 73fd2df
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export default class DateTimePickerTester extends Component {
| confirmTextStyle | style | | The style of the confirm button text on iOS |
| customCancelButtonIOS | node | | A custom component for the cancel button on iOS |
| customConfirmButtonIOS | node | | A custom component for the confirm button on iOS |
| neverDisableConfirmIOS | bool | false | If true, do not disable the confirm button on any touch events; see [#82](https://github.com/mmazzarolo/react-native-modal-datetime-picker/issues/82) |
| customTitleContainerIOS | node | | A custom component for the title container on iOS |
| datePickerContainerStyleIOS | style | | The style of the container on iOS |
| reactNativeModalPropsIOS | object | | Additional props for [react-native-modal](https://github.com/react-native-community/react-native-modal) on iOS |
Expand Down
5 changes: 4 additions & 1 deletion src/CustomDatePickerIOS/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default class CustomDatePickerIOS extends Component {
confirmTextIOS: PropTypes.string,
customCancelButtonIOS: PropTypes.node,
customConfirmButtonIOS: PropTypes.node,
neverDisableConfirmIOS: PropTypes.bool,
customConfirmButtonWhileInteractingIOS: PropTypes.node,
customTitleContainerIOS: PropTypes.node,
contentContainerStyleIOS: PropTypes.any,
Expand All @@ -29,6 +30,7 @@ export default class CustomDatePickerIOS extends Component {
};

static defaultProps = {
neverDisableConfirmIOS: false,
cancelTextIOS: 'Cancel',
confirmTextIOS: 'Confirm',
date: new Date(),
Expand Down Expand Up @@ -91,6 +93,7 @@ export default class CustomDatePickerIOS extends Component {
cancelTextIOS,
customCancelButtonIOS,
customConfirmButtonIOS,
neverDisableConfirmIOS,
customConfirmButtonWhileInteractingIOS,
contentContainerStyleIOS,
customTitleContainerIOS,
Expand Down Expand Up @@ -150,7 +153,7 @@ export default class CustomDatePickerIOS extends Component {
style={styles.confirmButton}
underlayColor='#ebebeb'
onPress={this._handleConfirm}
disabled={this.state.userIsInteractingWithPicker}
disabled={!neverDisableConfirmIOS && this.state.userIsInteractingWithPicker}
>
{confirmButton}
</TouchableHighlight>
Expand Down
7 changes: 7 additions & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ interface DateTimePickerProps {
* A custom component for the confirm button on iOS
*/
customConfirmButtonIOS?: JSX.Element

/**
* Never disable the confirm button on iOS, even on fling (see #82)
*
* Default is false
*/
neverDisableConfirmIOS?: boolean

/**
* A custom component for the title container on iOS
Expand Down

0 comments on commit 73fd2df

Please sign in to comment.