diff options
author | Ivan Chen <ivan@thetaggid.com> | 2021-01-05 14:32:50 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-05 14:32:50 -0500 |
commit | 5933716cf0f3f3c602aff4fe133b1eb5893e80df (patch) | |
tree | a8b45a6656e3646cd7aa617d81c4eafdf837cda1 | |
parent | 73d0580871b919d6b2f32b753dd04d48cc86fbea (diff) |
added logic to hide empty categories (#164)
-rw-r--r-- | src/screens/main/NotificationsScreen.tsx | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/src/screens/main/NotificationsScreen.tsx b/src/screens/main/NotificationsScreen.tsx index 2343215f..d6d47b02 100644 --- a/src/screens/main/NotificationsScreen.tsx +++ b/src/screens/main/NotificationsScreen.tsx @@ -88,18 +88,9 @@ const NotificationsScreen: React.FC = () => { } } setSectionedNotifications([ - { - title: 'Today', - data: todays, - }, - { - title: 'Yesterday', - data: yesterdays, - }, - { - title: 'This Week', - data: thisWeeks, - }, + {title: 'Today', data: todays}, + {title: 'Yesterday', data: yesterdays}, + {title: 'This Week', data: thisWeeks}, ]); }, [lastViewed, notifications]); @@ -107,11 +98,12 @@ const NotificationsScreen: React.FC = () => { <Notification item={item} screenType={ScreenType.Notifications} /> ); - const renderSectionHeader = ({section: {title}}) => ( - <View style={styles.sectionHeaderContainer}> - <Text style={styles.sectionHeader}>{title}</Text> - </View> - ); + const renderSectionHeader = ({section: {title, data}}) => + data.length !== 0 && ( + <View style={styles.sectionHeaderContainer}> + <Text style={styles.sectionHeader}>{title}</Text> + </View> + ); return ( <SafeAreaView> |