From d344ad8933c95bb9919761b12c1ec736e7ca50b4 Mon Sep 17 00:00:00 2001 From: natjms Date: Wed, 31 Mar 2021 15:23:33 -0300 Subject: [PATCH] Enable profile.js to retrieve profile data from AsyncStorage --- src/components/pages/profile.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/pages/profile.js b/src/components/pages/profile.js index 1a80d83..98362ed 100644 --- a/src/components/pages/profile.js +++ b/src/components/pages/profile.js @@ -8,6 +8,7 @@ import { } from "react-native"; import * as Linking from "expo-linking"; +import AsyncStorage from "@react-native-async-storage/async-storage"; import { activeOrNot } from "src/interface/interactions"; import { withoutHTML } from "src/interface/rendering"; @@ -149,12 +150,13 @@ const ProfileDisplayJsx = ({navigation}) => { } useEffect(() => { - // do something to get the profile based on given account name - setState({ - profile: TEST_PROFILE, - mutuals: getMutuals(TEST_YOUR_FOLLOWERS, TEST_THEIR_FOLLOWERS), - own: true, - loaded: true, + AsyncStorage.getItem("@user_profile").then((profileJSON) => { + setState({ + profile: JSON.parse(profileJSON), + mutuals: getMutuals(TEST_YOUR_FOLLOWERS, TEST_THEIR_FOLLOWERS), + own: true, + loaded: true, + }); }); }, []);