From 0f8923795be94449f441f71812404b014fea40c2 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 16 May 2024 09:39:13 +0200 Subject: [PATCH 01/22] Uninstall prop-types --- package-lock.json | 1 - package.json | 1 - 2 files changed, 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4701ff7e7c211..8d3a50bc6c164 100644 --- a/package-lock.json +++ b/package-lock.json @@ -70,7 +70,6 @@ "mapbox-gl": "^2.15.0", "onfido-sdk-ui": "14.15.0", "process": "^0.11.10", - "prop-types": "^15.7.2", "pusher-js": "8.3.0", "react": "18.2.0", "react-beautiful-dnd": "^13.1.1", diff --git a/package.json b/package.json index c2dd1d2d03b1d..9dc49eb6ed284 100644 --- a/package.json +++ b/package.json @@ -122,7 +122,6 @@ "mapbox-gl": "^2.15.0", "onfido-sdk-ui": "14.15.0", "process": "^0.11.10", - "prop-types": "^15.7.2", "pusher-js": "8.3.0", "react": "18.2.0", "react-beautiful-dnd": "^13.1.1", From 97cb5853c00e031702405009a97192c1f737bed3 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 16 May 2024 09:39:28 +0200 Subject: [PATCH 02/22] Remove avatar prop types --- src/components/avatarPropTypes.js | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 src/components/avatarPropTypes.js diff --git a/src/components/avatarPropTypes.js b/src/components/avatarPropTypes.js deleted file mode 100644 index 2fcf34aaa8bd1..0000000000000 --- a/src/components/avatarPropTypes.js +++ /dev/null @@ -1,11 +0,0 @@ -import PropTypes from 'prop-types'; -import CONST from '@src/CONST'; -import sourcePropTypes from './Image/sourcePropTypes'; - -export default PropTypes.shape({ - source: PropTypes.oneOfType([PropTypes.string, sourcePropTypes]), - type: PropTypes.oneOf([CONST.ICON_TYPE_AVATAR, CONST.ICON_TYPE_WORKSPACE]), - name: PropTypes.string, - id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), - fallbackIcon: PropTypes.oneOfType([PropTypes.string, sourcePropTypes]), -}); From fe6801d69e590f24b0ec2810e9c1b2a654658f01 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 16 May 2024 09:40:16 +0200 Subject: [PATCH 03/22] Remove category prop types --- src/components/categoryPropTypes.js | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 src/components/categoryPropTypes.js diff --git a/src/components/categoryPropTypes.js b/src/components/categoryPropTypes.js deleted file mode 100644 index 90c3ac368d1c1..0000000000000 --- a/src/components/categoryPropTypes.js +++ /dev/null @@ -1,9 +0,0 @@ -import PropTypes from 'prop-types'; - -export default PropTypes.shape({ - /** Name of a category */ - name: PropTypes.string.isRequired, - - /** Flag that determines if a category is active and able to be selected */ - enabled: PropTypes.bool.isRequired, -}); From 8811c70975fb55b6051c60c2196f50c26eebe2b4 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 16 May 2024 09:40:23 +0200 Subject: [PATCH 04/22] Remove option prop types --- src/components/optionPropTypes.js | 65 ------------------------------- 1 file changed, 65 deletions(-) delete mode 100644 src/components/optionPropTypes.js diff --git a/src/components/optionPropTypes.js b/src/components/optionPropTypes.js deleted file mode 100644 index 53d8e86b02d6d..0000000000000 --- a/src/components/optionPropTypes.js +++ /dev/null @@ -1,65 +0,0 @@ -import PropTypes from 'prop-types'; -import CONST from '@src/CONST'; -import avatarPropTypes from './avatarPropTypes'; -import participantPropTypes from './participantPropTypes'; - -export default PropTypes.shape({ - // Text to display - text: PropTypes.string, - - /** Display the text of the option in bold font style */ - boldStyle: PropTypes.bool, - - // Alternate text to display - alternateText: PropTypes.string, - - // Alternate text number of lines - alternateTextMaxLines: PropTypes.number, - - // Array of icon information - icons: PropTypes.arrayOf(avatarPropTypes), - - // Login (only present when there is a single participant) - login: PropTypes.string, - - // reportID (only present when there is a matching report) - reportID: PropTypes.string, - - // Key used internally by React - keyForList: PropTypes.string, - - // Search text we use to filter options - searchText: PropTypes.string, - - // Whether the report is pinned or not - isPinned: PropTypes.bool, - - // Whether the report corresponds to a chat room - isChatRoom: PropTypes.bool, - - // Custom icon to render on the right side of the option - customIcon: PropTypes.shape({ - // The icon source - src: PropTypes.func, - - // The color of the icon - color: PropTypes.string, - }), - - // List of participants of the report - participantsList: PropTypes.arrayOf(participantPropTypes), - - // Descriptive text to be displayed besides selection element - descriptiveText: PropTypes.string, - - // The type of option we have e.g. user or report - type: PropTypes.string, - - // Text to show for tooltip - tooltipText: PropTypes.string, - - /** If we need to show a brick road indicator or not */ - brickRoadIndicator: PropTypes.oneOf([CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR, '']), - - phoneNumber: PropTypes.string, -}); From 1dd358c5f988cca7ffea45bbf8cd7655126e7b9a Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 16 May 2024 09:40:31 +0200 Subject: [PATCH 05/22] Remove participant prop types --- src/components/participantPropTypes.js | 28 -------------------------- 1 file changed, 28 deletions(-) delete mode 100644 src/components/participantPropTypes.js diff --git a/src/components/participantPropTypes.js b/src/components/participantPropTypes.js deleted file mode 100644 index d09eb5c783324..0000000000000 --- a/src/components/participantPropTypes.js +++ /dev/null @@ -1,28 +0,0 @@ -import PropTypes from 'prop-types'; -import sourcePropTypes from './Image/sourcePropTypes'; - -export default PropTypes.shape({ - // Primary login of participant - login: PropTypes.string, - - // Account ID of participant - accountID: PropTypes.number, - - // Display Name of participant - displayName: PropTypes.string, - - // Avatar url of participant - avatar: PropTypes.oneOfType([PropTypes.string, sourcePropTypes]), - - /** First Name of the participant */ - firstName: PropTypes.string, - - /** True if the report is a Policy Expense chat */ - isPolicyExpenseChat: PropTypes.bool, - - /** True if the policy expense chat is owned by this user */ - isOwnPolicyExpenseChat: PropTypes.bool, - - /** Whether the participant is selected */ - selected: PropTypes.bool, -}); From 3648983268c6dccfa138f178c540646716fc6408 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 16 May 2024 09:40:38 +0200 Subject: [PATCH 06/22] Remove tag prop types --- src/components/tagPropTypes.js | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 src/components/tagPropTypes.js diff --git a/src/components/tagPropTypes.js b/src/components/tagPropTypes.js deleted file mode 100644 index bb85dc31b9389..0000000000000 --- a/src/components/tagPropTypes.js +++ /dev/null @@ -1,21 +0,0 @@ -import PropTypes from 'prop-types'; - -const tagListPropTypes = PropTypes.shape({ - /** Name of a tag */ - name: PropTypes.string.isRequired, - - /** Flag that determines if a tag is active and able to be selected */ - enabled: PropTypes.bool.isRequired, - - /** "General Ledger code" that corresponds to this tag in an accounting system. Similar to an ID. */ - // eslint-disable-next-line @typescript-eslint/naming-convention - 'GL Code': PropTypes.string, -}); - -export default PropTypes.objectOf( - PropTypes.shape({ - name: PropTypes.string, - required: PropTypes.bool, - tags: PropTypes.objectOf(tagListPropTypes), - }), -); From ab8b38050cca171f52ce1750fe67eab5acdab8c4 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 16 May 2024 09:44:55 +0200 Subject: [PATCH 07/22] Remove source prop types --- src/components/Image/sourcePropTypes/index.js | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 src/components/Image/sourcePropTypes/index.js diff --git a/src/components/Image/sourcePropTypes/index.js b/src/components/Image/sourcePropTypes/index.js deleted file mode 100644 index c5102b240cb1e..0000000000000 --- a/src/components/Image/sourcePropTypes/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import PropTypes from 'prop-types'; - -export default PropTypes.oneOfType([ - PropTypes.func, - PropTypes.elementType, - PropTypes.number, - PropTypes.shape({ - uri: PropTypes.string, - // eslint-disable-next-line react/forbid-prop-types - headers: PropTypes.object, - }), - PropTypes.string, -]); From 765da70a4f5fe01f2e5f09fce993e091013ebf67 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 16 May 2024 09:45:02 +0200 Subject: [PATCH 08/22] Remove source prop types v2 --- src/components/Image/sourcePropTypes/index.native.js | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 src/components/Image/sourcePropTypes/index.native.js diff --git a/src/components/Image/sourcePropTypes/index.native.js b/src/components/Image/sourcePropTypes/index.native.js deleted file mode 100644 index ade2547188796..0000000000000 --- a/src/components/Image/sourcePropTypes/index.native.js +++ /dev/null @@ -1,12 +0,0 @@ -import PropTypes from 'prop-types'; - -export default PropTypes.oneOfType([ - PropTypes.func, - PropTypes.elementType, - PropTypes.number, - PropTypes.shape({ - uri: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired, - // eslint-disable-next-line react/forbid-prop-types - headers: PropTypes.object, - }), -]); From e681719c00bf26be9ad5bae4a87f41b783d0fe3e Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 16 May 2024 09:45:17 +0200 Subject: [PATCH 09/22] Remove reportActionFragment prop types --- .../report/reportActionFragmentPropTypes.js | 32 ------------------- 1 file changed, 32 deletions(-) delete mode 100644 src/pages/home/report/reportActionFragmentPropTypes.js diff --git a/src/pages/home/report/reportActionFragmentPropTypes.js b/src/pages/home/report/reportActionFragmentPropTypes.js deleted file mode 100644 index 5d2e3b951a1de..0000000000000 --- a/src/pages/home/report/reportActionFragmentPropTypes.js +++ /dev/null @@ -1,32 +0,0 @@ -import PropTypes from 'prop-types'; - -export default PropTypes.shape({ - /** The type of the action item fragment. Used to render a corresponding component */ - type: PropTypes.string.isRequired, - - /** The text content of the fragment. */ - text: PropTypes.string.isRequired, - - /** Used to apply additional styling. Style refers to a predetermined constant and not a class name. e.g. 'normal' - * or 'strong' - */ - style: PropTypes.string, - - /** ID of a report */ - reportID: PropTypes.string, - - /** ID of a policy */ - policyID: PropTypes.string, - - /** The target of a link fragment e.g. '_blank' */ - target: PropTypes.string, - - /** The destination of a link fragment e.g. 'https://www.expensify.com' */ - href: PropTypes.string, - - /** An additional avatar url - not the main avatar url but used within a message. */ - iconUrl: PropTypes.string, - - /** Fragment edited flag */ - isEdited: PropTypes.bool, -}); From 575bcc856266b11696a336b990ad5f33bfbe0509 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 16 May 2024 09:45:37 +0200 Subject: [PATCH 10/22] Remove reportAction prop types --- .../home/report/reportActionPropTypes.js | 31 ------------------- 1 file changed, 31 deletions(-) delete mode 100644 src/pages/home/report/reportActionPropTypes.js diff --git a/src/pages/home/report/reportActionPropTypes.js b/src/pages/home/report/reportActionPropTypes.js deleted file mode 100644 index 5f9643571e540..0000000000000 --- a/src/pages/home/report/reportActionPropTypes.js +++ /dev/null @@ -1,31 +0,0 @@ -import PropTypes from 'prop-types'; -import reportActionFragmentPropTypes from './reportActionFragmentPropTypes'; - -export default { - /** The ID of the reportAction. It is the string representation of the a 64-bit integer. */ - reportActionID: PropTypes.string, - - /** Name of the action e.g. ADD_COMMENT */ - actionName: PropTypes.string, - - /** Person who created the action */ - person: PropTypes.arrayOf(reportActionFragmentPropTypes), - - /** ISO-formatted datetime */ - created: PropTypes.string, - - /** report action message */ - message: PropTypes.arrayOf(reportActionFragmentPropTypes), - - /** Original message associated with this action */ - originalMessage: PropTypes.shape({ - // The ID of the iou transaction - IOUTransactionID: PropTypes.string, - - /** accountIDs of the people to which the whisper was sent to (if any). Returns empty array if it is not a whisper */ - whisperedTo: PropTypes.arrayOf(PropTypes.number), - }), - - /** Error message that's come back from the server. */ - error: PropTypes.string, -}; From e0367cb607fe3f9aeba922a2c5956b0c052990f9 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 16 May 2024 09:45:49 +0200 Subject: [PATCH 11/22] Remove style prop types --- src/styles/stylePropTypes.js | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 src/styles/stylePropTypes.js diff --git a/src/styles/stylePropTypes.js b/src/styles/stylePropTypes.js deleted file mode 100644 index b82db94140eed..0000000000000 --- a/src/styles/stylePropTypes.js +++ /dev/null @@ -1,5 +0,0 @@ -import PropTypes from 'prop-types'; - -const stylePropTypes = PropTypes.oneOfType([PropTypes.object, PropTypes.bool, PropTypes.arrayOf(PropTypes.object), PropTypes.func]); - -export default stylePropTypes; From 09a3b7edf2301eade0c14e0e55ad69da1401f9ed Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 16 May 2024 09:46:05 +0200 Subject: [PATCH 12/22] Remove violations prop types --- src/libs/Violations/propTypes.ts | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 src/libs/Violations/propTypes.ts diff --git a/src/libs/Violations/propTypes.ts b/src/libs/Violations/propTypes.ts deleted file mode 100644 index 4b5e84405cba4..0000000000000 --- a/src/libs/Violations/propTypes.ts +++ /dev/null @@ -1,32 +0,0 @@ -import PropTypes from 'prop-types'; -import CONST from '@src/CONST'; - -const violationNames = Object.values(CONST.VIOLATIONS); - -const transactionViolationPropType = PropTypes.shape({ - type: PropTypes.string.isRequired, - name: PropTypes.oneOf(violationNames).isRequired, - data: PropTypes.shape({ - rejectedBy: PropTypes.string, - rejectReason: PropTypes.string, - amount: PropTypes.string, - surcharge: PropTypes.number, - invoiceMarkup: PropTypes.number, - maxAge: PropTypes.number, - tagName: PropTypes.string, - formattedLimitAmount: PropTypes.string, - categoryLimit: PropTypes.string, - limit: PropTypes.string, - category: PropTypes.string, - brokenBankConnection: PropTypes.bool, - isAdmin: PropTypes.bool, - email: PropTypes.string, - isTransactionOlderThan7Days: PropTypes.bool, - member: PropTypes.string, - taxName: PropTypes.string, - }), -}); - -const transactionViolationsPropType = PropTypes.objectOf(PropTypes.arrayOf(transactionViolationPropType)); - -export {transactionViolationsPropType, transactionViolationPropType}; From e193cb50a1f5aea31db18dcfcbe0c73a4d6fbc05 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 16 May 2024 09:46:28 +0200 Subject: [PATCH 13/22] Remove translatableText prop types --- src/libs/Localize/index.ts | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/libs/Localize/index.ts b/src/libs/Localize/index.ts index 39a8741990042..47f91fcfb31bd 100644 --- a/src/libs/Localize/index.ts +++ b/src/libs/Localize/index.ts @@ -1,4 +1,3 @@ -import PropTypes from 'prop-types'; import * as RNLocalize from 'react-native-localize'; import Onyx from 'react-native-onyx'; import type {ValueOf} from 'type-fest'; @@ -176,14 +175,6 @@ function translateLocal(phrase: TKey, ...variable return translate(BaseLocaleListener.getPreferredLocale(), phrase, ...variables); } -/** - * Traslatable text with phrase key and/or variables - * Use MaybePhraseKey for Typescript - * - * E.g. ['common.error.characterLimitExceedCounter', {length: 5, limit: 20}] - */ -const translatableTextPropTypes = PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.object]))]); - type MaybePhraseKey = string | null | [string, Record & {isTranslated?: boolean}] | []; /** @@ -263,5 +254,5 @@ function getDevicePreferredLocale(): Locale { return RNLocalize.findBestAvailableLanguage([CONST.LOCALES.EN, CONST.LOCALES.ES])?.languageTag ?? CONST.LOCALES.DEFAULT; } -export {translatableTextPropTypes, translate, translateLocal, translateIfPhraseKey, formatList, formatMessageElementList, getDevicePreferredLocale}; +export {translate, translateLocal, translateIfPhraseKey, formatList, formatMessageElementList, getDevicePreferredLocale}; export type {PhraseParameters, Phrase, MaybePhraseKey}; From 4b30f9bc13451a45e1d5ad52b7e295c37c45ec5c Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 16 May 2024 09:46:42 +0200 Subject: [PATCH 14/22] Remove tax prop types --- src/pages/workspace/withPolicy.tsx | 97 +----------------------------- 1 file changed, 1 insertion(+), 96 deletions(-) diff --git a/src/pages/workspace/withPolicy.tsx b/src/pages/workspace/withPolicy.tsx index 23d19f4584901..7c9af4bdd2fb0 100644 --- a/src/pages/workspace/withPolicy.tsx +++ b/src/pages/workspace/withPolicy.tsx @@ -1,11 +1,9 @@ import type {RouteProp} from '@react-navigation/native'; import {useNavigationState} from '@react-navigation/native'; -import PropTypes from 'prop-types'; import type {ComponentType, ForwardedRef, RefAttributes} from 'react'; import React, {forwardRef} from 'react'; import type {OnyxEntry} from 'react-native-onyx'; import {withOnyx} from 'react-native-onyx'; -import {translatableTextPropTypes} from '@libs/Localize'; import type { BottomTabNavigatorParamList, CentralPaneNavigatorParamList, @@ -14,7 +12,6 @@ import type { SettingsNavigatorParamList, } from '@navigation/types'; import * as Policy from '@userActions/Policy'; -import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type SCREENS from '@src/SCREENS'; import type * as OnyxTypes from '@src/types/onyx'; @@ -48,98 +45,6 @@ function getPolicyIDFromRoute(route: PolicyRoute): string { return route?.params?.policyID ?? ''; } -const taxPropTypes = PropTypes.shape({ - /** Name of a tax */ - name: PropTypes.string, - - /** The value of a tax */ - value: PropTypes.string, - - /** Whether the tax is disabled */ - isDisabled: PropTypes.bool, -}); - -const taxRatesPropTypes = PropTypes.shape({ - /** Name of the tax */ - name: PropTypes.string, - - /** Default policy tax ID */ - defaultExternalID: PropTypes.string, - - /** Default value of taxes */ - defaultValue: PropTypes.string, - - /** Default foreign policy tax ID */ - foreignTaxDefault: PropTypes.string, - - /** List of tax names and values */ - taxes: PropTypes.objectOf(taxPropTypes), -}); - -const policyPropTypes = { - /** The policy object for the current route */ - policy: PropTypes.shape({ - /** The ID of the policy */ - id: PropTypes.string, - - /** The name of the policy */ - name: PropTypes.string, - - /** The current user's role in the policy */ - role: PropTypes.oneOf(Object.values(CONST.POLICY.ROLE)), - - /** The policy type */ - type: PropTypes.oneOf(Object.values(CONST.POLICY.TYPE)), - - /** The email of the policy owner */ - owner: PropTypes.string, - - /** The output currency for the policy */ - outputCurrency: PropTypes.string, - - /** The URL for the policy avatar */ - avatar: PropTypes.string, - - /** Errors on the policy keyed by microtime */ - errors: PropTypes.objectOf(PropTypes.string), - - /** - * Error objects keyed by field name containing errors keyed by microtime - * E.x - * { - * name: { - * [DateUtils.getMicroseconds()]: 'Sorry, there was an unexpected problem updating your workspace name.', - * } - * } - */ - errorFields: PropTypes.objectOf(PropTypes.objectOf(translatableTextPropTypes)), - - /** Whether or not the policy requires tags */ - requiresTag: PropTypes.bool, - - /** Whether or not the policy requires categories */ - requiresCategory: PropTypes.bool, - - /** Whether or not the policy has multiple tag lists */ - hasMultipleTagLists: PropTypes.bool, - - /** - * Whether or not the policy has tax tracking enabled - * - * @deprecated - use tax.trackingEnabled instead - */ - isTaxTrackingEnabled: PropTypes.bool, - - /** Whether or not the policy has tax tracking enabled */ - tax: PropTypes.shape({ - trackingEnabled: PropTypes.bool, - }), - - /** Collection of tax rates attached to a policy */ - taxRates: taxRatesPropTypes, - }), -}; - type WithPolicyOnyxProps = { policy: OnyxEntry; policyDraft: OnyxEntry; @@ -188,5 +93,5 @@ export default function (WrappedComponent: })(forwardRef(WithPolicy)); } -export {policyDefaultProps, policyPropTypes}; +export {policyDefaultProps}; export type {PolicyRoute, WithPolicyOnyxProps, WithPolicyProps}; From ab59bcf6d28cf772dba4592859ad8f51db34914e Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 16 May 2024 09:46:57 +0200 Subject: [PATCH 15/22] Remove withCurrentReportID prop types --- src/components/withCurrentReportID.tsx | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/components/withCurrentReportID.tsx b/src/components/withCurrentReportID.tsx index a720639132830..1d62d92fc8f9a 100644 --- a/src/components/withCurrentReportID.tsx +++ b/src/components/withCurrentReportID.tsx @@ -1,5 +1,4 @@ import type {NavigationState} from '@react-navigation/native'; -import PropTypes from 'prop-types'; import type {ComponentType, ForwardedRef, RefAttributes} from 'react'; import React, {createContext, forwardRef, useCallback, useMemo, useState} from 'react'; import getComponentDisplayName from '@libs/getComponentDisplayName'; @@ -17,15 +16,6 @@ type CurrentReportIDContextProviderProps = { const CurrentReportIDContext = createContext(null); -// TODO: Remove when depended components are migrated to TypeScript. -const withCurrentReportIDPropTypes = { - /** Function to update the state */ - updateCurrentReportID: PropTypes.func.isRequired, - - /** The top most report id */ - currentReportID: PropTypes.string, -}; - const withCurrentReportIDDefaultProps = { currentReportID: '', }; @@ -95,5 +85,5 @@ export default function withCurrentReportID Date: Thu, 16 May 2024 09:47:15 +0200 Subject: [PATCH 16/22] Remove withCurrentReportID prop types --- src/components/withKeyboardState.tsx | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/components/withKeyboardState.tsx b/src/components/withKeyboardState.tsx index 560576fdbf5c2..72540ebceaa86 100755 --- a/src/components/withKeyboardState.tsx +++ b/src/components/withKeyboardState.tsx @@ -1,4 +1,3 @@ -import PropTypes from 'prop-types'; import type {ComponentType, ForwardedRef, ReactElement, RefAttributes} from 'react'; import React, {createContext, forwardRef, useEffect, useMemo, useState} from 'react'; import {Keyboard} from 'react-native'; @@ -13,15 +12,6 @@ type KeyboardStateContextValue = { keyboardHeight: number; }; -// TODO: Remove - left for backwards compatibility with existing components (https://github.com/Expensify/App/issues/25151) -const keyboardStatePropTypes = { - /** Whether the keyboard is open */ - isKeyboardShown: PropTypes.bool.isRequired, - - /** Height of the keyboard in pixels */ - keyboardHeight: PropTypes.number.isRequired, -}; - const KeyboardStateContext = createContext({ isKeyboardShown: false, keyboardHeight: 0, @@ -76,4 +66,5 @@ export default function withKeyboardState Date: Thu, 16 May 2024 09:47:27 +0200 Subject: [PATCH 17/22] Remove withLocalize prop types --- src/components/withLocalize.tsx | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/src/components/withLocalize.tsx b/src/components/withLocalize.tsx index f198ed9156e11..f6abcf2d9fb05 100755 --- a/src/components/withLocalize.tsx +++ b/src/components/withLocalize.tsx @@ -1,37 +1,9 @@ -import PropTypes from 'prop-types'; import type {ComponentType, ForwardedRef, ReactElement, RefAttributes} from 'react'; import React, {forwardRef} from 'react'; import getComponentDisplayName from '@libs/getComponentDisplayName'; import type {LocaleContextProps} from './LocaleContextProvider'; import {LocaleContext} from './LocaleContextProvider'; -const withLocalizePropTypes = { - /** Returns translated string for given locale and phrase */ - translate: PropTypes.func.isRequired, - - /** Formats number formatted according to locale and options */ - numberFormat: PropTypes.func.isRequired, - - /** Converts a datetime into a localized string representation that's relative to current moment in time */ - datetimeToRelative: PropTypes.func.isRequired, - - /** Formats a datetime to local date and time string */ - datetimeToCalendarTime: PropTypes.func.isRequired, - - /** Updates date-fns internal locale */ - updateLocale: PropTypes.func.isRequired, - - /** Returns a locally converted phone number for numbers from the same region - * and an internationally converted phone number with the country code for numbers from other regions */ - formatPhoneNumber: PropTypes.func.isRequired, - - /** Gets the standard digit corresponding to a locale digit */ - fromLocaleDigit: PropTypes.func.isRequired, - - /** Gets the locale digit corresponding to a standard digit */ - toLocaleDigit: PropTypes.func.isRequired, -}; - type WithLocalizeProps = LocaleContextProps; export default function withLocalize( @@ -57,5 +29,4 @@ export default function withLocalize( return forwardRef(WithLocalize); } -export {withLocalizePropTypes}; export type {WithLocalizeProps}; From 3570da0aae55f99b3cca25b557c32ca1e8693054 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 16 May 2024 09:47:37 +0200 Subject: [PATCH 18/22] Remove withStyleUtils prop types --- src/components/withStyleUtils.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/components/withStyleUtils.tsx b/src/components/withStyleUtils.tsx index 881aa9cbe4aec..82511d0f66ded 100644 --- a/src/components/withStyleUtils.tsx +++ b/src/components/withStyleUtils.tsx @@ -1,13 +1,9 @@ -import PropTypes from 'prop-types'; import type {ComponentType, ForwardedRef, ReactElement, RefAttributes} from 'react'; import React, {forwardRef} from 'react'; import useStyleUtils from '@hooks/useStyleUtils'; import getComponentDisplayName from '@libs/getComponentDisplayName'; import type {StyleUtilsType} from '@styles/utils'; -const withStyleUtilsPropTypes = { - StyleUtils: PropTypes.object.isRequired, -}; type WithStyleUtilsProps = {StyleUtils: StyleUtilsType}; export default function withStyleUtils( @@ -30,4 +26,4 @@ export default function withStyleUtils return forwardRef(WithStyleUtils); } -export {withStyleUtilsPropTypes, type WithStyleUtilsProps}; +export type {WithStyleUtilsProps}; From 903ce9dff35d3fb762cbb6846529e7814954b9e8 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 16 May 2024 09:47:50 +0200 Subject: [PATCH 19/22] Remove withTheme prop types --- src/components/withTheme.tsx | 5 ----- src/components/withThemeStyles.tsx | 5 ----- 2 files changed, 10 deletions(-) diff --git a/src/components/withTheme.tsx b/src/components/withTheme.tsx index b9b81d6daac27..21aaa96fd1c14 100644 --- a/src/components/withTheme.tsx +++ b/src/components/withTheme.tsx @@ -1,13 +1,9 @@ -import PropTypes from 'prop-types'; import type {ComponentType, ForwardedRef, ReactElement, RefAttributes} from 'react'; import React, {forwardRef} from 'react'; import useTheme from '@hooks/useTheme'; import getComponentDisplayName from '@libs/getComponentDisplayName'; import type {ThemeColors} from '@styles/theme/types'; -const withThemePropTypes = { - theme: PropTypes.object.isRequired, -}; type WithThemeProps = {theme: ThemeColors}; export default function withTheme( @@ -30,5 +26,4 @@ export default function withTheme( return forwardRef(WithTheme); } -export {withThemePropTypes}; export type {WithThemeProps}; diff --git a/src/components/withThemeStyles.tsx b/src/components/withThemeStyles.tsx index be1f26fd966c5..8391a58eaffd4 100644 --- a/src/components/withThemeStyles.tsx +++ b/src/components/withThemeStyles.tsx @@ -1,13 +1,9 @@ -import PropTypes from 'prop-types'; import type {ComponentType, ForwardedRef, ReactElement, RefAttributes} from 'react'; import React, {forwardRef} from 'react'; import useThemeStyles from '@hooks/useThemeStyles'; import getComponentDisplayName from '@libs/getComponentDisplayName'; import type {ThemeStyles} from '@styles/index'; -const withThemeStylesPropTypes = { - themeStyles: PropTypes.object.isRequired, -}; type WithThemeStylesProps = {themeStyles: ThemeStyles}; export default function withThemeStyles( @@ -30,5 +26,4 @@ export default function withThemeStyles Date: Thu, 16 May 2024 09:48:11 +0200 Subject: [PATCH 20/22] Clean JSDoc comment --- src/components/Tooltip/BaseTooltip/index.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/components/Tooltip/BaseTooltip/index.tsx b/src/components/Tooltip/BaseTooltip/index.tsx index 5f6c38d19bff6..ca0315f68aa1d 100644 --- a/src/components/Tooltip/BaseTooltip/index.tsx +++ b/src/components/Tooltip/BaseTooltip/index.tsx @@ -20,8 +20,6 @@ const hasHoverSupport = DeviceCapabilities.hasHoverSupport(); /** * A component used to wrap an element intended for displaying a tooltip. The term "tooltip's target" refers to the * wrapped element, which, upon hover, triggers the tooltip to be shown. - * @param {propTypes} props - * @returns {ReactNodeLike} */ /** @@ -30,10 +28,10 @@ const hasHoverSupport = DeviceCapabilities.hasHoverSupport(); * so we need to find the correct part (the one that the user is hovering * over) and show the tooltip there. * - * @param {Element} target The DOM element being hovered over. - * @param {number} clientX The X position from the MouseEvent. - * @param {number} clientY The Y position from the MouseEvent. - * @return {DOMRect} The chosen bounding box. + * @param target The DOM element being hovered over. + * @param clientX The X position from the MouseEvent. + * @param clientY The Y position from the MouseEvent. + * @return The chosen bounding box. */ function chooseBoundingBox(target: HTMLElement, clientX: number, clientY: number): DOMRect { From ec29401b28a44f6ab20b349f149510dc095ee410 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 16 May 2024 09:48:24 +0200 Subject: [PATCH 21/22] Remove windowDimensions prop types --- .../withWindowDimensions/index.native.tsx | 22 +------------------ src/components/withWindowDimensions/index.tsx | 22 +------------------ 2 files changed, 2 insertions(+), 42 deletions(-) diff --git a/src/components/withWindowDimensions/index.native.tsx b/src/components/withWindowDimensions/index.native.tsx index 073c1f22575b9..1cfffeb63d436 100644 --- a/src/components/withWindowDimensions/index.native.tsx +++ b/src/components/withWindowDimensions/index.native.tsx @@ -1,4 +1,3 @@ -import PropTypes from 'prop-types'; import type {ComponentType, ForwardedRef, RefAttributes} from 'react'; import React, {createContext, useEffect, useMemo, useState} from 'react'; import {Dimensions} from 'react-native'; @@ -10,25 +9,6 @@ import type ChildrenProps from '@src/types/utils/ChildrenProps'; import type {NewDimensions, WindowDimensionsContextData, WindowDimensionsProps} from './types'; const WindowDimensionsContext = createContext(null); -const windowDimensionsPropTypes = { - // Width of the window - windowWidth: PropTypes.number.isRequired, - - // Height of the window - windowHeight: PropTypes.number.isRequired, - - // Is the window width extra narrow, like on a Fold mobile device? - isExtraSmallScreenWidth: PropTypes.bool.isRequired, - - // Is the window width narrow, like on a mobile device? - isSmallScreenWidth: PropTypes.bool.isRequired, - - // Is the window width medium sized, like on a tablet device? - isMediumScreenWidth: PropTypes.bool.isRequired, - - // Is the window width wide, like on a browser or desktop? - isLargeScreenWidth: PropTypes.bool.isRequired, -}; function WindowDimensionsProvider(props: ChildrenProps) { const [windowDimension, setWindowDimension] = useState(() => { @@ -98,4 +78,4 @@ export default function withWindowDimensions(null); -const windowDimensionsPropTypes = { - // Width of the window - windowWidth: PropTypes.number.isRequired, - - // Height of the window - windowHeight: PropTypes.number.isRequired, - - // Is the window width extra narrow, like on a Fold mobile device? - isExtraSmallScreenWidth: PropTypes.bool.isRequired, - - // Is the window width narrow, like on a mobile device? - isSmallScreenWidth: PropTypes.bool.isRequired, - - // Is the window width medium sized, like on a tablet device? - isMediumScreenWidth: PropTypes.bool.isRequired, - - // Is the window width wide, like on a browser or desktop? - isLargeScreenWidth: PropTypes.bool.isRequired, -}; function WindowDimensionsProvider(props: ChildrenProps) { const [windowDimension, setWindowDimension] = useState(() => { @@ -104,4 +84,4 @@ export default function withWindowDimensions Date: Mon, 27 May 2024 11:11:07 +0200 Subject: [PATCH 22/22] Run npm i --- package-lock.json | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9abb6c5f68066..a968bb2a65339 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1851,19 +1851,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-object-assign": { - "version": "7.18.6", - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, "node_modules/@babel/plugin-transform-object-rest-spread": { "version": "7.24.1", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.24.1.tgz",