From 4ed67b84987b241d5cd9a348f0ac148387d5c22f Mon Sep 17 00:00:00 2001 From: Julian Kobrynski Date: Mon, 20 Nov 2023 08:58:27 +0100 Subject: [PATCH 1/2] migrate UnreadActionIndicator.js to TypeScript --- ...nIndicator.js => UnreadActionIndicator.tsx} | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) rename src/components/{UnreadActionIndicator.js => UnreadActionIndicator.tsx} (58%) diff --git a/src/components/UnreadActionIndicator.js b/src/components/UnreadActionIndicator.tsx similarity index 58% rename from src/components/UnreadActionIndicator.js rename to src/components/UnreadActionIndicator.tsx index 7555c93c2326..eea73801781a 100755 --- a/src/components/UnreadActionIndicator.js +++ b/src/components/UnreadActionIndicator.tsx @@ -1,26 +1,30 @@ import React from 'react'; import {View} from 'react-native'; +import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@styles/useThemeStyles'; import CONST from '@src/CONST'; import Text from './Text'; -import withLocalize, {withLocalizePropTypes} from './withLocalize'; -function UnreadActionIndicator(props) { +type UnreadActionIndicatorProps = { + reportActionID: string; +}; + +function UnreadActionIndicator(props: UnreadActionIndicatorProps) { const styles = useThemeStyles(); + const {translate} = useLocalize(); + return ( - {props.translate('common.new')} + {translate('common.new')} ); } -UnreadActionIndicator.propTypes = {...withLocalizePropTypes}; - UnreadActionIndicator.displayName = 'UnreadActionIndicator'; -export default withLocalize(UnreadActionIndicator); +export default UnreadActionIndicator; From c0a947d9762f9233d7c61473050cbc43f6cb8a5f Mon Sep 17 00:00:00 2001 From: Julian Kobrynski Date: Mon, 20 Nov 2023 09:08:19 +0100 Subject: [PATCH 2/2] apply syntax improvements --- src/components/UnreadActionIndicator.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/UnreadActionIndicator.tsx b/src/components/UnreadActionIndicator.tsx index eea73801781a..b34f962e57bd 100755 --- a/src/components/UnreadActionIndicator.tsx +++ b/src/components/UnreadActionIndicator.tsx @@ -9,14 +9,14 @@ type UnreadActionIndicatorProps = { reportActionID: string; }; -function UnreadActionIndicator(props: UnreadActionIndicatorProps) { +function UnreadActionIndicator({reportActionID}: UnreadActionIndicatorProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); return ( @@ -27,4 +27,5 @@ function UnreadActionIndicator(props: UnreadActionIndicatorProps) { } UnreadActionIndicator.displayName = 'UnreadActionIndicator'; + export default UnreadActionIndicator;