diff options
Diffstat (limited to 'src/components/profile/PublicProfile.tsx')
-rw-r--r-- | src/components/profile/PublicProfile.tsx | 22 |
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, ]), ); |