aboutsummaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/components')
-rw-r--r--src/components/common/TaggPrompt.tsx2
-rw-r--r--src/components/profile/Content.tsx9
-rw-r--r--src/components/profile/Friends.tsx8
-rw-r--r--src/components/profile/PublicProfile.tsx3
-rw-r--r--src/components/taggs/TaggsBar.tsx14
5 files changed, 25 insertions, 11 deletions
diff --git a/src/components/common/TaggPrompt.tsx b/src/components/common/TaggPrompt.tsx
index 721b1eb8..5e125d00 100644
--- a/src/components/common/TaggPrompt.tsx
+++ b/src/components/common/TaggPrompt.tsx
@@ -68,7 +68,7 @@ const styles = StyleSheet.create({
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'white',
- height: isIPhoneX() ? SCREEN_HEIGHT / 6 : SCREEN_HEIGHT / 5,
+ height: SCREEN_HEIGHT / 4,
},
closeButton: {
position: 'relative',
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,
]),
);
diff --git a/src/components/taggs/TaggsBar.tsx b/src/components/taggs/TaggsBar.tsx
index 87dabc3d..a5003fbb 100644
--- a/src/components/taggs/TaggsBar.tsx
+++ b/src/components/taggs/TaggsBar.tsx
@@ -1,16 +1,17 @@
import React, {useEffect, useState} from 'react';
-import {StyleSheet} from 'react-native';
+import {LayoutChangeEvent, StyleSheet} from 'react-native';
import Animated, {
- useDerivedValue,
- interpolate,
Extrapolate,
+ interpolate,
useAnimatedStyle,
+ useDerivedValue,
} from 'react-native-reanimated';
+import {useSafeAreaInsets} from 'react-native-safe-area-context';
import {useDispatch, useSelector, useStore} from 'react-redux';
import {
INTEGRATED_SOCIAL_LIST,
- SOCIAL_LIST,
PROFILE_CUTOUT_BOTTOM_Y,
+ SOCIAL_LIST,
} from '../../constants';
import {getLinkedSocials} from '../../services';
import {loadIndividualSocial, updateSocial} from '../../store/actions';
@@ -18,7 +19,6 @@ import {RootState} from '../../store/rootReducer';
import {ScreenType} from '../../types';
import {canViewProfile} from '../../utils';
import Tagg from './Tagg';
-import {useSafeAreaInsets} from 'react-native-safe-area-context';
const {View, ScrollView} = Animated;
interface TaggsBarProps {
@@ -27,6 +27,7 @@ interface TaggsBarProps {
userXId: string | undefined;
screenType: ScreenType;
linkedSocials?: string[];
+ onLayout: (event: LayoutChangeEvent) => void;
}
const TaggsBar: React.FC<TaggsBarProps> = ({
y,
@@ -34,6 +35,7 @@ const TaggsBar: React.FC<TaggsBarProps> = ({
userXId,
screenType,
linkedSocials,
+ onLayout,
}) => {
let [taggs, setTaggs] = useState<Object[]>([]);
let [taggsNeedUpdate, setTaggsNeedUpdate] = useState(true);
@@ -140,7 +142,7 @@ const TaggsBar: React.FC<TaggsBarProps> = ({
}));
return taggs.length > 0 ? (
- <View style={[styles.container, animatedStyles]}>
+ <View style={[styles.container, animatedStyles]} onLayout={onLayout}>
<ScrollView
horizontal
showsHorizontalScrollIndicator={false}