From dcfd70a85960529bd79286e802ecbc9d672ec74b Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Fri, 19 May 2023 22:42:40 +0800 Subject: [PATCH 1/4] update prop types --- src/components/Button/index.js | 2 +- src/components/withNavigationFallback.js | 2 +- src/components/withNavigationFocus.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/Button/index.js b/src/components/Button/index.js index f9200d085b28..cb807ee6af0d 100644 --- a/src/components/Button/index.js +++ b/src/components/Button/index.js @@ -111,7 +111,7 @@ const propTypes = { accessibilityLabel: PropTypes.string, /** A ref to forward the button */ - forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.oneOfType([PropTypes.instanceOf(React.Component), PropTypes.func])})]), + forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]), }; const defaultProps = { diff --git a/src/components/withNavigationFallback.js b/src/components/withNavigationFallback.js index 4bd5cfdeb5d8..b26d0c16b70a 100644 --- a/src/components/withNavigationFallback.js +++ b/src/components/withNavigationFallback.js @@ -36,7 +36,7 @@ export default function (WrappedComponent) { WithNavigationFallback.contextType = NavigationContext; WithNavigationFallback.displayName = `WithNavigationFocusWithFallback(${getComponentDisplayName(WrappedComponent)})`; WithNavigationFallback.propTypes = { - forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.oneOfType([PropTypes.instanceOf(React.Component), PropTypes.func])})]), + forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]), }; WithNavigationFallback.defaultProps = { forwardedRef: undefined, diff --git a/src/components/withNavigationFocus.js b/src/components/withNavigationFocus.js index 0ece1b658c65..794b96e68c32 100644 --- a/src/components/withNavigationFocus.js +++ b/src/components/withNavigationFocus.js @@ -22,7 +22,7 @@ export default function withNavigationFocus(WrappedComponent) { WithNavigationFocus.displayName = `withNavigationFocus(${getComponentDisplayName(WrappedComponent)})`; WithNavigationFocus.propTypes = { - forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.oneOfType([PropTypes.instanceOf(React.Component), PropTypes.func])})]), + forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]), }; WithNavigationFocus.defaultProps = { forwardedRef: undefined, From 67af0b442c0adaf4d37561a85f2331d8dfc9c47f Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Fri, 19 May 2023 23:39:21 +0800 Subject: [PATCH 2/4] update ref prop types --- src/components/Button/index.js | 2 +- src/components/withNavigationFallback.js | 2 +- src/components/withNavigationFocus.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/Button/index.js b/src/components/Button/index.js index cb807ee6af0d..b7b8bde20505 100644 --- a/src/components/Button/index.js +++ b/src/components/Button/index.js @@ -111,7 +111,7 @@ const propTypes = { accessibilityLabel: PropTypes.string, /** A ref to forward the button */ - forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]), + forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]), }; const defaultProps = { diff --git a/src/components/withNavigationFallback.js b/src/components/withNavigationFallback.js index b26d0c16b70a..ad2a6e298ef5 100644 --- a/src/components/withNavigationFallback.js +++ b/src/components/withNavigationFallback.js @@ -36,7 +36,7 @@ export default function (WrappedComponent) { WithNavigationFallback.contextType = NavigationContext; WithNavigationFallback.displayName = `WithNavigationFocusWithFallback(${getComponentDisplayName(WrappedComponent)})`; WithNavigationFallback.propTypes = { - forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]), + forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]), }; WithNavigationFallback.defaultProps = { forwardedRef: undefined, diff --git a/src/components/withNavigationFocus.js b/src/components/withNavigationFocus.js index 794b96e68c32..dbc5b4f52066 100644 --- a/src/components/withNavigationFocus.js +++ b/src/components/withNavigationFocus.js @@ -22,7 +22,7 @@ export default function withNavigationFocus(WrappedComponent) { WithNavigationFocus.displayName = `withNavigationFocus(${getComponentDisplayName(WrappedComponent)})`; WithNavigationFocus.propTypes = { - forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]), + forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]), }; WithNavigationFocus.defaultProps = { forwardedRef: undefined, From 05a8e4d2651c9a4ae79d35edf3435de281f9b0bc Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Sat, 20 May 2023 00:11:54 +0800 Subject: [PATCH 3/4] update policyID prop types to be optional --- src/components/MoneyRequestConfirmationList.js | 3 ++- src/components/SettlementButton.js | 3 ++- src/pages/iou/steps/MoneyRequestConfirmPage.js | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/MoneyRequestConfirmationList.js b/src/components/MoneyRequestConfirmationList.js index 8b6a43f47215..bcbb5d470bfa 100755 --- a/src/components/MoneyRequestConfirmationList.js +++ b/src/components/MoneyRequestConfirmationList.js @@ -69,7 +69,7 @@ const propTypes = { navigateToStep: PropTypes.func.isRequired, /** The policyID of the request */ - policyID: PropTypes.string.isRequired, + policyID: PropTypes.string, }; const defaultProps = { @@ -81,6 +81,7 @@ const defaultProps = { session: { email: null, }, + policyID: '', ...withCurrentUserPersonalDetailsDefaultProps, }; diff --git a/src/components/SettlementButton.js b/src/components/SettlementButton.js index 1c9c5ed3bcd7..6d27723ae4e6 100644 --- a/src/components/SettlementButton.js +++ b/src/components/SettlementButton.js @@ -49,7 +49,7 @@ const propTypes = { nvp_lastPaymentMethod: PropTypes.objectOf(PropTypes.string), /** The policyID of the report we are paying */ - policyID: PropTypes.string.isRequired, + policyID: PropTypes.string, /** Additional styles to add to the component */ style: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]), @@ -66,6 +66,7 @@ const defaultProps = { nvp_lastPaymentMethod: {}, style: [], iouReport: {}, + policyID: '', }; class SettlementButton extends React.Component { diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index 025d22b33b37..c6cd7f13b183 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -30,12 +30,13 @@ const propTypes = { navigateToStep: PropTypes.func.isRequired, /** The policyID of the request */ - policyID: PropTypes.string.isRequired, + policyID: PropTypes.string, }; const defaultProps = { iouType: CONST.IOU.MONEY_REQUEST_TYPE.REQUEST, canModifyParticipants: false, + policyID: '', }; const MoneyRequestConfirmPage = (props) => ( From a4f0306a6c53313e61d6c1e82ddc2afc28bbd37e Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Mon, 22 May 2023 13:17:56 +0800 Subject: [PATCH 4/4] update prop type --- src/components/Button/index.js | 3 ++- src/components/withNavigationFallback.js | 3 ++- src/components/withNavigationFocus.js | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/Button/index.js b/src/components/Button/index.js index b7b8bde20505..dec07858bf1a 100644 --- a/src/components/Button/index.js +++ b/src/components/Button/index.js @@ -111,7 +111,8 @@ const propTypes = { accessibilityLabel: PropTypes.string, /** A ref to forward the button */ - forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]), + // eslint-disable-next-line react/forbid-prop-types + forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]), }; const defaultProps = { diff --git a/src/components/withNavigationFallback.js b/src/components/withNavigationFallback.js index ad2a6e298ef5..3980ebe01e64 100644 --- a/src/components/withNavigationFallback.js +++ b/src/components/withNavigationFallback.js @@ -36,7 +36,8 @@ export default function (WrappedComponent) { WithNavigationFallback.contextType = NavigationContext; WithNavigationFallback.displayName = `WithNavigationFocusWithFallback(${getComponentDisplayName(WrappedComponent)})`; WithNavigationFallback.propTypes = { - forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]), + // eslint-disable-next-line react/forbid-prop-types + forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]), }; WithNavigationFallback.defaultProps = { forwardedRef: undefined, diff --git a/src/components/withNavigationFocus.js b/src/components/withNavigationFocus.js index dbc5b4f52066..0de770c09ba6 100644 --- a/src/components/withNavigationFocus.js +++ b/src/components/withNavigationFocus.js @@ -22,7 +22,8 @@ export default function withNavigationFocus(WrappedComponent) { WithNavigationFocus.displayName = `withNavigationFocus(${getComponentDisplayName(WrappedComponent)})`; WithNavigationFocus.propTypes = { - forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]), + // eslint-disable-next-line react/forbid-prop-types + forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]), }; WithNavigationFocus.defaultProps = { forwardedRef: undefined,