From 73a487458f84713faad6db313366f32a75747a1e Mon Sep 17 00:00:00 2001 From: Bob Kanellopoulos Date: Tue, 13 Jul 2021 16:30:23 +0300 Subject: [PATCH] feat: Add `cancelButtonTestID` and `confirmButtonTestID` props (#582) Add `cancelButtonTestID` and `confirmButtonTestID` props for E2E testing. --- README.md | 2 ++ src/DateTimePickerModal.ios.js | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/README.md b/README.md index 2101bd5..b2e1169 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,8 @@ export default Example; | Name | Type | Default | Description | | ----------------------- | --------- | ------------- | --------------------------------------------------------------------------------------------------- | +| cancelButtonTestID | string | | Used to locate cancel button in end-to-end tests. | +| confirmButtonTestID | string | | Used to locate confirm button in end-to-end tests. | | cancelTextIOS | string | 'Cancel' | The label of the cancel button (iOS) | | confirmTextIOS | string | 'Confirm' | The label of the confirm button (iOS) | | customCancelButtonIOS | component | | Overrides the default cancel button component (iOS) | diff --git a/src/DateTimePickerModal.ios.js b/src/DateTimePickerModal.ios.js index bfc3b77..443ff4b 100644 --- a/src/DateTimePickerModal.ios.js +++ b/src/DateTimePickerModal.ios.js @@ -26,6 +26,8 @@ export const TITLE_COLOR = "#8f8f8f"; export class DateTimePickerModal extends React.PureComponent { static propTypes = { + cancelButtonTestID: PropTypes.string, + confirmButtonTestID: PropTypes.string, cancelTextIOS: PropTypes.string, confirmTextIOS: PropTypes.string, customCancelButtonIOS: PropTypes.elementType, @@ -110,6 +112,8 @@ export class DateTimePickerModal extends React.PureComponent { render() { const { + cancelButtonTestID, + confirmButtonTestID, cancelTextIOS, confirmTextIOS, customCancelButtonIOS, @@ -188,12 +192,14 @@ export class DateTimePickerModal extends React.PureComponent { />