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

Fix/22929 forwardref console error #24405

Merged
Merged
Show file tree
Hide file tree
Changes from 3 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/AmountTextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const propTypes = {
formattedAmount: PropTypes.string.isRequired,

/** A ref to forward to amount text input */
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]),
// eslint-disable-next-line react/forbid-prop-types
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move this to refPropTypes and apply it across the app

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated


/** Function to call when amount in text input is changed */
onChangeAmount: PropTypes.func.isRequired,
Expand Down
3 changes: 2 additions & 1 deletion src/components/Checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ const propTypes = {
caretSize: PropTypes.number,

/** A ref to forward to the Pressable */
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]),
// eslint-disable-next-line react/forbid-prop-types
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]),

/** An accessibility label for the checkbox */
accessibilityLabel: PropTypes.string.isRequired,
Expand Down
3 changes: 2 additions & 1 deletion src/components/CountryPicker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ const propTypes = {
onInputChange: PropTypes.func,

/** A ref to forward to MenuItemWithTopDescription */
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]),
// 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/Picker/BasePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import {ScrollContext} from '../ScrollViewWithContext';

const propTypes = {
/** A forwarded ref */
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]),
// eslint-disable-next-line react/forbid-prop-types
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]),

/** BasePicker label */
label: PropTypes.string,
Expand Down
3 changes: 2 additions & 1 deletion src/components/StatePicker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ const propTypes = {
onInputChange: PropTypes.func,

/** A ref to forward to MenuItemWithTopDescription */
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]),
// eslint-disable-next-line react/forbid-prop-types
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]),

/** Label to display on field */
label: PropTypes.string,
Expand Down
3 changes: 2 additions & 1 deletion src/components/TextInputWithCurrencySymbol.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import * as MoneyRequestUtils from '../libs/MoneyRequestUtils';

const propTypes = {
/** A ref to forward to amount text input */
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]),
// eslint-disable-next-line react/forbid-prop-types
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]),

/** Formatted amount in local currency */
formattedAmount: PropTypes.string.isRequired,
Expand Down
3 changes: 2 additions & 1 deletion src/components/TextLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ const propTypes = {
onMouseDown: PropTypes.func,

/** A ref to forward to text */
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]),
// 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/withAnimatedRef.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export default function withAnimatedRef(WrappedComponent) {
}
WithAnimatedRef.displayName = `withAnimatedRef(${getComponentDisplayName(WrappedComponent)})`;
WithAnimatedRef.propTypes = {
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]),
// eslint-disable-next-line react/forbid-prop-types
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]),
};
WithAnimatedRef.defaultProps = {
forwardedRef: undefined,
Expand Down
3 changes: 2 additions & 1 deletion src/components/withCurrentUserPersonalDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ const withCurrentUserPersonalDetailsDefaultProps = {

export default function (WrappedComponent) {
const propTypes = {
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]),
// eslint-disable-next-line react/forbid-prop-types
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]),

/** Personal details of all the users, including current user */
personalDetails: PropTypes.objectOf(personalDetailsPropType),
Expand Down
3 changes: 2 additions & 1 deletion src/components/withNavigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export default function withNavigation(WrappedComponent) {

WithNavigation.displayName = `withNavigation(${getComponentDisplayName(WrappedComponent)})`;
WithNavigation.propTypes = {
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]),
// eslint-disable-next-line react/forbid-prop-types
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]),
};
WithNavigation.defaultProps = {
forwardedRef: () => {},
Expand Down
3 changes: 2 additions & 1 deletion src/components/withToggleVisibilityView.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export default function (WrappedComponent) {

WithToggleVisibilityView.displayName = `WithToggleVisibilityView(${getComponentDisplayName(WrappedComponent)})`;
WithToggleVisibilityView.propTypes = {
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]),
// eslint-disable-next-line react/forbid-prop-types
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]),

/** Whether the content is visible. */
isVisible: PropTypes.bool,
Expand Down
3 changes: 2 additions & 1 deletion src/pages/iou/steps/MoneyRequestAmountForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ const propTypes = {
isEditing: PropTypes.bool,

/** Refs forwarded to the TextInputWithCurrencySymbol */
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]),
// eslint-disable-next-line react/forbid-prop-types
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]),

/** Fired when back button pressed, navigates to currency selection page */
onCurrencyButtonPress: PropTypes.func.isRequired,
Expand Down