Fixed search result tag issue

This commit is contained in:
Mustafa Buyukcelebi 2019-12-02 23:03:34 +03:00
parent 758dc0aa19
commit b3f58b4d9f
3 changed files with 11 additions and 15 deletions

View File

@ -162,19 +162,12 @@ const PostsView = ({
setIsLoading(true);
const filter = type || selectedFilterValue;
let options;
const limit = 3;
if (filter === 'feed' || filter === 'blog' || getFor === 'blog' || filter === 'reblogs') {
options = {
tag,
limit,
};
} else {
options = {
limit,
};
}
const options = {
tag,
limit,
};
if (startAuthor && startPermlink && !refreshing) {
options.start_author = startAuthor;

View File

@ -1,6 +1,9 @@
export const POPULAR_FILTERS = ['FEED', 'TOP', 'HOT', 'NEW'];
export const POPULAR_FILTERS_VALUE = ['feed', 'trending', 'hot', 'created'];
export const GLOBAL_POST_FILTERS = ['TOP', 'HOT', 'NEW'];
export const GLOBAL_POST_FILTERS_VALUE = ['trending', 'hot', 'created'];
export const PROFILE_FILTERS = ['BLOG', 'FEED'];
export const PROFILE_FILTERS_VALUE = ['blog', 'feed'];

View File

@ -10,7 +10,7 @@ import { SearchInput, Posts, TabBar } from '../../../components';
import styles from './searchResultStyles';
import globalStyles from '../../../globalStyles';
import { POPULAR_FILTERS, POPULAR_FILTERS_VALUE } from '../../../constants/options/filters';
import { GLOBAL_POST_FILTERS, GLOBAL_POST_FILTERS_VALUE } from '../../../constants/options/filters';
const SearchResultScreen = ({ navigation }) => {
const tag = navigation.getParam('tag', '');
@ -33,7 +33,7 @@ const SearchResultScreen = ({ navigation }) => {
const _getSelectedIndex = () => {
if (filter) {
const selectedIndex = POPULAR_FILTERS_VALUE.indexOf(filter);
const selectedIndex = GLOBAL_POST_FILTERS_VALUE.indexOf(filter);
if (selectedIndex > 0) {
return selectedIndex;
}
@ -54,8 +54,8 @@ const SearchResultScreen = ({ navigation }) => {
<View tabLabel={intl.formatMessage({ id: 'search.posts' })} style={styles.tabbarItem}>
<Posts
key={tag}
filterOptions={POPULAR_FILTERS}
filterOptionsValue={POPULAR_FILTERS_VALUE}
filterOptions={GLOBAL_POST_FILTERS}
filterOptionsValue={GLOBAL_POST_FILTERS_VALUE}
selectedOptionIndex={_getSelectedIndex()}
tag={tag}
/>