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 5 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
2 changes: 1 addition & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1311,4 +1311,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 845537d35601574adcd0794e17003ba7dbccdbfd

COCOAPODS: 1.12.1
COCOAPODS: 1.11.3
Copy link
Contributor

Choose a reason for hiding this comment

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

not required

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah my bad, I updated

3 changes: 2 additions & 1 deletion src/components/AmountTextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import PropTypes from 'prop-types';
import TextInput from './TextInput';
import styles from '../styles/styles';
import CONST from '../CONST';
import refPropTypes from './refPropTypes';

const propTypes = {
/** Formatted amount in local currency */
formattedAmount: PropTypes.string.isRequired,

/** A ref to forward to amount text input */
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]),
forwardedRef: refPropTypes,

/** Function to call when amount in text input is changed */
onChangeAmount: PropTypes.func.isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import PagerView from 'react-native-pager-view';
import _ from 'underscore';
import styles from '../../../../styles/styles';
import AttachmentCarouselPagerContext from './AttachmentCarouselPagerContext';
import refPropTypes from '../../../refPropTypes';

const AnimatedPagerView = Animated.createAnimatedComponent(createNativeWrapper(PagerView));

Expand Down Expand Up @@ -50,7 +51,7 @@ const pagerPropTypes = {
onSwipeSuccess: PropTypes.func,
onSwipeDown: PropTypes.func,
onPinchGestureChange: PropTypes.func,
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
forwardedRef: refPropTypes,
containerWidth: PropTypes.number.isRequired,
containerHeight: PropTypes.number.isRequired,
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/Button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import * as Expensicons from '../Icon/Expensicons';
import withNavigationFocus from '../withNavigationFocus';
import validateSubmitShortcut from './validateSubmitShortcut';
import PressableWithFeedback from '../Pressable/PressableWithFeedback';
import refPropTypes from '../refPropTypes';

const propTypes = {
/** The text for the button label */
Expand Down Expand Up @@ -118,8 +119,7 @@ const propTypes = {
accessibilityLabel: PropTypes.string,

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

const defaultProps = {
Expand Down
3 changes: 2 additions & 1 deletion src/components/Checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import * as Expensicons from './Icon/Expensicons';
import * as StyleUtils from '../styles/StyleUtils';
import CONST from '../CONST';
import PressableWithFeedback from './Pressable/PressableWithFeedback';
import refPropTypes from './refPropTypes';

const propTypes = {
/** Whether checkbox is checked */
Expand Down Expand Up @@ -45,7 +46,7 @@ const propTypes = {
caretSize: PropTypes.number,

/** A ref to forward to the Pressable */
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]),
forwardedRef: refPropTypes,

/** 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 @@ -7,6 +7,7 @@ import MenuItemWithTopDescription from '../MenuItemWithTopDescription';
import useLocalize from '../../hooks/useLocalize';
import CountrySelectorModal from './CountrySelectorModal';
import FormHelpMessage from '../FormHelpMessage';
import refPropTypes from '../refPropTypes';

const propTypes = {
/** Form Error description */
Expand All @@ -19,7 +20,7 @@ const propTypes = {
onInputChange: PropTypes.func,

/** A ref to forward to MenuItemWithTopDescription */
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]),
forwardedRef: refPropTypes,
};

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 @@ -10,10 +10,11 @@ import Text from '../Text';
import styles from '../../styles/styles';
import themeColors from '../../styles/themes/default';
import {ScrollContext} from '../ScrollViewWithContext';
import refPropTypes from '../refPropTypes';

const propTypes = {
/** A forwarded ref */
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]),
forwardedRef: refPropTypes,

/** 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 @@ -7,6 +7,7 @@ import MenuItemWithTopDescription from '../MenuItemWithTopDescription';
import useLocalize from '../../hooks/useLocalize';
import FormHelpMessage from '../FormHelpMessage';
import StateSelectorModal from './StateSelectorModal';
import refPropTypes from '../refPropTypes';

const propTypes = {
/** Error text to display */
Expand All @@ -19,7 +20,7 @@ const propTypes = {
onInputChange: PropTypes.func,

/** A ref to forward to MenuItemWithTopDescription */
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]),
forwardedRef: refPropTypes,

/** 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 @@ -5,10 +5,11 @@ import CurrencySymbolButton from './CurrencySymbolButton';
import * as CurrencyUtils from '../libs/CurrencyUtils';
import useLocalize from '../hooks/useLocalize';
import * as MoneyRequestUtils from '../libs/MoneyRequestUtils';
import refPropTypes from './refPropTypes';

const propTypes = {
/** A ref to forward to amount text input */
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]),
forwardedRef: refPropTypes,

/** 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 @@ -6,6 +6,7 @@ import styles from '../styles/styles';
import stylePropTypes from '../styles/stylePropTypes';
import CONST from '../CONST';
import * as Link from '../libs/actions/Link';
import refPropTypes from './refPropTypes';

const propTypes = {
/** Link to open in new tab */
Expand All @@ -24,7 +25,7 @@ const propTypes = {
onMouseDown: PropTypes.func,

/** A ref to forward to text */
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]),
forwardedRef: refPropTypes,
};

const defaultProps = {
Expand Down
3 changes: 2 additions & 1 deletion src/components/menuItemPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import _ from 'underscore';
import CONST from '../CONST';
import stylePropTypes from '../styles/stylePropTypes';
import avatarPropTypes from './avatarPropTypes';
import refPropTypes from './refPropTypes';

const propTypes = {
/** Text to be shown as badge near the right end. */
Expand Down Expand Up @@ -118,7 +119,7 @@ const propTypes = {
shouldBlockSelection: PropTypes.bool,

/** The ref to the menu item */
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
forwardedRef: refPropTypes,

/** Any adjustments to style when menu item is hovered or pressed */
hoverAndPressStyle: PropTypes.arrayOf(PropTypes.object),
Expand Down
4 changes: 2 additions & 2 deletions src/components/withAnimatedRef.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import {useAnimatedRef} from 'react-native-reanimated';
import PropTypes from 'prop-types';
import getComponentDisplayName from '../libs/getComponentDisplayName';
import refPropTypes from './refPropTypes';

export default function withAnimatedRef(WrappedComponent) {
function WithAnimatedRef(props) {
Expand All @@ -17,7 +17,7 @@ export default function withAnimatedRef(WrappedComponent) {
}
WithAnimatedRef.displayName = `withAnimatedRef(${getComponentDisplayName(WrappedComponent)})`;
WithAnimatedRef.propTypes = {
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]),
forwardedRef: refPropTypes,
};
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 @@ -4,6 +4,7 @@ import {withOnyx} from 'react-native-onyx';
import getComponentDisplayName from '../libs/getComponentDisplayName';
import ONYXKEYS from '../ONYXKEYS';
import personalDetailsPropType from '../pages/personalDetailsPropType';
import refPropTypes from './refPropTypes';

const withCurrentUserPersonalDetailsPropTypes = {
currentUserPersonalDetails: personalDetailsPropType,
Expand All @@ -15,7 +16,7 @@ const withCurrentUserPersonalDetailsDefaultProps = {

export default function (WrappedComponent) {
const propTypes = {
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]),
forwardedRef: refPropTypes,

/** 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 @@ -2,6 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import {useNavigation} from '@react-navigation/native';
import getComponentDisplayName from '../libs/getComponentDisplayName';
import refPropTypes from './refPropTypes';

const withNavigationPropTypes = {
navigation: PropTypes.object.isRequired,
Expand All @@ -22,7 +23,7 @@ export default function withNavigation(WrappedComponent) {

WithNavigation.displayName = `withNavigation(${getComponentDisplayName(WrappedComponent)})`;
WithNavigation.propTypes = {
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]),
forwardedRef: refPropTypes,
};
WithNavigation.defaultProps = {
forwardedRef: () => {},
Expand Down
5 changes: 2 additions & 3 deletions src/components/withNavigationFallback.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {NavigationContext} from '@react-navigation/core';
import getComponentDisplayName from '../libs/getComponentDisplayName';
import refPropTypes from './refPropTypes';

export default function (WrappedComponent) {
class WithNavigationFallback extends Component {
Expand Down Expand Up @@ -36,8 +36,7 @@ export default function (WrappedComponent) {
WithNavigationFallback.contextType = NavigationContext;
WithNavigationFallback.displayName = `WithNavigationFocusWithFallback(${getComponentDisplayName(WrappedComponent)})`;
WithNavigationFallback.propTypes = {
// eslint-disable-next-line react/forbid-prop-types
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]),
forwardedRef: refPropTypes,
};
WithNavigationFallback.defaultProps = {
forwardedRef: undefined,
Expand Down
4 changes: 2 additions & 2 deletions src/components/withNavigationFocus.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import {useIsFocused} from '@react-navigation/native';
import getComponentDisplayName from '../libs/getComponentDisplayName';
import refPropTypes from './refPropTypes';

const withNavigationFocusPropTypes = {
isFocused: PropTypes.bool.isRequired,
Expand All @@ -22,8 +23,7 @@ export default function withNavigationFocus(WrappedComponent) {

WithNavigationFocus.displayName = `withNavigationFocus(${getComponentDisplayName(WrappedComponent)})`;
WithNavigationFocus.propTypes = {
// eslint-disable-next-line react/forbid-prop-types
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]),
forwardedRef: refPropTypes,
};
WithNavigationFocus.defaultProps = {
forwardedRef: undefined,
Expand Down
3 changes: 2 additions & 1 deletion src/components/withToggleVisibilityView.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {View} from 'react-native';
import PropTypes from 'prop-types';
import styles from '../styles/styles';
import getComponentDisplayName from '../libs/getComponentDisplayName';
import refPropTypes from './refPropTypes';

const toggleVisibilityViewPropTypes = {
/** Whether the content is visible. */
Expand All @@ -25,7 +26,7 @@ export default function (WrappedComponent) {

WithToggleVisibilityView.displayName = `WithToggleVisibilityView(${getComponentDisplayName(WrappedComponent)})`;
WithToggleVisibilityView.propTypes = {
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]),
forwardedRef: refPropTypes,

/** Whether the content is visible. */
isVisible: PropTypes.bool,
Expand Down
4 changes: 2 additions & 2 deletions src/components/withViewportOffsetTop.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
import lodashGet from 'lodash/get';
import getComponentDisplayName from '../libs/getComponentDisplayName';
import addViewportResizeListener from '../libs/VisualViewport';
import refPropTypes from './refPropTypes';

const viewportOffsetTopPropTypes = {
// viewportOffsetTop returns the offset of the top edge of the visual viewport from the
Expand Down Expand Up @@ -53,8 +54,7 @@ export default function (WrappedComponent) {

WithViewportOffsetTop.displayName = `WithViewportOffsetTop(${getComponentDisplayName(WrappedComponent)})`;
WithViewportOffsetTop.propTypes = {
// eslint-disable-next-line react/forbid-prop-types
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.any})]),
forwardedRef: refPropTypes,
};
WithViewportOffsetTop.defaultProps = {
forwardedRef: undefined,
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 @@ -12,6 +12,7 @@ import * as DeviceCapabilities from '../../../libs/DeviceCapabilities';
import TextInputWithCurrencySymbol from '../../../components/TextInputWithCurrencySymbol';
import useLocalize from '../../../hooks/useLocalize';
import CONST from '../../../CONST';
import refPropTypes from '../../../components/refPropTypes';

const propTypes = {
/** IOU amount saved in Onyx */
Expand All @@ -24,7 +25,7 @@ const propTypes = {
isEditing: PropTypes.bool,

/** Refs forwarded to the TextInputWithCurrencySymbol */
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]),
forwardedRef: refPropTypes,

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