extra checks on search page

This commit is contained in:
feruz 2020-12-03 16:05:11 +02:00
parent 82675efb79
commit 8a32ff7388
4 changed files with 32 additions and 31 deletions

View File

@ -24,9 +24,6 @@ export const getCurrencyTokenRate = (currency, token) =>
.catch((err) => {
bugsnag.notify(err);
return 0;
/*token === 'hbd'
? getCurrencyTokenRate(currency, 'sbd')
: getCurrencyTokenRate(currency, 'steem');*/
});
/**

View File

@ -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;

View File

@ -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]);

View File

@ -46,32 +46,35 @@ const OtherResult = ({ navigation, searchValue }) => {
const _renderList = (users, tags, filterIndex, handleOnPress) => {
switch (filterIndex) {
case 0:
return (
<FlatList
data={users}
keyExtractor={(item) => item.id}
renderItem={({ item, index }) => (
<TouchableOpacity onPress={() => handleOnPress(item)}>
{_renderUserItem(item, index)}
</TouchableOpacity>
)}
ListEmptyComponent={_renderEmptyContent}
/>
);
if (users && users.length > 0) {
return (
<FlatList
data={users}
keyExtractor={(item, ind) => `${item}-${ind}`}
renderItem={({ item, index }) => (
<TouchableOpacity onPress={() => handleOnPress(item)}>
{_renderUserItem(item, index)}
</TouchableOpacity>
)}
ListEmptyComponent={_renderEmptyContent}
/>
);
}
case 1:
return (
<FlatList
data={tags}
keyExtractor={(item) => item.id}
renderItem={({ item, index }) => (
<TouchableOpacity onPress={() => handleOnPress(item)}>
{_renderTagItem(item, index)}
</TouchableOpacity>
)}
ListEmptyComponent={_renderEmptyContent}
/>
);
if (tags && tags.length > 0) {
return (
<FlatList
data={tags}
keyExtractor={(item) => item.id}
renderItem={({ item, index }) => (
<TouchableOpacity onPress={() => handleOnPress(item)}>
{_renderTagItem(item, index)}
</TouchableOpacity>
)}
ListEmptyComponent={_renderEmptyContent}
/>
);
}
default:
break;
}