diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 16ed1e05dc64..c37e234781ef 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1311,4 +1311,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 845537d35601574adcd0794e17003ba7dbccdbfd -COCOAPODS: 1.12.1 +COCOAPODS: 1.11.3 diff --git a/src/components/AmountTextInput.js b/src/components/AmountTextInput.js index ec5330772cf3..98166cabd944 100644 --- a/src/components/AmountTextInput.js +++ b/src/components/AmountTextInput.js @@ -3,14 +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 */ - // eslint-disable-next-line react/forbid-prop-types - forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]), + forwardedRef: refPropTypes, /** Function to call when amount in text input is changed */ onChangeAmount: PropTypes.func.isRequired, diff --git a/src/components/Attachments/AttachmentCarousel/Pager/index.js b/src/components/Attachments/AttachmentCarousel/Pager/index.js index 636a041cbb83..9779963dfc4a 100644 --- a/src/components/Attachments/AttachmentCarousel/Pager/index.js +++ b/src/components/Attachments/AttachmentCarousel/Pager/index.js @@ -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)); @@ -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, }; diff --git a/src/components/Button/index.js b/src/components/Button/index.js index a850a43d2fb0..bfde528a4750 100644 --- a/src/components/Button/index.js +++ b/src/components/Button/index.js @@ -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 */ @@ -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 = { diff --git a/src/components/Checkbox.js b/src/components/Checkbox.js index 97fec1b2618c..1bb5824f612a 100644 --- a/src/components/Checkbox.js +++ b/src/components/Checkbox.js @@ -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 */ @@ -45,8 +46,7 @@ const propTypes = { caretSize: PropTypes.number, /** A ref to forward to the Pressable */ - // eslint-disable-next-line react/forbid-prop-types - forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]), + forwardedRef: refPropTypes, /** An accessibility label for the checkbox */ accessibilityLabel: PropTypes.string.isRequired, diff --git a/src/components/CountryPicker/index.js b/src/components/CountryPicker/index.js index 417cd79eb4eb..684296d20b11 100644 --- a/src/components/CountryPicker/index.js +++ b/src/components/CountryPicker/index.js @@ -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 */ @@ -19,8 +20,7 @@ const propTypes = { onInputChange: PropTypes.func, /** A ref to forward to MenuItemWithTopDescription */ - // eslint-disable-next-line react/forbid-prop-types - forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]), + forwardedRef: refPropTypes, }; const defaultProps = { diff --git a/src/components/Picker/BasePicker.js b/src/components/Picker/BasePicker.js index 9fe5e3540194..550b8a386aa1 100644 --- a/src/components/Picker/BasePicker.js +++ b/src/components/Picker/BasePicker.js @@ -10,11 +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 */ - // eslint-disable-next-line react/forbid-prop-types - forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]), + forwardedRef: refPropTypes, /** BasePicker label */ label: PropTypes.string, diff --git a/src/components/StatePicker/index.js b/src/components/StatePicker/index.js index 2e41f85c32a2..5f3241181ee0 100644 --- a/src/components/StatePicker/index.js +++ b/src/components/StatePicker/index.js @@ -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 */ @@ -19,8 +20,7 @@ const propTypes = { onInputChange: PropTypes.func, /** A ref to forward to MenuItemWithTopDescription */ - // eslint-disable-next-line react/forbid-prop-types - forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]), + forwardedRef: refPropTypes, /** Label to display on field */ label: PropTypes.string, diff --git a/src/components/TextInputWithCurrencySymbol.js b/src/components/TextInputWithCurrencySymbol.js index f3931a541cfa..72ae373539f0 100644 --- a/src/components/TextInputWithCurrencySymbol.js +++ b/src/components/TextInputWithCurrencySymbol.js @@ -5,11 +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 */ - // eslint-disable-next-line react/forbid-prop-types - forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]), + forwardedRef: refPropTypes, /** Formatted amount in local currency */ formattedAmount: PropTypes.string.isRequired, diff --git a/src/components/TextLink.js b/src/components/TextLink.js index 71b5995255d9..233aaf50644e 100644 --- a/src/components/TextLink.js +++ b/src/components/TextLink.js @@ -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 */ @@ -24,8 +25,7 @@ const propTypes = { onMouseDown: PropTypes.func, /** A ref to forward to text */ - // eslint-disable-next-line react/forbid-prop-types - forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]), + forwardedRef: refPropTypes, }; const defaultProps = { diff --git a/src/components/menuItemPropTypes.js b/src/components/menuItemPropTypes.js index a6424518478c..11d85bcec187 100644 --- a/src/components/menuItemPropTypes.js +++ b/src/components/menuItemPropTypes.js @@ -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. */ @@ -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), diff --git a/src/components/withAnimatedRef.js b/src/components/withAnimatedRef.js index a84806d2cc46..e96fd160dd34 100644 --- a/src/components/withAnimatedRef.js +++ b/src/components/withAnimatedRef.js @@ -2,6 +2,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) { @@ -17,8 +18,7 @@ export default function withAnimatedRef(WrappedComponent) { } WithAnimatedRef.displayName = `withAnimatedRef(${getComponentDisplayName(WrappedComponent)})`; WithAnimatedRef.propTypes = { - // eslint-disable-next-line react/forbid-prop-types - forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]), + forwardedRef: refPropTypes, }; WithAnimatedRef.defaultProps = { forwardedRef: undefined, diff --git a/src/components/withCurrentUserPersonalDetails.js b/src/components/withCurrentUserPersonalDetails.js index dea89fb9a320..87a046e66983 100644 --- a/src/components/withCurrentUserPersonalDetails.js +++ b/src/components/withCurrentUserPersonalDetails.js @@ -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, @@ -15,8 +16,7 @@ const withCurrentUserPersonalDetailsDefaultProps = { export default function (WrappedComponent) { const propTypes = { - // eslint-disable-next-line react/forbid-prop-types - forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]), + forwardedRef: refPropTypes, /** Personal details of all the users, including current user */ personalDetails: PropTypes.objectOf(personalDetailsPropType), diff --git a/src/components/withNavigation.js b/src/components/withNavigation.js index 3ff96b64fef9..ef0f599dc982 100644 --- a/src/components/withNavigation.js +++ b/src/components/withNavigation.js @@ -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, @@ -22,8 +23,7 @@ export default function withNavigation(WrappedComponent) { WithNavigation.displayName = `withNavigation(${getComponentDisplayName(WrappedComponent)})`; WithNavigation.propTypes = { - // eslint-disable-next-line react/forbid-prop-types - forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]), + forwardedRef: refPropTypes, }; WithNavigation.defaultProps = { forwardedRef: () => {}, diff --git a/src/components/withNavigationFallback.js b/src/components/withNavigationFallback.js index 3980ebe01e64..4de9d8f8e43e 100644 --- a/src/components/withNavigationFallback.js +++ b/src/components/withNavigationFallback.js @@ -2,6 +2,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 { @@ -36,8 +37,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, diff --git a/src/components/withNavigationFocus.js b/src/components/withNavigationFocus.js index e15f795832c6..f934f038e311 100644 --- a/src/components/withNavigationFocus.js +++ b/src/components/withNavigationFocus.js @@ -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, @@ -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, diff --git a/src/components/withToggleVisibilityView.js b/src/components/withToggleVisibilityView.js index a7861c44b599..eef5135d02b6 100644 --- a/src/components/withToggleVisibilityView.js +++ b/src/components/withToggleVisibilityView.js @@ -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. */ @@ -25,8 +26,7 @@ export default function (WrappedComponent) { WithToggleVisibilityView.displayName = `WithToggleVisibilityView(${getComponentDisplayName(WrappedComponent)})`; WithToggleVisibilityView.propTypes = { - // eslint-disable-next-line react/forbid-prop-types - forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]), + forwardedRef: refPropTypes, /** Whether the content is visible. */ isVisible: PropTypes.bool, diff --git a/src/components/withViewportOffsetTop.js b/src/components/withViewportOffsetTop.js index 538071a948fa..113c72ed1e1a 100644 --- a/src/components/withViewportOffsetTop.js +++ b/src/components/withViewportOffsetTop.js @@ -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 @@ -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, diff --git a/src/pages/iou/steps/MoneyRequestAmountForm.js b/src/pages/iou/steps/MoneyRequestAmountForm.js index 3fc7b986583d..8aece1c11d7d 100644 --- a/src/pages/iou/steps/MoneyRequestAmountForm.js +++ b/src/pages/iou/steps/MoneyRequestAmountForm.js @@ -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 */ @@ -24,8 +25,7 @@ const propTypes = { isEditing: PropTypes.bool, /** Refs forwarded to the TextInputWithCurrencySymbol */ - // eslint-disable-next-line react/forbid-prop-types - forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.object})]), + forwardedRef: refPropTypes, /** Fired when back button pressed, navigates to currency selection page */ onCurrencyButtonPress: PropTypes.func.isRequired,