diff options
author | Ivan Chen <ivan@tagg.id> | 2021-03-29 18:30:48 -0400 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-03-29 18:30:48 -0400 |
commit | 5b82b32d00f85f1fa27d9812f73a4f3e6c00d204 (patch) | |
tree | c700848d62f2da4cdf2767552576d401f03f5b63 /src/components/profile/PublicProfile.tsx | |
parent | d5669f3d08bee68b37f51727e499e84610685422 (diff) |
fixed scrolling to top on every focus
Diffstat (limited to 'src/components/profile/PublicProfile.tsx')
-rw-r--r-- | src/components/profile/PublicProfile.tsx | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/components/profile/PublicProfile.tsx b/src/components/profile/PublicProfile.tsx index 188292f0..88e0ecd1 100644 --- a/src/components/profile/PublicProfile.tsx +++ b/src/components/profile/PublicProfile.tsx @@ -89,15 +89,17 @@ const PublicProfile: React.FC<ContentProps> = ({ */ useFocusEffect( useCallback(() => { - setScrollEnabled(false); const navigateToMomentUploadPrompt = () => { switch (profile.profile_completion_stage) { case 1: if ( momentCategories && momentCategories[0] && - !isStageOnePromptClosed + !isStageOnePromptClosed && + scrollViewRef.current ) { + setScrollEnabled(false); + scrollViewRef.current.getNode().scrollTo({y: 0}); navigation.navigate('MomentUploadPrompt', { screenType, momentCategory: momentCategories[0], @@ -118,19 +120,16 @@ const PublicProfile: React.FC<ContentProps> = ({ }; if (!userXId) { setTimeout(() => { - if (scrollViewRef.current) { - scrollViewRef.current.getNode().scrollTo({y: 0}); - } navigateToMomentUploadPrompt(); setScrollEnabled(true); }, 2000); } }, [ - setScrollEnabled, userXId, profile.profile_completion_stage, momentCategories, isStageOnePromptClosed, + setScrollEnabled, navigation, screenType, profileBodyHeight, |