Enable bell in profile.js to activate as per report from AsyncStorage

This commit is contained in:
Nat 2021-04-03 00:51:08 -03:00
parent b6ee403eb9
commit 4713f43c1f
1 changed files with 18 additions and 9 deletions

View File

@ -149,15 +149,19 @@ const ProfileDisplayJsx = ({navigation}) => {
inactive: require("assets/eva-icons/bell-black.png") inactive: require("assets/eva-icons/bell-black.png")
} }
useEffect(() => { useEffect(async () => {
AsyncStorage.getItem("@user_profile").then((profileJSON) => { const profile = JSON.parse(await AsyncStorage.getItem("@user_profile"));
const notifications = JSON.parse(
await AsyncStorage.getItem("@user_notifications")
);
setState({ setState({
profile: JSON.parse(profileJSON), profile: profile,
unreadNotifications: notifications.unread,
mutuals: getMutuals(TEST_YOUR_FOLLOWERS, TEST_THEIR_FOLLOWERS), mutuals: getMutuals(TEST_YOUR_FOLLOWERS, TEST_THEIR_FOLLOWERS),
own: true, own: true,
loaded: true, loaded: true,
}); });
});
}, []); }, []);
let profileButton; let profileButton;
@ -207,7 +211,12 @@ const ProfileDisplayJsx = ({navigation}) => {
<View style = { styles.profileContextContainer }> <View style = { styles.profileContextContainer }>
<TouchableOpacity> <TouchableOpacity>
<Image <Image
source = { activeOrNot(state.unread_notifs, notif_pack) } source = {
activeOrNot(
state.unreadNotifications,
notif_pack
)
}
style = { styles.profileHeaderIcon } /> style = { styles.profileHeaderIcon } />
</TouchableOpacity> </TouchableOpacity>
</View> </View>