From 76a8bd04589573301f3e67cef8eee5055200b61d Mon Sep 17 00:00:00 2001 From: Sebastian-Webster <84299475+Sebastian-Webster@users.noreply.github.com> Date: Sat, 17 Feb 2024 00:07:16 +1300 Subject: [PATCH] refactor: FindScreen icons now use theme colors --- screens/FindScreen.js | 70 ++++++++++++++++--------------------------- 1 file changed, 26 insertions(+), 44 deletions(-) diff --git a/screens/FindScreen.js b/screens/FindScreen.js index a83a4a5..abbf46f 100644 --- a/screens/FindScreen.js +++ b/screens/FindScreen.js @@ -336,6 +336,23 @@ const FindScreen = ({navigation}) => { } } }, [filterFormatSearch]) + + function abortNetworkRequests() { + abortControllerRef.current.abort(); + abortControllerRef.current = new AbortController() + } + + function changeToUsers() { + abortNetworkRequests(); + setChangeSectionsOne([]) + setFilterFormatSearch("Users") + } + + function changeToCategories() { + abortNetworkRequests(); + dispatchCategories({type: 'resetCategories'}) + setFilterFormatSearch("Categories"); + } return( <> @@ -348,56 +365,21 @@ const FindScreen = ({navigation}) => { Users - {filterFormatSearch == "Users" && ( - - - - )} - {filterFormatSearch !== "Users" && ( - { - abortControllerRef.current.abort(); - abortControllerRef.current = new AbortController() - setChangeSectionsOne([]) - setFilterFormatSearch("Users") - }}> - - - )} + filterFormatSearch !== 'Users' ? changeToUsers() : null}> + + Categories - {filterFormatSearch == "Categories" && ( - - - - )} - {filterFormatSearch !== "Categories" && ( - { - abortControllerRef.current.abort(); - abortControllerRef.current = new AbortController(); - dispatchCategories({type: 'resetCategories'}) - setFilterFormatSearch("Categories"); - }}> - - - )} + filterFormatSearch !== 'Categories' ? changeToCategories() : null}> + + Images - {filterFormatSearch == "Images" && ( - - - - )} - {filterFormatSearch !== "Images" && ( - { - //setChangeSections([]) - //setFilterFormatSearch("Images") - alert('This feature is coming soon') - }}> - - - )} + alert('This feature is coming soon')}> + +