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 { ActivityIndicator, View, Text, TouchableOpacity } from 'react-native';
import Highlighter from 'react-native-highlight-words';
import { UserAvatar } from '../../../userAvatar';
import Tag from '../tag/tagView';
@ -26,6 +27,7 @@ const UserListItem = ({
isFollowing = false,
isLoadingRightAction = false,
isLoggedIn,
searchValue,
}) => {
const _handleSubscribeButtonPress = () => {
const _data = {};
@ -45,7 +47,18 @@ const UserListItem = ({
<UserAvatar noAction={true} style={styles.avatar} username={username} />
<View style={styles.userDescription}>
<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>
{middleText && (
<View style={styles.middleWrapper}>

View File

@ -1,8 +1,7 @@
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 isUndefined from 'lodash/isUndefined';
import FastImage from 'react-native-fast-image';
import { useIntl } from 'react-intl';
import Highlighter from 'react-native-highlight-words';
@ -14,30 +13,19 @@ import {
EmptyScreen,
} from '../../../../../../components/basicUIElements';
import PostsResultsContainer from '../container/postsResultsContainer';
import ProgressiveImage from '../../../../../../components/progressiveImage';
import { getTimeFromNow } from '../../../../../../utils/time';
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 PostsResults = ({ navigation, searchValue }) => {
const intl = useIntl();
const [calcImgHeight, setCalcImgHeight] = useState(300);
const _renderItem = (item, index) => {
const reputation =
get(item, 'author_rep', undefined) || get(item, 'author_reputation', undefined);
//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 body = get(item, 'summary', '') || get(item, 'body_marked', '');
@ -50,16 +38,6 @@ const PostsResults = ({ navigation, searchValue }) => {
size={36}
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]}>
<Text style={styles.title}>{item.title}</Text>
{!!body && (
@ -68,7 +46,7 @@ const PostsResults = ({ navigation, searchValue }) => {
searchWords={[searchValue]}
textToHighlight={body.replace(/<mark>/g, '').replace(/<\/mark>/g, '')}
style={styles.summary}
numberOfLines={2}
numberOfLines={3}
/>
)}
</View>

View File

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