diff options
author | ankit-thanekar007 <ankit.thanekar007@gmail.com> | 2021-03-16 09:50:39 -0700 |
---|---|---|
committer | ankit-thanekar007 <ankit.thanekar007@gmail.com> | 2021-03-16 09:50:39 -0700 |
commit | a7d87e8f8c3c0dc849213064969b93a80ebfca83 (patch) | |
tree | e01acd598249dceb2a026f95cdd6e17a78191819 | |
parent | 664757ff9f48bddccf3accea3c11c367f3d141c8 (diff) |
PR Bug fixes
-rw-r--r-- | src/screens/main/NotificationsScreen.tsx | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/screens/main/NotificationsScreen.tsx b/src/screens/main/NotificationsScreen.tsx index ed6c246e..501c44fc 100644 --- a/src/screens/main/NotificationsScreen.tsx +++ b/src/screens/main/NotificationsScreen.tsx @@ -57,7 +57,7 @@ const NotificationsScreen: React.FC = () => { const DEFAULT_NOTIFICATIONS_SIZE = 2; - const [moreFooterEnabled, setMoreFooterEnabled] = useState(false); + const [footerEnabled, setFooterEnabled] = useState(false); const [requestLimit, setRequestLimit] = useState(DEFAULT_NOTIFICATIONS_SIZE); const [allFriendRequests, setFriendRequests] = useState<NotificationType[]>( [], @@ -154,7 +154,10 @@ const NotificationsScreen: React.FC = () => { } } setFriendRequests(friendRequests); - setMoreFooterEnabled(requestLimit === friendRequests.length); + setFooterEnabled( + requestLimit === friendRequests.length && + friendRequests.length > DEFAULT_NOTIFICATIONS_SIZE, + ); setSectionedNotifications( todays.length === 0 && yesterdays.length === 0 && @@ -200,12 +203,12 @@ const NotificationsScreen: React.FC = () => { ); const renderSectionFooter = ({ - section: {title, data}, + section: {title}, }: { - section: {title: string; data: NotificationType[]}; + section: {title: string}; }) => { if (title === 'Friend Requests') { - if (moreFooterEnabled) { + if (footerEnabled) { return ( <TouchableOpacity style={styles.sectionHeaderContainer} |