diff options
author | Ashm Walia <40498934+ashmgarv@users.noreply.github.com> | 2021-01-14 11:12:13 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-14 14:12:13 -0500 |
commit | ee9ad07d1309b902365dc92357dad2937f62b09d (patch) | |
tree | b3d403d04970f0a62b63c213128e9899988c2812 /src/components/profile/Content.tsx | |
parent | 3a45a0812743e3f2fd48eb6648f046ea35512380 (diff) |
Fix (#182)
Diffstat (limited to 'src/components/profile/Content.tsx')
-rw-r--r-- | src/components/profile/Content.tsx | 26 |
1 files changed, 20 insertions, 6 deletions
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<ContentProps> = ({y, userXId, screenType}) => { const [shouldBounce, setShouldBounce] = useState<boolean>(true); const [refreshing, setRefreshing] = useState<boolean>(false); - //These two booleans are used to see if user closed the pormpt displayed to them const [isStageTwoPromptClosed, setIsStageTwoPromptClosed] = useState<boolean>( false, ); + const [isStageOnePromptClosed, setIsStageOnePromptClosed] = useState<boolean>( + false, + ); const [isStageThreePromptClosed, setIsStageThreePromptClosed] = useState< boolean >(false); @@ -145,7 +147,7 @@ const Content: React.FC<ContentProps> = ({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<ContentProps> = ({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<ContentProps> = ({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<ContentProps> = ({y, userXId, screenType}) => { /> ), )} - {!userXId && profile.profile_completion_stage !== 1 && ( + {!userXId && ( <TouchableOpacity onPress={() => navigation.push('CategorySelection', { |