diff options
author | Brian Kim <brian@tagg.id> | 2021-06-08 18:21:26 +0900 |
---|---|---|
committer | Brian Kim <brian@tagg.id> | 2021-06-08 18:21:26 +0900 |
commit | 2f66fec878e9bba15ac7f2397820bb48d3f167bb (patch) | |
tree | aed4277e62e5507824431ccd3d4458ddd36a587b /src | |
parent | 4636694489159c5f9edf0238460bde08e2219f80 (diff) |
Add documentation
Diffstat (limited to 'src')
-rw-r--r-- | src/routes/tabs/NavigationBar.tsx | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/routes/tabs/NavigationBar.tsx b/src/routes/tabs/NavigationBar.tsx index fa129a23..e962c8da 100644 --- a/src/routes/tabs/NavigationBar.tsx +++ b/src/routes/tabs/NavigationBar.tsx @@ -47,6 +47,8 @@ const NavigationBar: React.FC = () => { const [unreadNotificationsPresent, setUnreadNotificationsPresent] = useState<boolean>(false); + // Prior to pill inclusion, determines if notification bell + // should have purple dot useEffect(() => { const determine = async () => { setUnreadNotificationsPresent( @@ -56,8 +58,9 @@ const NavigationBar: React.FC = () => { determine(); }, [notifications]); + // If there are notifications, determines the size of the pill + // and sets points for correct placement useEffect(() => { - console.log('notifications', notificationSets); setTimeout(() => { if (iconRef.current) { iconRef.current.measure( @@ -96,6 +99,7 @@ const NavigationBar: React.FC = () => { }, 100); }, [notificationSets, iconRef, tipRef]); + // Used so that pill disappears after 5 seconds useEffect(() => { if (timeCount) { setTimeout(() => { @@ -104,10 +108,10 @@ const NavigationBar: React.FC = () => { } }, [timeCount]); + // Gets data from backend to check for unreads useEffect(() => { const getCount = async () => { const data = await getNotificationsUnreadCount(); - // const data = {}; setTimeout(() => { setNotificationSets(data); }, 100); @@ -229,6 +233,8 @@ const NavigationBar: React.FC = () => { name="SuggestedPeople" component={MainStackScreen} initialParams={{screenType: ScreenType.SuggestedPeople}} + // Added these to as a way to close pill when on + // notification page listeners={{ tabPress: (_) => { setShowIcon(true); @@ -252,6 +258,7 @@ const NavigationBar: React.FC = () => { listeners={{ tabPress: (_) => { setShowIcon(false); + // Updates backend's date of reading notifications setNotificationsReadDate(); }, }} |