aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/routes/tabs/NavigationBar.tsx11
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();
},
}}