remove search page thumbnails

This commit is contained in:
feruz 2021-01-25 15:14:48 +02:00
parent 11500e3ec0
commit 124ad66d19
3 changed files with 17 additions and 25 deletions

View File

@ -1,5 +1,6 @@
import React from 'react'; import React from 'react';
import { ActivityIndicator, View, Text, TouchableOpacity } from 'react-native'; import { ActivityIndicator, View, Text, TouchableOpacity } from 'react-native';
import Highlighter from 'react-native-highlight-words';
import { UserAvatar } from '../../../userAvatar'; import { UserAvatar } from '../../../userAvatar';
import Tag from '../tag/tagView'; import Tag from '../tag/tagView';
@ -26,6 +27,7 @@ const UserListItem = ({
isFollowing = false, isFollowing = false,
isLoadingRightAction = false, isLoadingRightAction = false,
isLoggedIn, isLoggedIn,
searchValue,
}) => { }) => {
const _handleSubscribeButtonPress = () => { const _handleSubscribeButtonPress = () => {
const _data = {}; const _data = {};
@ -45,7 +47,18 @@ const UserListItem = ({
<UserAvatar noAction={true} style={styles.avatar} username={username} /> <UserAvatar noAction={true} style={styles.avatar} username={username} />
<View style={styles.userDescription}> <View style={styles.userDescription}>
<Text style={styles.name}>{text || username}</Text> <Text style={styles.name}>{text || username}</Text>
{description && <Text style={[styles.date, descriptionStyle]}>{description}</Text>} {!!searchValue && (
<Highlighter
highlightStyle={{ backgroundColor: 'yellow' }}
searchWords={[searchValue]}
textToHighlight={description}
style={styles.summary}
numberOfLines={3}
/>
)}
{description && !searchValue && (
<Text style={[styles.date, descriptionStyle]}>{description}</Text>
)}
</View> </View>
{middleText && ( {middleText && (
<View style={styles.middleWrapper}> <View style={styles.middleWrapper}>

View File

@ -1,8 +1,7 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { SafeAreaView, FlatList, View, Text, TouchableOpacity, Dimensions } from 'react-native'; import { SafeAreaView, FlatList, View, Text, TouchableOpacity } from 'react-native';
import get from 'lodash/get'; import get from 'lodash/get';
import isUndefined from 'lodash/isUndefined'; import isUndefined from 'lodash/isUndefined';
import FastImage from 'react-native-fast-image';
import { useIntl } from 'react-intl'; import { useIntl } from 'react-intl';
import Highlighter from 'react-native-highlight-words'; import Highlighter from 'react-native-highlight-words';
@ -14,30 +13,19 @@ import {
EmptyScreen, EmptyScreen,
} from '../../../../../../components/basicUIElements'; } from '../../../../../../components/basicUIElements';
import PostsResultsContainer from '../container/postsResultsContainer'; import PostsResultsContainer from '../container/postsResultsContainer';
import ProgressiveImage from '../../../../../../components/progressiveImage';
import { getTimeFromNow } from '../../../../../../utils/time'; import { getTimeFromNow } from '../../../../../../utils/time';
import styles from './postsResultsStyles'; import styles from './postsResultsStyles';
const DEFAULT_IMAGE =
'https://images.ecency.com/DQmT8R33geccEjJfzZEdsRHpP3VE8pu3peRCnQa1qukU4KR/no_image_3x.png';
const dim = Dimensions.get('window');
const filterOptions = ['relevance', 'popularity', 'newest']; const filterOptions = ['relevance', 'popularity', 'newest'];
const PostsResults = ({ navigation, searchValue }) => { const PostsResults = ({ navigation, searchValue }) => {
const intl = useIntl(); const intl = useIntl();
const [calcImgHeight, setCalcImgHeight] = useState(300);
const _renderItem = (item, index) => { const _renderItem = (item, index) => {
const reputation = const reputation =
get(item, 'author_rep', undefined) || get(item, 'author_reputation', undefined); get(item, 'author_rep', undefined) || get(item, 'author_reputation', undefined);
//console.log(item); //console.log(item);
const image = get(item, 'img_url', DEFAULT_IMAGE) || get(item, 'image', DEFAULT_IMAGE);
const thumbnail =
get(item, 'thumbnail', DEFAULT_IMAGE) ||
`https://images.ecency.com/6x5/${get(item, 'img_url', DEFAULT_IMAGE)}`;
const votes = get(item, 'up_votes', 0) || get(item, 'stats.total_votes', 0); const votes = get(item, 'up_votes', 0) || get(item, 'stats.total_votes', 0);
const body = get(item, 'summary', '') || get(item, 'body_marked', ''); const body = get(item, 'summary', '') || get(item, 'body_marked', '');
@ -50,16 +38,6 @@ const PostsResults = ({ navigation, searchValue }) => {
size={36} size={36}
content={item} content={item}
/> />
{image && thumbnail && (
<ProgressiveImage
source={{ uri: image }}
thumbnailSource={{ uri: thumbnail }}
style={[
styles.thumbnail,
{ width: dim.width - 18, height: Math.min(calcImgHeight, dim.height) },
]}
/>
)}
<View style={[styles.postDescription]}> <View style={[styles.postDescription]}>
<Text style={styles.title}>{item.title}</Text> <Text style={styles.title}>{item.title}</Text>
{!!body && ( {!!body && (
@ -68,7 +46,7 @@ const PostsResults = ({ navigation, searchValue }) => {
searchWords={[searchValue]} searchWords={[searchValue]}
textToHighlight={body.replace(/<mark>/g, '').replace(/<\/mark>/g, '')} textToHighlight={body.replace(/<mark>/g, '').replace(/<\/mark>/g, '')}
style={styles.summary} style={styles.summary}
numberOfLines={2} numberOfLines={3}
/> />
)} )}
</View> </View>

View File

@ -40,6 +40,7 @@ const PeopleResults = ({ searchValue }) => {
descriptionStyle={styles.descriptionStyle} descriptionStyle={styles.descriptionStyle}
isHasRightItem isHasRightItem
isLoggedIn isLoggedIn
searchValue={searchValue}
isLoadingRightAction={false} isLoadingRightAction={false}
/> />
)} )}