From 4713f43c1f357922a731540a922ab44787801618 Mon Sep 17 00:00:00 2001 From: natjms Date: Sat, 3 Apr 2021 00:51:08 -0300 Subject: [PATCH] Enable bell in profile.js to activate as per report from AsyncStorage --- src/components/pages/profile.js | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/components/pages/profile.js b/src/components/pages/profile.js index 98362ed..5854c73 100644 --- a/src/components/pages/profile.js +++ b/src/components/pages/profile.js @@ -149,14 +149,18 @@ const ProfileDisplayJsx = ({navigation}) => { inactive: require("assets/eva-icons/bell-black.png") } - useEffect(() => { - AsyncStorage.getItem("@user_profile").then((profileJSON) => { - setState({ - profile: JSON.parse(profileJSON), - mutuals: getMutuals(TEST_YOUR_FOLLOWERS, TEST_THEIR_FOLLOWERS), - own: true, - loaded: true, - }); + useEffect(async () => { + const profile = JSON.parse(await AsyncStorage.getItem("@user_profile")); + const notifications = JSON.parse( + await AsyncStorage.getItem("@user_notifications") + ); + + setState({ + profile: profile, + unreadNotifications: notifications.unread, + mutuals: getMutuals(TEST_YOUR_FOLLOWERS, TEST_THEIR_FOLLOWERS), + own: true, + loaded: true, }); }, []); @@ -207,7 +211,12 @@ const ProfileDisplayJsx = ({navigation}) => {