ProfilePage.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. import { StyleSheet, Text, View, ScrollView, FlatList } from 'react-native'
  2. import React, { useState } from 'react'
  3. import { horizontalScale, moderateScale, verticalScale } from '../../constants/metrics';
  4. import colors from '../../constants/colors';
  5. import fonts from '../../constants/fonts';
  6. import NewscoutTitleHeader from '../../components/molecules/Header/NewscoutTitleHeader';
  7. import SettingsButton from '../../components/atoms/Buttons/SettingsButton';
  8. import EditButton from '../../components/atoms/Buttons/EditButton';
  9. import ProfileImageCard from '../../components/molecules/Cards/ProfileImageCard';
  10. import { ToggleButton } from 'react-native-paper';
  11. import HorizontalNewsCardVariant from '../../components/molecules/Cards/HorizontalNewsCardVariant';
  12. const profileTabs = ['Recently Read', 'Others'];
  13. const ProfilePage = props => {
  14. const { navigation, route } = props
  15. const [categoryValue, setCategoryValue] = useState(
  16. profileTabs[0].toLowerCase(),
  17. );
  18. const styles = StyleSheet.create({
  19. profileContainer: {
  20. backgroundColor: colors().dominant,
  21. },
  22. metricsCountContainer: {
  23. flexDirection: 'row',
  24. alignItems: 'center',
  25. justifyContent: 'space-evenly',
  26. paddingVertical: verticalScale(20),
  27. paddingHorizontal: horizontalScale(16),
  28. },
  29. metricsCard: {},
  30. metricsTitle: {
  31. color: colors().primaryColor,
  32. fontFamily: fonts.type.medium,
  33. fontSize: 16,
  34. },
  35. metricsCount: {
  36. color: colors().recessive,
  37. fontFamily: fonts.type.semibold,
  38. fontSize: moderateScale(16),
  39. textAlign: 'center',
  40. },
  41. verticalLine: {
  42. height: '100%',
  43. width: 2,
  44. backgroundColor: colors().grayShade_400,
  45. },
  46. underlinePillContainer: {
  47. paddingVertical: verticalScale(8),
  48. flexDirection: 'row',
  49. alignItems: 'space-between',
  50. justifyContent: 'space-around',
  51. paddingHorizontal: horizontalScale(16),
  52. },
  53. selectedPillText: {
  54. fontFamily: fonts.type.semibold,
  55. fontSize: moderateScale(12),
  56. color: colors().recessive,
  57. borderBottomWidth: verticalScale(4),
  58. borderBottomColor: colors().primaryColor,
  59. borderRadius: 0,
  60. },
  61. pillText: {
  62. fontFamily: fonts.type.semibold,
  63. fontSize: moderateScale(12),
  64. color: colors().grayShade_100,
  65. },
  66. underlinePill: {
  67. width: 'auto',
  68. },
  69. profileCardContainer: {
  70. paddingHorizontal: horizontalScale(16),
  71. paddingBottom: verticalScale(16)
  72. },
  73. });
  74. return (
  75. <View style={styles.profileContainer}>
  76. <ScrollView showsVerticalScrollIndicator={false}>
  77. <NewscoutTitleHeader
  78. title="My Profile"
  79. backButtonShown={true}
  80. onBackClick={() => navigation.goBack()}>
  81. <View style={{ flexDirection: 'row', gap: 16 }}>
  82. <SettingsButton onPress={() => navigation.navigate('SettingsPage')} />
  83. <EditButton
  84. onPress={() =>
  85. navigation.navigate('Profile', { screen: 'EditProfile' })
  86. }
  87. />
  88. </View>
  89. </NewscoutTitleHeader>
  90. <ProfileImageCard onEdit={() => navigation.navigate('Profile', { screen: 'EditProfile' })} />
  91. <Text
  92. style={{
  93. alignSelf: 'center',
  94. paddingVertical: 8,
  95. fontFamily: fonts.type.semibold,
  96. fontSize: moderateScale(14),
  97. color: colors().recessive,
  98. }}>
  99. Semina Gurung
  100. </Text>
  101. <Text
  102. style={{
  103. paddingHorizontal: horizontalScale(16),
  104. fontFamily: fonts.type.regular,
  105. fontSize: moderateScale(12),
  106. color: colors().recessive,
  107. textAlign:'center'
  108. }}>
  109. The reason behind their disappointment is that iPhone users have
  110. been..
  111. </Text>
  112. <View style={styles.metricsCountContainer}>
  113. <View style={styles.metricsCard}>
  114. <Text style={styles.metricsCount}>158</Text>
  115. <Text style={styles.metricsTitle}>Bookmarks</Text>
  116. </View>
  117. <View style={styles.verticalLine}></View>
  118. <View style={styles.metricsCard}>
  119. <Text style={styles.metricsCount}>158</Text>
  120. <Text style={styles.metricsTitle}>Followers</Text>
  121. </View>
  122. <View style={styles.verticalLine}></View>
  123. <View style={styles.metricsCard}>
  124. <Text style={styles.metricsCount}>158</Text>
  125. <Text style={styles.metricsTitle}>Following</Text>
  126. </View>
  127. </View>
  128. <View style={styles.underlinePillContainer}>
  129. {/* <ScrollView horizontal showsHorizontalScrollIndicator={false}> */}
  130. <ToggleButton.Group onValueChange={value => setCategoryValue(value)}>
  131. {profileTabs.map(tab => {
  132. let valueId = tab.toLowerCase();
  133. return (
  134. <ToggleButton
  135. icon={() => (
  136. <Text
  137. style={[
  138. valueId === categoryValue
  139. ? styles.selectedPillText
  140. : styles.pillText,
  141. {
  142. paddingHorizontal: horizontalScale(11),
  143. fontSize: moderateScale(16),
  144. },
  145. ]}>
  146. {tab}
  147. </Text>
  148. )}
  149. style={[styles.underlinePill]}
  150. value={valueId}
  151. />
  152. );
  153. })}
  154. </ToggleButton.Group>
  155. {/* </ScrollView> */}
  156. </View>
  157. <View style={styles.profileCardContainer}>
  158. <FlatList
  159. scrollEnabled={false}
  160. showsVerticalScrollIndicator={false}
  161. ItemSeparatorComponent={() => (
  162. <View style={{ height: verticalScale(8) }}></View>
  163. )}
  164. // ListFooterComponent={() => <View style={{height: fonts.getSize(16)}}></View>}
  165. ListHeaderComponent={() => (
  166. <View style={{ height: verticalScale(16) }}></View>
  167. )}
  168. data={[{}, {}, {}]}
  169. renderItem={item => <HorizontalNewsCardVariant onPress={true} />}
  170. keyExtractor={item => item.index}
  171. />
  172. </View>
  173. </ScrollView>
  174. </View>
  175. )
  176. }
  177. export default ProfilePage
  178. const styles = StyleSheet.create({})