From 95bc850b9db986b9f462f19d7801218027307d58 Mon Sep 17 00:00:00 2001 From: ankit-thanekar007 Date: Wed, 3 Mar 2021 12:34:33 -0800 Subject: TMA-663-Search Integration --- src/components/search/ExploreSection.tsx | 2 +- src/components/search/SearchResultCell.tsx | 12 +++++------ src/components/search/SearchResultList.tsx | 32 +++++++++++++++++++----------- 3 files changed, 27 insertions(+), 19 deletions(-) (limited to 'src/components') diff --git a/src/components/search/ExploreSection.tsx b/src/components/search/ExploreSection.tsx index 025c8c3c..e888370e 100644 --- a/src/components/search/ExploreSection.tsx +++ b/src/components/search/ExploreSection.tsx @@ -14,7 +14,7 @@ interface ExploreSectionProps { users: ProfilePreviewType[]; } const ExploreSection: React.FC = ({title, users}) => { - return users.length !== 0 ? ( + return users && users.length !== 0 ? ( {title} = (showBorder: Boolean) => { }; const SearchResultList: React.FC = ({results}) => { + const [showSection, setShowSection] = useState(true); return ( - item + index} - renderItem={({item}) => } - renderSectionHeader={({section: {title}}) => - sectionHeader(title !== 'categories') - } - /> + + item + index} + renderItem={({item}) => } + renderSectionHeader={({section: {title, data}}) => { + if (title === 'categories' && data.length === 0) { + setShowSection(false); + } + return sectionHeader(title !== 'categories' && showSection); + }} + /> + + ); }; const styles = StyleSheet.create({ - container: {flex: 1, marginTop: SCREEN_HEIGHT * 0.02}, + container: {marginTop: SCREEN_HEIGHT * 0.02}, sectionHeaderStyle: { width: '100%', height: 0.5, -- cgit v1.2.3-70-g09d2