mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-22 21:01:31 +03:00
Fixed search issue
This commit is contained in:
parent
55858a2434
commit
1bbeb73ab5
@ -99,37 +99,45 @@ const SearchModalContainer = ({
|
||||
});
|
||||
}
|
||||
} else if (feedType) {
|
||||
handleOnClose();
|
||||
setSearchResults({});
|
||||
// handleOnClose();
|
||||
// setSearchResults({});
|
||||
if (tag) {
|
||||
navigation.navigate({
|
||||
routeName: ROUTES.SCREENS.SEARCH_RESULT,
|
||||
params: {
|
||||
tag: tag,
|
||||
filter: feedType,
|
||||
},
|
||||
setSearchResults({
|
||||
type: 'feedType',
|
||||
data: [{ text: `#${tag}`, tag, filter: feedType }],
|
||||
});
|
||||
// navigation.navigate({
|
||||
// routeName: ROUTES.SCREENS.SEARCH_RESULT,
|
||||
// params: {
|
||||
// tag: tag,
|
||||
// filter: feedType,
|
||||
// },
|
||||
// });
|
||||
} else {
|
||||
navigation.navigate({
|
||||
routeName: ROUTES.SCREENS.SEARCH_RESULT,
|
||||
params: {
|
||||
filter: feedType,
|
||||
},
|
||||
setSearchResults({
|
||||
type: 'feedType',
|
||||
data: [{ text: `#${feedType}`, filter: feedType }],
|
||||
});
|
||||
// navigation.navigate({
|
||||
// routeName: ROUTES.SCREENS.SEARCH_RESULT,
|
||||
// params: {
|
||||
// filter: feedType,
|
||||
// },
|
||||
// });
|
||||
}
|
||||
}
|
||||
} else {
|
||||
search({ q: text }).then(res => {
|
||||
res.results = res.results
|
||||
.filter(item => item.title !== '')
|
||||
.map(item => ({
|
||||
image: item.img_url || getResizedAvatar(get(item, 'author')),
|
||||
text: item.title,
|
||||
...item,
|
||||
}));
|
||||
setSearchResults({ type: 'content', data: get(res, 'results', []) });
|
||||
});
|
||||
}
|
||||
} else {
|
||||
search({ q: text }).then(res => {
|
||||
res.results = res.results
|
||||
.filter(item => item.title !== '')
|
||||
.map(item => ({
|
||||
image: item.img_url || getResizedAvatar(get(item, 'author')),
|
||||
text: item.title,
|
||||
...item,
|
||||
}));
|
||||
setSearchResults({ type: 'content', data: get(res, 'results', []) });
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -165,6 +173,20 @@ const SearchModalContainer = ({
|
||||
};
|
||||
break;
|
||||
|
||||
case 'feedType':
|
||||
routeName = ROUTES.SCREENS.SEARCH_RESULT;
|
||||
if (get(item, 'tag', false)) {
|
||||
params = {
|
||||
tag: get(item, 'tag', ''),
|
||||
filter: get(item, 'filter', ''),
|
||||
};
|
||||
} else {
|
||||
params = {
|
||||
filter: get(item, 'filter', ''),
|
||||
};
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user