From 309065ee4be815326d7cc66666839d545735677c Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Sun, 3 Jul 2022 10:04:46 +0500 Subject: [PATCH] add communitiesPlaceholder in communities results screen --- .../communities/container/communitiesResultsContainer.js | 7 +++++-- .../screen/tabs/communities/view/communitiesResults.js | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/screens/searchResult/screen/tabs/communities/container/communitiesResultsContainer.js b/src/screens/searchResult/screen/tabs/communities/container/communitiesResultsContainer.js index 36e96f35c..e187f7080 100644 --- a/src/screens/searchResult/screen/tabs/communities/container/communitiesResultsContainer.js +++ b/src/screens/searchResult/screen/tabs/communities/container/communitiesResultsContainer.js @@ -33,7 +33,7 @@ const CommunitiesResultsContainer = ({ children, navigation, searchValue }) => { const [data, setData] = useState([]); const [noResult, setNoResult] = useState(false); - + const [isDiscoversLoading, setIsDiscoversLoading] = useState(false); const pinCode = useSelector((state) => state.application.pin); const currentAccount = useSelector((state) => state.account.currentAccount); const isLoggedIn = useSelector((state) => state.application.isLoggedIn); @@ -44,7 +44,7 @@ const CommunitiesResultsContainer = ({ children, navigation, searchValue }) => { useEffect(() => { setData([]); setNoResult(false); - + setIsDiscoversLoading(true); getCommunities('', searchValue ? 100 : 20, searchValue || null, 'rank') .then((communities) => { if (currentAccount && currentAccount.username) { @@ -78,10 +78,12 @@ const CommunitiesResultsContainer = ({ children, navigation, searchValue }) => { setNoResult(true); } } + setIsDiscoversLoading(false); }) .catch((err) => { setNoResult(true); setData([]); + setIsDiscoversLoading(false); }); }, [searchValue]); @@ -160,6 +162,7 @@ const CommunitiesResultsContainer = ({ children, navigation, searchValue }) => { handleSubscribeButtonPress: _handleSubscribeButtonPress, isLoggedIn, noResult, + isDiscoversLoading, }) ); }; diff --git a/src/screens/searchResult/screen/tabs/communities/view/communitiesResults.js b/src/screens/searchResult/screen/tabs/communities/view/communitiesResults.js index c1af842cd..9ffec3c57 100644 --- a/src/screens/searchResult/screen/tabs/communities/view/communitiesResults.js +++ b/src/screens/searchResult/screen/tabs/communities/view/communitiesResults.js @@ -18,6 +18,7 @@ const CommunitiesResultsScreen = ({ navigation, searchValue }) => { handleSubscribeButtonPress, isLoggedIn, noResult, + isDiscoversLoading, }) => noResult ? ( @@ -30,6 +31,7 @@ const CommunitiesResultsScreen = ({ navigation, searchValue }) => { isLoggedIn={isLoggedIn} noResult={noResult} screen="searchResultsScreen" + isDiscoversLoading={isDiscoversLoading} /> ) }