Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ref prop types #19292

Merged
merged 5 commits into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/components/Button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ 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])})]),
// eslint-disable-next-line react/forbid-prop-types
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]),
};

const defaultProps = {
Expand Down
3 changes: 2 additions & 1 deletion src/components/MoneyRequestConfirmationList.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const propTypes = {
navigateToStep: PropTypes.func.isRequired,

/** The policyID of the request */
policyID: PropTypes.string.isRequired,
policyID: PropTypes.string,
};

const defaultProps = {
Expand All @@ -81,6 +81,7 @@ const defaultProps = {
session: {
email: null,
},
policyID: '',
...withCurrentUserPersonalDetailsDefaultProps,
};

Expand Down
3 changes: 2 additions & 1 deletion src/components/SettlementButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]),
Expand All @@ -66,6 +66,7 @@ const defaultProps = {
nvp_lastPaymentMethod: {},
style: [],
iouReport: {},
policyID: '',
};

class SettlementButton extends React.Component {
Expand Down
3 changes: 2 additions & 1 deletion src/components/withNavigationFallback.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ 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])})]),
// eslint-disable-next-line react/forbid-prop-types
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]),
};
WithNavigationFallback.defaultProps = {
forwardedRef: undefined,
Expand Down
3 changes: 2 additions & 1 deletion src/components/withNavigationFocus.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ 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])})]),
// eslint-disable-next-line react/forbid-prop-types
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]),
};
WithNavigationFocus.defaultProps = {
forwardedRef: undefined,
Expand Down
3 changes: 2 additions & 1 deletion src/pages/iou/steps/MoneyRequestConfirmPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => (
Expand Down