From cfd7a8b5de5c63f058364e9dfc6811c5def6401b Mon Sep 17 00:00:00 2001 From: Brandon Henry Date: Tue, 26 Mar 2024 21:10:53 -0500 Subject: [PATCH 1/6] added new styling for headermessage --- src/components/SelectionList/BaseSelectionList.tsx | 3 ++- src/components/SelectionList/types.ts | 3 +++ src/pages/SearchPage/index.tsx | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/SelectionList/BaseSelectionList.tsx b/src/components/SelectionList/BaseSelectionList.tsx index 015fd284c0b4b..6e31f84b24eda 100644 --- a/src/components/SelectionList/BaseSelectionList.tsx +++ b/src/components/SelectionList/BaseSelectionList.tsx @@ -69,6 +69,7 @@ function BaseSelectionList( listHeaderWrapperStyle, isRowMultilineSupported = false, textInputRef, + headerMessageStyle = [styles.ph5, styles.pb5] }: BaseSelectionListProps, ref: ForwardedRef, ) { @@ -514,7 +515,7 @@ function BaseSelectionList( )} {!!headerMessage && ( - + {headerMessage} )} diff --git a/src/components/SelectionList/types.ts b/src/components/SelectionList/types.ts index 8b070e1aa5cb8..9a2cbdd4c13c1 100644 --- a/src/components/SelectionList/types.ts +++ b/src/components/SelectionList/types.ts @@ -229,6 +229,9 @@ type BaseSelectionListProps = Partial & { /** Message to display at the top of the list */ headerMessage?: string; + /** Styles to apply to the header message */ + headerMessageStyle?: StyleProp; + /** Text to display on the confirm button */ confirmButtonText?: string; diff --git a/src/pages/SearchPage/index.tsx b/src/pages/SearchPage/index.tsx index 07096ce6c2d5f..f535bb0149433 100644 --- a/src/pages/SearchPage/index.tsx +++ b/src/pages/SearchPage/index.tsx @@ -168,6 +168,7 @@ function SearchPage({betas, reports, isSearchingForReports, navigation}: SearchP textInputHint={offlineMessage} onChangeText={setSearchValue} headerMessage={headerMessage} + headerMessageStyle={headerMessage === translate('common.noResultsFound') ? [themeStyles.ph4, themeStyles.pb5] : undefined} onLayout={setPerformanceTimersEnd} autoFocus onSelectRow={selectReport} From e35a60588d9cfd580343e7727c14707051beb786 Mon Sep 17 00:00:00 2001 From: Brandon Henry Date: Mon, 29 Apr 2024 10:30:27 -0500 Subject: [PATCH 2/6] quick fix --- src/components/SelectionList/BaseSelectionList.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/SelectionList/BaseSelectionList.tsx b/src/components/SelectionList/BaseSelectionList.tsx index cec5e0c12948a..bdb4a0b967f50 100644 --- a/src/components/SelectionList/BaseSelectionList.tsx +++ b/src/components/SelectionList/BaseSelectionList.tsx @@ -556,7 +556,7 @@ function BaseSelectionList( {/* If we are loading new options we will avoid showing any header message. This is mostly because one of the header messages says there are no options. */} {/* This is misleading because we might be in the process of loading fresh options from the server. */} {!isLoadingNewOptions && !!headerMessage && ( - + {headerMessage} )} From 1df02e4d414759019f863ae539046c57ec02fbea Mon Sep 17 00:00:00 2001 From: Brandon Henry Date: Mon, 29 Apr 2024 12:34:58 -0500 Subject: [PATCH 3/6] change padding of text input --- src/components/SelectionList/BaseSelectionList.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/SelectionList/BaseSelectionList.tsx b/src/components/SelectionList/BaseSelectionList.tsx index bdb4a0b967f50..3f73193c467fa 100644 --- a/src/components/SelectionList/BaseSelectionList.tsx +++ b/src/components/SelectionList/BaseSelectionList.tsx @@ -516,7 +516,7 @@ function BaseSelectionList( {({safeAreaPaddingBottomStyle}) => ( {shouldShowTextInput && ( - + { innerTextInputRef.current = element as RNTextInput; @@ -556,7 +556,7 @@ function BaseSelectionList( {/* If we are loading new options we will avoid showing any header message. This is mostly because one of the header messages says there are no options. */} {/* This is misleading because we might be in the process of loading fresh options from the server. */} {!isLoadingNewOptions && !!headerMessage && ( - + {headerMessage} )} From f8199f36b7abf3df20422bcef3324ce17cf9a7cf Mon Sep 17 00:00:00 2001 From: Brandon Henry Date: Mon, 29 Apr 2024 17:05:04 -0500 Subject: [PATCH 4/6] fix for list title padding up to 20px --- src/components/SelectionList/BaseSelectionList.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/SelectionList/BaseSelectionList.tsx b/src/components/SelectionList/BaseSelectionList.tsx index 3f73193c467fa..f27a906dfa910 100644 --- a/src/components/SelectionList/BaseSelectionList.tsx +++ b/src/components/SelectionList/BaseSelectionList.tsx @@ -330,7 +330,7 @@ function BaseSelectionList( // we need to know the heights of all list items up-front in order to synchronously compute the layout of any given list item. // So be aware that if you adjust the content of the section header (for example, change the font size), you may need to adjust this explicit height as well. - {section.title} + {section.title} ); }; From dd7c67913409993549e625a1e8cbb4f68956ec1e Mon Sep 17 00:00:00 2001 From: Brandon Henry Date: Tue, 30 Apr 2024 12:10:43 -0500 Subject: [PATCH 5/6] revert original fix --- src/pages/ChatFinderPage/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/ChatFinderPage/index.tsx b/src/pages/ChatFinderPage/index.tsx index a7516163c40b4..3abe8dad182fe 100644 --- a/src/pages/ChatFinderPage/index.tsx +++ b/src/pages/ChatFinderPage/index.tsx @@ -179,7 +179,6 @@ function ChatFinderPage({betas, isSearchingForReports, navigation}: ChatFinderPa textInputHint={offlineMessage} onChangeText={setSearchValue} headerMessage={headerMessage} - headerMessageStyle={headerMessage === translate('common.noResultsFound') ? [themeStyles.ph4, themeStyles.pb5] : undefined} onLayout={setPerformanceTimersEnd} onSelectRow={selectReport} showLoadingPlaceholder={!areOptionsInitialized || !isScreenTransitionEnd} From 7e87ea654c0d03cb77f4a4b38869e2ed6bf96e99 Mon Sep 17 00:00:00 2001 From: Brandon Henry Date: Wed, 1 May 2024 08:54:12 -0500 Subject: [PATCH 6/6] fix linter issues --- src/pages/ChatFinderPage/index.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/pages/ChatFinderPage/index.tsx b/src/pages/ChatFinderPage/index.tsx index 3abe8dad182fe..ed7100b3964a5 100644 --- a/src/pages/ChatFinderPage/index.tsx +++ b/src/pages/ChatFinderPage/index.tsx @@ -12,7 +12,6 @@ import useDebouncedState from '@hooks/useDebouncedState'; import useDismissedReferralBanners from '@hooks/useDismissedReferralBanners'; import useLocalize from '@hooks/useLocalize'; import useNetwork from '@hooks/useNetwork'; -import useThemeStyles from '@hooks/useThemeStyles'; import type {MaybePhraseKey} from '@libs/Localize'; import Navigation from '@libs/Navigation/Navigation'; import type {RootStackParamList} from '@libs/Navigation/types'; @@ -53,7 +52,6 @@ const ChatFinderPageFooterInstance = ; function ChatFinderPage({betas, isSearchingForReports, navigation}: ChatFinderPageProps) { const [isScreenTransitionEnd, setIsScreenTransitionEnd] = useState(false); - const themeStyles = useThemeStyles(); const {translate} = useLocalize(); const {isOffline} = useNetwork(); const {options, areOptionsInitialized} = useOptionsList({