From a7d87e8f8c3c0dc849213064969b93a80ebfca83 Mon Sep 17 00:00:00 2001 From: ankit-thanekar007 Date: Tue, 16 Mar 2021 09:50:39 -0700 Subject: PR Bug fixes --- src/screens/main/NotificationsScreen.tsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') 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( [], @@ -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 (