aboutsummaryrefslogtreecommitdiff
path: root/src/components/profile/PublicProfile.tsx
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-03-29 18:31:35 -0400
committerGitHub <noreply@github.com>2021-03-29 18:31:35 -0400
commit63bd7841343ecc7f15f0f645e515a8e962584f07 (patch)
treec700848d62f2da4cdf2767552576d401f03f5b63 /src/components/profile/PublicProfile.tsx
parentb0e4fe55be8983079f499b923e953855afeb2c64 (diff)
parent5b82b32d00f85f1fa27d9812f73a4f3e6c00d204 (diff)
Merge pull request #336 from leonyjiang/tma739-bugfix-profile-onboarding-tutorial
[TMA-739] Bugfix — First Moment Tutorial
Diffstat (limited to 'src/components/profile/PublicProfile.tsx')
-rw-r--r--src/components/profile/PublicProfile.tsx22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/components/profile/PublicProfile.tsx b/src/components/profile/PublicProfile.tsx
index 9683d8f2..88e0ecd1 100644
--- a/src/components/profile/PublicProfile.tsx
+++ b/src/components/profile/PublicProfile.tsx
@@ -30,7 +30,13 @@ import {moveCategory, normalize, SCREEN_HEIGHT} from '../../utils';
import {TaggPrompt} from '../common';
import {Moment} from '../moments';
-const PublicProfile: React.FC<ContentProps> = ({userXId, screenType}) => {
+const PublicProfile: React.FC<ContentProps> = ({
+ userXId,
+ screenType,
+ setScrollEnabled,
+ profileBodyHeight,
+ scrollViewRef,
+}) => {
const dispatch = useDispatch();
const {profile = NO_PROFILE} = useSelector((state: RootState) =>
@@ -89,11 +95,15 @@ const PublicProfile: React.FC<ContentProps> = ({userXId, screenType}) => {
if (
momentCategories &&
momentCategories[0] &&
- !isStageOnePromptClosed
+ !isStageOnePromptClosed &&
+ scrollViewRef.current
) {
+ setScrollEnabled(false);
+ scrollViewRef.current.getNode().scrollTo({y: 0});
navigation.navigate('MomentUploadPrompt', {
screenType,
momentCategory: momentCategories[0],
+ profileBodyHeight,
});
setIsStageOnePromptClosed(true);
}
@@ -109,15 +119,21 @@ const PublicProfile: React.FC<ContentProps> = ({userXId, screenType}) => {
}
};
if (!userXId) {
- setTimeout(navigateToMomentUploadPrompt, 2000);
+ setTimeout(() => {
+ navigateToMomentUploadPrompt();
+ setScrollEnabled(true);
+ }, 2000);
}
}, [
userXId,
profile.profile_completion_stage,
momentCategories,
isStageOnePromptClosed,
+ setScrollEnabled,
navigation,
screenType,
+ profileBodyHeight,
+ scrollViewRef,
]),
);