diff options
| author | Shravya Ramesh <37447613+shravyaramesh@users.noreply.github.com> | 2021-02-11 14:06:04 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-11 14:06:04 -0800 |
| commit | bcede9945a10ce7bf67aeeaf7f94e1a8984e7c0d (patch) | |
| tree | 229e130c90307507e68f17b016f81cf310822ccf /src/screens/profile | |
| parent | da61f04d037d92fce7cf9852a3be79eb41158d5a (diff) | |
| parent | 2561d20e17a697726d6b77accf79c9da2d1f6ef6 (diff) | |
Merge branch 'master' into tma641-animation-tutorial
Diffstat (limited to 'src/screens/profile')
| -rw-r--r-- | src/screens/profile/FriendsListScreen.tsx | 58 | ||||
| -rw-r--r-- | src/screens/profile/MomentCommentsScreen.tsx | 31 |
2 files changed, 27 insertions, 62 deletions
diff --git a/src/screens/profile/FriendsListScreen.tsx b/src/screens/profile/FriendsListScreen.tsx index b2123f44..1cfef058 100644 --- a/src/screens/profile/FriendsListScreen.tsx +++ b/src/screens/profile/FriendsListScreen.tsx @@ -1,21 +1,14 @@ +import {RouteProp} from '@react-navigation/native'; import React from 'react'; -import {RouteProp, useNavigation} from '@react-navigation/native'; -import {TabsGradient, Friends} from '../../components'; -import {normalize, SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils'; -import { - SafeAreaView, - StyleSheet, - Text, - TouchableOpacity, - View, -} from 'react-native'; -import {ProfileStackParams} from '../../routes'; +import {SafeAreaView, StyleSheet, View} from 'react-native'; import {useSelector} from 'react-redux'; +import {Friends, TabsGradient} from '../../components'; +import {MainStackParams} from '../../routes'; import {RootState} from '../../store/rootReducer'; -import BackIcon from '../../assets/icons/back-arrow.svg'; +import {HeaderHeight, SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils'; type FriendsListScreenRouteProp = RouteProp< - ProfileStackParams, + MainStackParams, 'FriendsListScreen' >; interface FriendsListScreenProps { @@ -24,7 +17,6 @@ interface FriendsListScreenProps { const FriendsListScreen: React.FC<FriendsListScreenProps> = ({route}) => { const {userXId, screenType} = route.params; - const navigation = useNavigation(); const {friends} = userXId ? useSelector((state: RootState) => state.userX[screenType][userXId]) @@ -33,17 +25,9 @@ const FriendsListScreen: React.FC<FriendsListScreenProps> = ({route}) => { return ( <> <SafeAreaView> - <View style={styles.header}> - <TouchableOpacity - style={styles.headerButton} - onPress={() => { - navigation.pop(); - }}> - <BackIcon height={'100%'} width={'100%'} color={'white'} /> - </TouchableOpacity> - <Text style={styles.headerText}>Friends</Text> + <View style={styles.body}> + <Friends result={friends} screenType={screenType} userId={userXId} /> </View> - <Friends result={friends} screenType={screenType} userId={userXId} /> </SafeAreaView> <TabsGradient /> </> @@ -55,31 +39,11 @@ const styles = StyleSheet.create({ backgroundColor: 'white', height: '100%', }, - header: { - flexDirection: 'column', - justifyContent: 'center', - height: SCREEN_HEIGHT * 0.05, - padding: '3%', - paddingBottom: 0, - marginTop: '1%', - }, - headerText: { - position: 'absolute', - alignSelf: 'center', - fontSize: normalize(18), - fontWeight: '700', - lineHeight: normalize(21.48), - letterSpacing: normalize(1.3), - }, - headerButton: { - width: '5%', - aspectRatio: 1, - padding: 0, - marginLeft: '5%', - alignSelf: 'flex-start', - marginBottom: '1%', + backButton: { + marginLeft: 10, }, body: { + marginTop: HeaderHeight, width: SCREEN_WIDTH, height: SCREEN_HEIGHT * 0.8, }, diff --git a/src/screens/profile/MomentCommentsScreen.tsx b/src/screens/profile/MomentCommentsScreen.tsx index ec193db5..b0208f6f 100644 --- a/src/screens/profile/MomentCommentsScreen.tsx +++ b/src/screens/profile/MomentCommentsScreen.tsx @@ -1,15 +1,19 @@ import {RouteProp, useNavigation} from '@react-navigation/native'; -import React, {useState} from 'react'; -import {StyleSheet, Text, TouchableOpacity, View} from 'react-native'; +import React, {useEffect, useState} from 'react'; +import {StyleSheet, View} from 'react-native'; import {SafeAreaView} from 'react-native-safe-area-context'; -import BackIcon from '../../assets/icons/back-arrow.svg'; import {TabsGradient} from '../../components'; import {AddComment} from '../../components/'; import CommentsContainer from '../../components/comments/CommentsContainer'; import {ADD_COMMENT_TEXT} from '../../constants/strings'; -import {MainStackParams} from '../../routes/main'; +import {headerBarOptions, MainStackParams} from '../../routes/main'; import {CommentType} from '../../types'; -import {normalize, SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils'; +import { + HeaderHeight, + normalize, + SCREEN_HEIGHT, + SCREEN_WIDTH, +} from '../../utils'; /** * Comments Screen for an image uploaded @@ -39,19 +43,15 @@ const MomentCommentsScreen: React.FC<MomentCommentsScreenProps> = ({route}) => { CommentType | undefined >(undefined); + useEffect(() => { + navigation.setOptions({ + ...headerBarOptions('black', `${commentsLength} Comments`), + }); + }, [commentsLength, navigation]); + return ( <View style={styles.background}> <SafeAreaView> - <View style={styles.header}> - <TouchableOpacity - style={styles.headerButton} - onPress={() => { - navigation.pop(); - }}> - <BackIcon height={'100%'} width={'100%'} color={'white'} /> - </TouchableOpacity> - <Text style={styles.headerText}>{commentsLength + ' Comments'}</Text> - </View> <View style={styles.body}> <CommentsContainer objectId={moment_id} @@ -110,6 +110,7 @@ const styles = StyleSheet.create({ fontWeight: '400', }, body: { + marginTop: HeaderHeight, width: SCREEN_WIDTH * 0.9, height: SCREEN_HEIGHT * 0.8, paddingTop: '3%', |
