aboutsummaryrefslogtreecommitdiff
path: root/src/components/profile/Content.tsx
diff options
context:
space:
mode:
authorLeon Jiang <35908040+leonyjiang@users.noreply.github.com>2020-08-05 14:15:06 -0700
committerGitHub <noreply@github.com>2020-08-05 17:15:06 -0400
commit1279249ee9355f88913578f51e3b0bf7d99672f6 (patch)
tree4a72890af331ffc818fffc9fb5395a80efe2d7de /src/components/profile/Content.tsx
parentf9cf9b5d89d5e25b227814f0fc759257564cea89 (diff)
[TMA-122] User Profile Screen UI (#27)
* Fix yarn lint issues * Add react-native-svg to project * Create UserType & PostType * Create temporary Post component * Fix import cycle warning, update AuthContext * Update onboarding screen imports * Update config files * Add rn-fetch-blob package * Update types * Add profile fetching to AuthContext * Update post component * Import placeholder images from designs * Add profile UI components * Create screen offset constants * Add new api endpoints * Create screen layout utils * Create Profile screen UI * Remove some unused styling * Restructure ProfileScreen and fix animations * Add gradient back to screen * Update Moment circle styling
Diffstat (limited to 'src/components/profile/Content.tsx')
-rw-r--r--src/components/profile/Content.tsx58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/components/profile/Content.tsx b/src/components/profile/Content.tsx
new file mode 100644
index 00000000..82b5fdc0
--- /dev/null
+++ b/src/components/profile/Content.tsx
@@ -0,0 +1,58 @@
+import React, {useState} from 'react';
+import {StyleSheet, LayoutChangeEvent} from 'react-native';
+import Animated from 'react-native-reanimated';
+const {ScrollView} = Animated;
+
+import {UserType} from '../../types';
+import ProfileCutout from './ProfileCutout';
+import ProfileHeader from './ProfileHeader';
+import ProfileBody from './ProfileBody';
+import MomentsBar from './MomentsBar';
+import Feed from './Feed';
+import LinearGradient from 'react-native-linear-gradient';
+import {SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils';
+
+interface ContentProps {
+ y: Animated.Value<number>;
+ user: UserType;
+}
+const Content: React.FC<ContentProps> = ({y, user}) => {
+ const [profileBodyHeight, setProfileBodyHeight] = useState(0);
+ const onLayout = (e: LayoutChangeEvent) => {
+ const {height} = e.nativeEvent.layout;
+ setProfileBodyHeight(height);
+ };
+ return (
+ <ScrollView
+ style={styles.container}
+ onScroll={(e) => y.setValue(e.nativeEvent.contentOffset.y)}
+ showsVerticalScrollIndicator={false}
+ scrollEventThrottle={1}
+ stickyHeaderIndices={[2, 4]}>
+ <ProfileCutout>
+ <ProfileHeader />
+ </ProfileCutout>
+ <ProfileBody {...{onLayout}} />
+ <MomentsBar {...{y, profileBodyHeight}} />
+ <Feed {...{user}} />
+ <LinearGradient
+ locations={[0.89, 1]}
+ colors={['transparent', 'rgba(0, 0, 0, 0.6)']}
+ style={styles.gradient}
+ />
+ </ScrollView>
+ );
+};
+
+const styles = StyleSheet.create({
+ container: {
+ flex: 1,
+ },
+ gradient: {
+ height: SCREEN_HEIGHT,
+ width: SCREEN_WIDTH,
+ position: 'absolute',
+ },
+});
+
+export default Content;