From 8a32ff738816ede1dfa9457b36a0662b577f6ec3 Mon Sep 17 00:00:00 2001 From: feruz Date: Thu, 3 Dec 2020 16:05:11 +0200 Subject: [PATCH] extra checks on search page --- src/providers/ecency/ecency.js | 3 -- src/providers/hive/dhive.js | 4 +- .../container/otherResultContainer.js | 3 +- .../searchResult/screen/otherResults.js | 53 ++++++++++--------- 4 files changed, 32 insertions(+), 31 deletions(-) diff --git a/src/providers/ecency/ecency.js b/src/providers/ecency/ecency.js index 1ae12f598..4e94227cd 100644 --- a/src/providers/ecency/ecency.js +++ b/src/providers/ecency/ecency.js @@ -24,9 +24,6 @@ export const getCurrencyTokenRate = (currency, token) => .catch((err) => { bugsnag.notify(err); return 0; - /*token === 'hbd' - ? getCurrencyTokenRate(currency, 'sbd') - : getCurrencyTokenRate(currency, 'steem');*/ }); /** diff --git a/src/providers/hive/dhive.js b/src/providers/hive/dhive.js index 502c3315d..d77267e84 100644 --- a/src/providers/hive/dhive.js +++ b/src/providers/hive/dhive.js @@ -1099,8 +1099,8 @@ export const lookupAccounts = async (username) => { export const getTrendingTags = async (tag) => { try { - const users = await client.database.call('get_trending_tags', [tag, 20]); - return users; + const tags = await client.database.call('get_trending_tags', [tag, 20]); + return tags; } catch (error) { console.log('get_trending_tags'); throw error; diff --git a/src/screens/searchResult/container/otherResultContainer.js b/src/screens/searchResult/container/otherResultContainer.js index fe3726231..3c62bdff7 100644 --- a/src/screens/searchResult/container/otherResultContainer.js +++ b/src/screens/searchResult/container/otherResultContainer.js @@ -28,7 +28,8 @@ const OtherResultContainer = (props) => { }); } else { getLeaderboard().then((result) => { - setUsers(result.map((item) => item._id)); + const sos = result.map((item) => item._id); + setUsers(sos); }); } }, [searchValue]); diff --git a/src/screens/searchResult/screen/otherResults.js b/src/screens/searchResult/screen/otherResults.js index 2d9f36035..d51f7c3b6 100644 --- a/src/screens/searchResult/screen/otherResults.js +++ b/src/screens/searchResult/screen/otherResults.js @@ -46,32 +46,35 @@ const OtherResult = ({ navigation, searchValue }) => { const _renderList = (users, tags, filterIndex, handleOnPress) => { switch (filterIndex) { case 0: - return ( - item.id} - renderItem={({ item, index }) => ( - handleOnPress(item)}> - {_renderUserItem(item, index)} - - )} - ListEmptyComponent={_renderEmptyContent} - /> - ); + if (users && users.length > 0) { + return ( + `${item}-${ind}`} + renderItem={({ item, index }) => ( + handleOnPress(item)}> + {_renderUserItem(item, index)} + + )} + ListEmptyComponent={_renderEmptyContent} + /> + ); + } case 1: - return ( - item.id} - renderItem={({ item, index }) => ( - handleOnPress(item)}> - {_renderTagItem(item, index)} - - )} - ListEmptyComponent={_renderEmptyContent} - /> - ); - + if (tags && tags.length > 0) { + return ( + item.id} + renderItem={({ item, index }) => ( + handleOnPress(item)}> + {_renderTagItem(item, index)} + + )} + ListEmptyComponent={_renderEmptyContent} + /> + ); + } default: break; }