From 24d206de187374603987c637b4277c41dcf61f19 Mon Sep 17 00:00:00 2001 From: Sebastian-Webster <84299475+Sebastian-Webster@users.noreply.github.com> Date: Fri, 12 Jan 2024 18:11:35 +0400 Subject: [PATCH 1/4] Fixed category search failing every 2nd keyboard input in FindScreen --- screens/FindScreen.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/screens/FindScreen.js b/screens/FindScreen.js index 114c9be..af1f4a4 100644 --- a/screens/FindScreen.js +++ b/screens/FindScreen.js @@ -285,7 +285,7 @@ const FindScreen = ({navigation}) => { const url = serverUrl + '/tempRoute/searchpagesearchcategories' const toSend = { val, - lastCategoryId: categoriesReducer.categories.length ? categoriesReducer.categories[categoriesReducer.categories.length - 1].categoryId : undefined + lastCategoryId: clear ? undefined : categoriesReducer.categories.length ? categoriesReducer.categories[categoriesReducer.categories.length - 1].categoryId : undefined } axios.post(url, toSend, {signal: abortControllerRef.current.signal}).then((response) => { const result = response.data; From 912c856ccc6cf1c8aa558d906dcd07107b58fcb1 Mon Sep 17 00:00:00 2001 From: Sebastian-Webster <84299475+Sebastian-Webster@users.noreply.github.com> Date: Fri, 12 Jan 2024 19:13:59 +0400 Subject: [PATCH 2/4] Fixed search page showing no results when there are results --- screens/FindScreen.js | 47 +++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/screens/FindScreen.js b/screens/FindScreen.js index af1f4a4..755f6dd 100644 --- a/screens/FindScreen.js +++ b/screens/FindScreen.js @@ -201,21 +201,14 @@ const FindScreen = ({navigation}) => { } axios.post(url, toSend, {signal: abortControllerRef.current.signal}).then((response) => { const result = response.data; - const {message, status, data} = result; + const {data} = result; + const {items, noMoreItems} = data; - if (status !== 'SUCCESS') { - setErrorOccured(message) - setLoadingOne(false) - setNoResults(false) - console.error(message) - } else { - console.log(data) - layoutUsersFound(data) - console.log('Search complete.') - setNoResults(false) - //persistLogin({...data[0]}, message, status); - } + setLoadingOne(false) + layoutUsersFound(items) + + if (noMoreItems) setNoResults(true) }).catch(error => { if (error instanceof CanceledError) { console.warn('Cancelled intentionally') @@ -408,28 +401,28 @@ const FindScreen = ({navigation}) => { )} - {filterFormatSearch == "Users" && ( + {filterFormatSearch == "Users" ? ( item + index} renderItem={({ item, index }) => } ListFooterComponent={ <> - {noResults == true && ( + {noResults === true ? ( - {changeSectionsOne.length > 0 ? 'No more results' : 'No results found'} + {changeSectionsOne.length > 0 ? 'No more results' : 'No results'} - )} - {errorOccured !== null && ( + ) : null} + {errorOccured !== null ? ( {errorOccured} - )} - {loadingOne == true && ( + ) : null} + {loadingOne == true ? ( - )} + ) : null} } keyboardDismissMode="on-drag" @@ -446,9 +439,10 @@ const FindScreen = ({navigation}) => { onContentSizeChange={(contentWidth, contentHeight) => { userListHeight.current = contentHeight; }} + extraData={noResults} /> - )} - {filterFormatSearch == "Categories" && ( + ) : null} + {filterFormatSearch == "Categories" ? ( item.categoryId} @@ -493,13 +487,14 @@ const FindScreen = ({navigation}) => { } } }} + extraData={noResults} /> - )} - {filterFormatSearch == "Images" && ( + ) : null} + {filterFormatSearch == "Images" ? ( This feature is not out yet... - )} + ) : null} : From 14205b5f003385a597649596fca279a10b690d7b Mon Sep 17 00:00:00 2001 From: Sebastian-Webster <84299475+Sebastian-Webster@users.noreply.github.com> Date: Fri, 12 Jan 2024 19:16:56 +0400 Subject: [PATCH 3/4] Fixed search page showing loading spinner when nothing is loading --- screens/FindScreen.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/screens/FindScreen.js b/screens/FindScreen.js index 755f6dd..20971a0 100644 --- a/screens/FindScreen.js +++ b/screens/FindScreen.js @@ -223,6 +223,7 @@ const FindScreen = ({navigation}) => { console.log('Empty search') setNoResults(false) setChangeSectionsOne([]) + setLoadingOne(false) } } @@ -301,6 +302,7 @@ const FindScreen = ({navigation}) => { } else { console.log('Empty category search') dispatchCategories({type: 'resetCategories'}) + dispatchCategories({type: 'stopLoad'}) } } } From 8e20769f36d836539b7915e42ff6ebcc19b2ca19 Mon Sep 17 00:00:00 2001 From: Sebastian-Webster <84299475+Sebastian-Webster@users.noreply.github.com> Date: Fri, 12 Jan 2024 19:26:37 +0400 Subject: [PATCH 4/4] Made thread view page color design consistent --- screens/ThreadViewPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/screens/ThreadViewPage.js b/screens/ThreadViewPage.js index eb7e6e5..24164d3 100644 --- a/screens/ThreadViewPage.js +++ b/screens/ThreadViewPage.js @@ -721,7 +721,7 @@ const ThreadViewPage = ({navigation, route}) => { return( <> - 0 ? (postReducer.posts[0].creatorDisplayName || postReducer.posts[0].creatorName) : 'Finding') + "'s thread"}/> + 0 ? (postReducer.posts[0].creatorDisplayName || postReducer.posts[0].creatorName) : 'Finding') + "'s thread"}/>