diff --git a/screens/FindScreen.js b/screens/FindScreen.js index 114c9be..20971a0 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') @@ -230,6 +223,7 @@ const FindScreen = ({navigation}) => { console.log('Empty search') setNoResults(false) setChangeSectionsOne([]) + setLoadingOne(false) } } @@ -285,7 +279,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; @@ -308,6 +302,7 @@ const FindScreen = ({navigation}) => { } else { console.log('Empty category search') dispatchCategories({type: 'resetCategories'}) + dispatchCategories({type: 'stopLoad'}) } } } @@ -408,28 +403,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 +441,10 @@ const FindScreen = ({navigation}) => { onContentSizeChange={(contentWidth, contentHeight) => { userListHeight.current = contentHeight; }} + extraData={noResults} /> - )} - {filterFormatSearch == "Categories" && ( + ) : null} + {filterFormatSearch == "Categories" ? ( item.categoryId} @@ -493,13 +489,14 @@ const FindScreen = ({navigation}) => { } } }} + extraData={noResults} /> - )} - {filterFormatSearch == "Images" && ( + ) : null} + {filterFormatSearch == "Images" ? ( This feature is not out yet... - )} + ) : null} : 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"}/>