mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-12 13:05:41 +03:00
Fixed github comments
This commit is contained in:
parent
ef4e15baa1
commit
cc89b2ffe6
@ -62,7 +62,7 @@ const CommunitiesList = ({
|
||||
{!noResult && (
|
||||
<FlatList
|
||||
data={data}
|
||||
keyExtractor={(item, index) => index}
|
||||
keyExtractor={(item, index) => index.toString()}
|
||||
renderItem={_renderItem}
|
||||
ListEmptyComponent={_renderEmptyContent}
|
||||
/>
|
||||
|
@ -28,7 +28,7 @@ const SubscribedCommunitiesListView = ({
|
||||
return (
|
||||
<FlatList
|
||||
data={data}
|
||||
keyExtractor={(item, ind) => ind}
|
||||
keyExtractor={(item, index) => index.toString()}
|
||||
renderItem={({ item, index }) => (
|
||||
<View style={[styles.communityWrapper, index % 2 !== 0 && styles.itemWrapperGray]}>
|
||||
<View style={{ flex: 3, flexDirection: 'row', alignItems: 'center' }}>
|
||||
|
@ -583,7 +583,7 @@
|
||||
"unfollow": "Unfollow"
|
||||
},
|
||||
"communities": {
|
||||
"joined": "Joined",
|
||||
"joined": "Membership",
|
||||
"discover": "Discover"
|
||||
}
|
||||
}
|
||||
|
@ -1138,9 +1138,9 @@ export const lookupAccounts = async (username) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const getTrendingTags = async (tag) => {
|
||||
export const getTrendingTags = async (tag, number = 20) => {
|
||||
try {
|
||||
const tags = await client.database.call('get_trending_tags', [tag, 20]);
|
||||
const tags = await client.database.call('get_trending_tags', [tag, number]);
|
||||
return tags;
|
||||
} catch (error) {
|
||||
return [];
|
||||
|
@ -10,7 +10,7 @@ import { getPost, getAccountPosts } from '../../../../../../providers/hive/dhive
|
||||
|
||||
const PostsResultsContainer = ({ children, navigation, searchValue, currentAccountUsername }) => {
|
||||
const [data, setData] = useState([]);
|
||||
const [sort, setSort] = useState('relevance');
|
||||
const [sort, setSort] = useState('newest');
|
||||
const [scrollId, setScrollId] = useState('');
|
||||
const [noResult, setNoResult] = useState(false);
|
||||
|
||||
|
@ -26,12 +26,15 @@ const PostsResults = ({ navigation, searchValue }) => {
|
||||
const intl = useIntl();
|
||||
|
||||
const _renderItem = (item, index) => {
|
||||
const reputation =
|
||||
get(item, 'author_rep', undefined) || get(item, 'author_reputation', undefined);
|
||||
|
||||
return (
|
||||
<View style={[styles.itemWrapper, index % 2 !== 0 && styles.itemWrapperGray]}>
|
||||
<PostHeaderDescription
|
||||
date={getTimeFromNow(get(item, 'created_at'))}
|
||||
name={get(item, 'author')}
|
||||
reputation={Math.floor(get(item, 'author_rep'))}
|
||||
reputation={Math.floor(reputation)}
|
||||
size={36}
|
||||
tag={item.category}
|
||||
/>
|
||||
@ -90,7 +93,7 @@ const PostsResults = ({ navigation, searchValue }) => {
|
||||
) : (
|
||||
<FlatList
|
||||
data={data}
|
||||
keyExtractor={(item, index) => index}
|
||||
keyExtractor={(item, index) => index.toString()}
|
||||
renderItem={({ item, index }) => (
|
||||
<TouchableOpacity onPress={() => handleOnPress(item)}>
|
||||
{_renderItem(item, index)}
|
||||
|
@ -45,7 +45,7 @@ const CommunitiesResultsContainer = ({ children, navigation, searchValue }) => {
|
||||
setNoResult(false);
|
||||
|
||||
getSubscriptions(currentAccount.username).then((subs) => {
|
||||
getCommunities('', searchValue ? 100 : 20, searchValue, 'rank').then((communities) => {
|
||||
getCommunities('', searchValue ? 250 : 20, searchValue, 'rank').then((communities) => {
|
||||
communities.forEach((community) =>
|
||||
Object.assign(community, {
|
||||
isSubscribed: subs.some(
|
||||
|
@ -32,7 +32,7 @@ const PeopleResults = ({ navigation, searchValue }) => {
|
||||
) : (
|
||||
<FlatList
|
||||
data={users}
|
||||
keyExtractor={(item, index) => index}
|
||||
keyExtractor={(item, index) => index.toString()}
|
||||
renderItem={({ item, index }) => (
|
||||
<UserListItem
|
||||
handleOnPress={() => handleOnPress(item)}
|
||||
|
@ -13,16 +13,13 @@ const OtherResultContainer = (props) => {
|
||||
const [tags, setTags] = useState([]);
|
||||
const [noResult, setNoResult] = useState(false);
|
||||
|
||||
const { children, navigation, searchValue, username } = props;
|
||||
const { children, navigation, searchValue } = props;
|
||||
|
||||
useEffect(() => {
|
||||
setNoResult(false);
|
||||
setTags([]);
|
||||
|
||||
if (searchValue.length > 10) {
|
||||
setNoResult(true);
|
||||
} else {
|
||||
getTrendingTags(searchValue.trim()).then((res) => {
|
||||
if (searchValue.length <= 10) {
|
||||
setNoResult(false);
|
||||
setTags([]);
|
||||
getTrendingTags(searchValue.trim(), 100).then((res) => {
|
||||
const data = res?.filter((item) => !isCommunity(item.name));
|
||||
if (data.length === 0) {
|
||||
setNoResult(true);
|
||||
|
@ -36,7 +36,7 @@ const TopicsResults = ({ navigation, searchValue }) => {
|
||||
) : (
|
||||
<FlatList
|
||||
data={tags}
|
||||
keyExtractor={(item, index) => index}
|
||||
keyExtractor={(item, index) => index.toString()}
|
||||
renderItem={({ item, index }) => (
|
||||
<TouchableOpacity onPress={() => handleOnPress(item)}>
|
||||
{_renderTagItem(item, index)}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { isNumber } from 'lodash';
|
||||
|
||||
export const isCommunity = (text) => {
|
||||
if (/^hive-\d+/.test(text) && text.length === 11 && isNumber(Number(text.split('-')[1]))) {
|
||||
if (/hive-[1-3]\d{4,6}$/.test(text) && isNumber(Number(text.split('-')[1]))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user