From b557ccf2ce7369a3b0f5d71a95724779efcd041a Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Thu, 18 Jan 2024 13:35:40 -0800 Subject: [PATCH 001/110] remove shouldAllowActionableMentionWhispers unused param --- src/libs/actions/Report.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index 2ac85dfafa27..402fc939dc86 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -350,7 +350,6 @@ function addActions(reportID: string, text = '', file?: File) { reportComment?: string; file?: File; timezone?: string; - shouldAllowActionableMentionWhispers?: boolean; clientCreatedTime?: string; isOldDotConciergeChat?: boolean; }; @@ -361,7 +360,6 @@ function addActions(reportID: string, text = '', file?: File) { commentReportActionID: file && reportCommentAction ? reportCommentAction.reportActionID : null, reportComment: reportCommentText, file, - shouldAllowActionableMentionWhispers: true, clientCreatedTime: file ? attachmentAction?.created : reportCommentAction?.created, }; From 1e2a42d6650617a813e1909b37e86279c6675cc1 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Thu, 1 Feb 2024 14:08:09 +0100 Subject: [PATCH 002/110] Migrate FloatingMessageCounter to TypeScript --- ...loatingMessageCounterContainerPropTypes.js | 11 -------- .../{index.android.js => index.android.tsx} | 10 +++---- .../FloatingMessageCounterContainer/index.js | 21 --------------- .../FloatingMessageCounterContainer/index.tsx | 21 +++++++++++++++ .../FloatingMessageCounterContainer/types.ts | 12 +++++++++ .../{index.js => index.tsx} | 27 +++++++------------ 6 files changed, 47 insertions(+), 55 deletions(-) delete mode 100644 src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/floatingMessageCounterContainerPropTypes.js rename src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/{index.android.js => index.android.tsx} (60%) delete mode 100644 src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/index.js create mode 100644 src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/index.tsx create mode 100644 src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/types.ts rename src/pages/home/report/FloatingMessageCounter/{index.js => index.tsx} (83%) diff --git a/src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/floatingMessageCounterContainerPropTypes.js b/src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/floatingMessageCounterContainerPropTypes.js deleted file mode 100644 index af0f22208457..000000000000 --- a/src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/floatingMessageCounterContainerPropTypes.js +++ /dev/null @@ -1,11 +0,0 @@ -import PropTypes from 'prop-types'; - -const propTypes = { - /** Styles to be assigned to Container */ - containerStyles: PropTypes.arrayOf(PropTypes.object).isRequired, - - /** Rendered child component */ - children: PropTypes.element.isRequired, -}; - -export default propTypes; diff --git a/src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/index.android.js b/src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/index.android.tsx similarity index 60% rename from src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/index.android.js rename to src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/index.android.tsx index 700a2fb399e4..64391909b197 100644 --- a/src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/index.android.js +++ b/src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/index.android.tsx @@ -1,18 +1,18 @@ import React from 'react'; import {Animated, View} from 'react-native'; import useThemeStyles from '@hooks/useThemeStyles'; -import floatingMessageCounterContainerPropTypes from './floatingMessageCounterContainerPropTypes'; +import type FloatingMessageCounterContainerProps from './types'; -function FloatingMessageCounterContainer(props) { +function FloatingMessageCounterContainer({containerStyles, children}: FloatingMessageCounterContainerProps) { const styles = useThemeStyles(); + return ( - - {props.children} + + {children} ); } -FloatingMessageCounterContainer.propTypes = floatingMessageCounterContainerPropTypes; FloatingMessageCounterContainer.displayName = 'FloatingMessageCounterContainer'; export default FloatingMessageCounterContainer; diff --git a/src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/index.js b/src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/index.js deleted file mode 100644 index 19123e65cbf2..000000000000 --- a/src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/index.js +++ /dev/null @@ -1,21 +0,0 @@ -import React from 'react'; -import {Animated} from 'react-native'; -import useThemeStyles from '@hooks/useThemeStyles'; -import floatingMessageCounterContainerPropTypes from './floatingMessageCounterContainerPropTypes'; - -function FloatingMessageCounterContainer(props) { - const styles = useThemeStyles(); - return ( - - {props.children} - - ); -} - -FloatingMessageCounterContainer.propTypes = floatingMessageCounterContainerPropTypes; -FloatingMessageCounterContainer.displayName = 'FloatingMessageCounterContainer'; - -export default FloatingMessageCounterContainer; diff --git a/src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/index.tsx b/src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/index.tsx new file mode 100644 index 000000000000..8757d66160c4 --- /dev/null +++ b/src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/index.tsx @@ -0,0 +1,21 @@ +import React from 'react'; +import {Animated} from 'react-native'; +import useThemeStyles from '@hooks/useThemeStyles'; +import type FloatingMessageCounterContainerProps from './types'; + +function FloatingMessageCounterContainer({accessibilityHint, containerStyles, children}: FloatingMessageCounterContainerProps) { + const styles = useThemeStyles(); + + return ( + + {children} + + ); +} + +FloatingMessageCounterContainer.displayName = 'FloatingMessageCounterContainer'; + +export default FloatingMessageCounterContainer; diff --git a/src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/types.ts b/src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/types.ts new file mode 100644 index 000000000000..96aae0b6d4e7 --- /dev/null +++ b/src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/types.ts @@ -0,0 +1,12 @@ +import type {StyleProp, ViewStyle} from 'react-native'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; + +type FloatingMessageCounterContainerProps = ChildrenProps & { + /** Styles to be assigned to Container */ + containerStyles: StyleProp; + + /** Specifies the accessibility hint for the component */ + accessibilityHint?: string; +}; + +export default FloatingMessageCounterContainerProps; diff --git a/src/pages/home/report/FloatingMessageCounter/index.js b/src/pages/home/report/FloatingMessageCounter/index.tsx similarity index 83% rename from src/pages/home/report/FloatingMessageCounter/index.js rename to src/pages/home/report/FloatingMessageCounter/index.tsx index 07138104bf74..d3048848936d 100644 --- a/src/pages/home/report/FloatingMessageCounter/index.js +++ b/src/pages/home/report/FloatingMessageCounter/index.tsx @@ -1,4 +1,3 @@ -import PropTypes from 'prop-types'; import React, {useCallback, useEffect, useMemo} from 'react'; import {Animated, View} from 'react-native'; import Button from '@components/Button'; @@ -12,23 +11,18 @@ import useNativeDriver from '@libs/useNativeDriver'; import CONST from '@src/CONST'; import FloatingMessageCounterContainer from './FloatingMessageCounterContainer'; -const propTypes = { +type FloatingMessageCounterProps = { /** Whether the New Messages indicator is active */ - isActive: PropTypes.bool, + isActive?: boolean; /** Callback to be called when user clicks the New Messages indicator */ - onClick: PropTypes.func, -}; - -const defaultProps = { - isActive: false, - onClick: () => {}, + onClick?: () => void; }; const MARKER_INACTIVE_TRANSLATE_Y = -40; const MARKER_ACTIVE_TRANSLATE_Y = 10; -function FloatingMessageCounter(props) { +function FloatingMessageCounter({isActive = false, onClick = () => {}}: FloatingMessageCounterProps) { const theme = useTheme(); const styles = useThemeStyles(); const {translate} = useLocalize(); @@ -37,7 +31,6 @@ function FloatingMessageCounter(props) { const show = useCallback(() => { Animated.spring(translateY, { toValue: MARKER_ACTIVE_TRANSLATE_Y, - duration: 80, useNativeDriver, }).start(); }, [translateY]); @@ -45,30 +38,29 @@ function FloatingMessageCounter(props) { const hide = useCallback(() => { Animated.spring(translateY, { toValue: MARKER_INACTIVE_TRANSLATE_Y, - duration: 80, useNativeDriver, }).start(); }, [translateY]); useEffect(() => { - if (props.isActive) { + if (isActive) { show(); } else { hide(); } - }, [props.isActive, show, hide]); + }, [isActive, show, hide]); return (