From ee9ad07d1309b902365dc92357dad2937f62b09d Mon Sep 17 00:00:00 2001 From: Ashm Walia <40498934+ashmgarv@users.noreply.github.com> Date: Thu, 14 Jan 2021 11:12:13 -0800 Subject: Fix (#182) --- src/components/profile/Content.tsx | 26 ++++++++++++++++++++------ src/screens/profile/ProfileScreen.tsx | 4 ++-- 2 files changed, 22 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/components/profile/Content.tsx b/src/components/profile/Content.tsx index 61a08d49..1d639a41 100644 --- a/src/components/profile/Content.tsx +++ b/src/components/profile/Content.tsx @@ -98,10 +98,12 @@ const Content: React.FC = ({y, userXId, screenType}) => { const [shouldBounce, setShouldBounce] = useState(true); const [refreshing, setRefreshing] = useState(false); - //These two booleans are used to see if user closed the pormpt displayed to them const [isStageTwoPromptClosed, setIsStageTwoPromptClosed] = useState( false, ); + const [isStageOnePromptClosed, setIsStageOnePromptClosed] = useState( + false, + ); const [isStageThreePromptClosed, setIsStageThreePromptClosed] = useState< boolean >(false); @@ -145,7 +147,7 @@ const Content: React.FC = ({y, userXId, screenType}) => { const move = (direction: 'up' | 'down', title: string) => { let categories = [...momentCategories]; categories = moveCategory(categories, title, direction === 'up'); - dispatch(updateMomentCategories(categories)); + dispatch(updateMomentCategories(categories, false)); }; /** @@ -164,11 +166,16 @@ const Content: React.FC = ({y, userXId, screenType}) => { const navigateToMomentUploadPrompt = () => { switch (profile.profile_completion_stage) { case 1: - if (momentCategories && momentCategories[0]) { + if ( + momentCategories && + momentCategories[0] && + !isStageOnePromptClosed + ) { navigation.navigate('MomentUploadPrompt', { screenType, momentCategory: momentCategories[0], }); + setIsStageOnePromptClosed(true); } break; case 2: @@ -181,8 +188,15 @@ const Content: React.FC = ({y, userXId, screenType}) => { break; } }; - setTimeout(navigateToMomentUploadPrompt, 2000); - }, [profile.profile_completion_stage, momentCategories]), + if (!userXId) { + setTimeout(navigateToMomentUploadPrompt, 2000); + } + }, [ + profile.profile_completion_stage, + momentCategories, + userXId, + isStageOnePromptClosed, + ]), ); /** @@ -391,7 +405,7 @@ const Content: React.FC = ({y, userXId, screenType}) => { /> ), )} - {!userXId && profile.profile_completion_stage !== 1 && ( + {!userXId && ( navigation.push('CategorySelection', { diff --git a/src/screens/profile/ProfileScreen.tsx b/src/screens/profile/ProfileScreen.tsx index 1b9a1049..0ea96cd2 100644 --- a/src/screens/profile/ProfileScreen.tsx +++ b/src/screens/profile/ProfileScreen.tsx @@ -3,7 +3,7 @@ import {StatusBar} from 'react-native'; import Animated from 'react-native-reanimated'; import {Content, Cover, TabsGradient} from '../../components'; import {RouteProp, useFocusEffect} from '@react-navigation/native'; -import {ProfileStackParams} from '../../routes/'; +import {MainStackParams} from '../../routes/'; import {resetScreenType} from '../../store/actions'; import {useDispatch, useStore} from 'react-redux'; import {DUMMY_USERID} from '../../store/initialStates'; @@ -13,7 +13,7 @@ import {DUMMY_USERID} from '../../store/initialStates'; * including posts, messaging, and settings */ -type ProfileScreenRouteProps = RouteProp; +type ProfileScreenRouteProps = RouteProp; interface ProfileOnboardingProps { route: ProfileScreenRouteProps; -- cgit v1.2.3-70-g09d2