Skip to content

Commit 73fd2df

Browse files
authored
Merge pull request #98 from thurber/feature/allow-override-of-ios-confirm-button-disabling-behavior
add a new prop: neverDisableConfirmIOS
2 parents bbd95df + eee50f7 commit 73fd2df

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export default class DateTimePickerTester extends Component {
7171
| confirmTextStyle | style | | The style of the confirm button text on iOS |
7272
| customCancelButtonIOS | node | | A custom component for the cancel button on iOS |
7373
| customConfirmButtonIOS | node | | A custom component for the confirm button on iOS |
74+
| 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) |
7475
| customTitleContainerIOS | node | | A custom component for the title container on iOS |
7576
| datePickerContainerStyleIOS | style | | The style of the container on iOS |
7677
| reactNativeModalPropsIOS | object | | Additional props for [react-native-modal](https://github.com/react-native-community/react-native-modal) on iOS |

src/CustomDatePickerIOS/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export default class CustomDatePickerIOS extends Component {
1111
confirmTextIOS: PropTypes.string,
1212
customCancelButtonIOS: PropTypes.node,
1313
customConfirmButtonIOS: PropTypes.node,
14+
neverDisableConfirmIOS: PropTypes.bool,
1415
customConfirmButtonWhileInteractingIOS: PropTypes.node,
1516
customTitleContainerIOS: PropTypes.node,
1617
contentContainerStyleIOS: PropTypes.any,
@@ -29,6 +30,7 @@ export default class CustomDatePickerIOS extends Component {
2930
};
3031

3132
static defaultProps = {
33+
neverDisableConfirmIOS: false,
3234
cancelTextIOS: 'Cancel',
3335
confirmTextIOS: 'Confirm',
3436
date: new Date(),
@@ -91,6 +93,7 @@ export default class CustomDatePickerIOS extends Component {
9193
cancelTextIOS,
9294
customCancelButtonIOS,
9395
customConfirmButtonIOS,
96+
neverDisableConfirmIOS,
9497
customConfirmButtonWhileInteractingIOS,
9598
contentContainerStyleIOS,
9699
customTitleContainerIOS,
@@ -150,7 +153,7 @@ export default class CustomDatePickerIOS extends Component {
150153
style={styles.confirmButton}
151154
underlayColor='#ebebeb'
152155
onPress={this._handleConfirm}
153-
disabled={this.state.userIsInteractingWithPicker}
156+
disabled={!neverDisableConfirmIOS && this.state.userIsInteractingWithPicker}
154157
>
155158
{confirmButton}
156159
</TouchableHighlight>

src/index.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ interface DateTimePickerProps {
3030
* A custom component for the confirm button on iOS
3131
*/
3232
customConfirmButtonIOS?: JSX.Element
33+
34+
/**
35+
* Never disable the confirm button on iOS, even on fling (see #82)
36+
*
37+
* Default is false
38+
*/
39+
neverDisableConfirmIOS?: boolean
3340

3441
/**
3542
* A custom component for the title container on iOS

0 commit comments

Comments
 (0)