diff options
author | Shravya Ramesh <shravs1208@gmail.com> | 2021-04-23 15:49:15 -0700 |
---|---|---|
committer | Shravya Ramesh <shravs1208@gmail.com> | 2021-04-23 15:49:15 -0700 |
commit | 45d0a3aeb97c71cd73a198fc7f1aea67e0996009 (patch) | |
tree | 67cb84bb80f93d44254056197b141f792103bf42 /src | |
parent | e676ec0c9124613507b2064cb139522a2568c26e (diff) |
value from and to async for tutorial
Diffstat (limited to 'src')
-rw-r--r-- | src/components/profile/BadgeTutorialScreen.tsx | 3 | ||||
-rw-r--r-- | src/components/profile/ProfileHeader.tsx | 14 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/components/profile/BadgeTutorialScreen.tsx b/src/components/profile/BadgeTutorialScreen.tsx index 45831fc6..30aced42 100644 --- a/src/components/profile/BadgeTutorialScreen.tsx +++ b/src/components/profile/BadgeTutorialScreen.tsx @@ -8,7 +8,7 @@ import { View, } from 'react-native'; import {PROFILE_CUTOUT_TOP_Y} from '../../constants'; -import {normalize} from '../../utils'; +import {normalize, setHasSeenBadgeTutorial} from '../../utils'; import {UniversityIcon} from './'; import {UniversityIconProps} from './UniversityIcon'; @@ -31,6 +31,7 @@ const BadgeTutorialScreen: React.FC<BadgeTutorialScreenProps> = ({ presentationStyle="overFullScreen"> <TouchableOpacity onPress={() => { + setHasSeenBadgeTutorial(); setShowBadgeTutorial(false); setShowModal(false); }} diff --git a/src/components/profile/ProfileHeader.tsx b/src/components/profile/ProfileHeader.tsx index 5d5b695e..665ce0a0 100644 --- a/src/components/profile/ProfileHeader.tsx +++ b/src/components/profile/ProfileHeader.tsx @@ -1,4 +1,5 @@ -import React, {useLayoutEffect, useRef, useState} from 'react'; +import AsyncStorage from '@react-native-community/async-storage'; +import React, {useEffect, useLayoutEffect, useRef, useState} from 'react'; import {StyleSheet, Text, View} from 'react-native'; import {TouchableOpacity} from 'react-native-gesture-handler'; import {useSelector, useStore} from 'react-redux'; @@ -50,6 +51,17 @@ const ProfileHeader: React.FC<ProfileHeaderProps> = ({ const childRef = useRef(null); const [measure, setMeasure] = useState(null); const [showBadgeTutorial, setShowBadgeTutorial] = useState(false); + + useEffect(() => { + const getBadgeTutorialAsync = async () => { + const res = await AsyncStorage.getItem('hasSeenBadgeTutorial'); + if (res === 'true') { + setShowBadgeTutorial(false); + } + }; + getBadgeTutorialAsync(); + }); + useLayoutEffect(() => { setTimeout(() => { measureStuff(); |