diff options
Diffstat (limited to 'src/components/profile')
| -rw-r--r-- | src/components/profile/Content.tsx | 9 | ||||
| -rw-r--r-- | src/components/profile/Friends.tsx | 8 | ||||
| -rw-r--r-- | src/components/profile/PublicProfile.tsx | 3 |
3 files changed, 16 insertions, 4 deletions
diff --git a/src/components/profile/Content.tsx b/src/components/profile/Content.tsx index dd68ab17..05098d14 100644 --- a/src/components/profile/Content.tsx +++ b/src/components/profile/Content.tsx @@ -67,6 +67,8 @@ const Content: React.FC<ContentProps> = ({userXId, screenType}) => { */ const [isBlocked, setIsBlocked] = useState<boolean>(false); const [profileBodyHeight, setProfileBodyHeight] = useState(0); + const [socialsBarHeight, setSocialsBarHeight] = useState(0); + const [shouldBounce, setShouldBounce] = useState<boolean>(true); const [refreshing, setRefreshing] = useState<boolean>(false); const onRefresh = useCallback(() => { @@ -88,6 +90,11 @@ const Content: React.FC<ContentProps> = ({userXId, screenType}) => { setProfileBodyHeight(height); }; + const onSocialsBarLayout = (e: LayoutChangeEvent) => { + const {height} = e.nativeEvent.layout; + setSocialsBarHeight(height); + }; + useEffect(() => { const isActuallyBlocked = blockedUsers.some( (cur_user) => user.username === cur_user.username, @@ -152,6 +159,7 @@ const Content: React.FC<ContentProps> = ({userXId, screenType}) => { /> <TaggsBar {...{y, profileBodyHeight, userXId, screenType}} + onLayout={onSocialsBarLayout} /> {canViewProfile(state, userXId, screenType) ? ( <PublicProfile @@ -161,6 +169,7 @@ const Content: React.FC<ContentProps> = ({userXId, screenType}) => { screenType, setScrollEnabled, profileBodyHeight, + socialsBarHeight, scrollViewRef, }} /> diff --git a/src/components/profile/Friends.tsx b/src/components/profile/Friends.tsx index 44f6bb48..c1dca755 100644 --- a/src/components/profile/Friends.tsx +++ b/src/components/profile/Friends.tsx @@ -27,7 +27,7 @@ interface FriendsProps { const Friends: React.FC<FriendsProps> = ({result, screenType, userId}) => { const state: RootState = useStore().getState(); const dispatch = useDispatch(); - const {user: loggedInUser = NO_USER} = state; + const {user: loggedInUser = NO_USER} = state.user; const navigation = useNavigation(); const [usersFromContacts, setUsersFromContacts] = useState< ProfilePreviewType[] @@ -39,7 +39,7 @@ const Friends: React.FC<FriendsProps> = ({result, screenType, userId}) => { const permission = await checkPermission(); if (permission === 'authorized') { let response = await usersFromContactsService(contacts); - await setUsersFromContacts(response.existing_tagg_users); + setUsersFromContacts(response.existing_tagg_users); } else { console.log('Authorize access to contacts'); } @@ -84,10 +84,10 @@ const Friends: React.FC<FriendsProps> = ({result, screenType, userId}) => { return ( <> - {loggedInUser.userId === userId && ( + {loggedInUser.userId === userId && usersFromContacts.length !== 0 && ( <View style={styles.subheader}> <View style={styles.addFriendHeaderContainer}> - <Text style={[styles.subheaderText]}>Contacts on tagg</Text> + <Text style={[styles.subheaderText]}>Contacts on Tagg</Text> </View> <UsersFromContacts /> </View> diff --git a/src/components/profile/PublicProfile.tsx b/src/components/profile/PublicProfile.tsx index 5f9b0b99..1c49bff5 100644 --- a/src/components/profile/PublicProfile.tsx +++ b/src/components/profile/PublicProfile.tsx @@ -35,6 +35,7 @@ const PublicProfile: React.FC<ContentProps> = ({ screenType, setScrollEnabled, profileBodyHeight, + socialsBarHeight, scrollViewRef, }) => { const dispatch = useDispatch(); @@ -104,6 +105,7 @@ const PublicProfile: React.FC<ContentProps> = ({ screenType, momentCategory: momentCategories[0], profileBodyHeight, + socialsBarHeight, }); setIsStageOnePromptClosed(true); } @@ -133,6 +135,7 @@ const PublicProfile: React.FC<ContentProps> = ({ navigation, screenType, profileBodyHeight, + socialsBarHeight, scrollViewRef, ]), ); |
