aboutsummaryrefslogtreecommitdiff
path: root/src/routes/profile
diff options
context:
space:
mode:
authorAshm Walia <40498934+ashmgarv@users.noreply.github.com>2020-10-19 17:14:37 -0700
committerGitHub <noreply@github.com>2020-10-19 20:14:37 -0400
commit88fb33d1fe1cd0785e4a92cb3c20d0fafb2da54d (patch)
treeb2e8d474b2c0b02f4e91cd33fa0d5f9842d3a018 /src/routes/profile
parent1b7fef188ec2aee0706fc1204432315db3d4fec6 (diff)
Merged changes to make sure moments view and search work (#62)
Diffstat (limited to 'src/routes/profile')
-rw-r--r--src/routes/profile/MomentStack.tsx11
-rw-r--r--src/routes/profile/MomentStackScreen.tsx46
-rw-r--r--src/routes/profile/Profile.tsx45
-rw-r--r--src/routes/profile/ProfileStack.tsx5
-rw-r--r--src/routes/profile/index.ts4
5 files changed, 43 insertions, 68 deletions
diff --git a/src/routes/profile/MomentStack.tsx b/src/routes/profile/MomentStack.tsx
deleted file mode 100644
index 83853c99..00000000
--- a/src/routes/profile/MomentStack.tsx
+++ /dev/null
@@ -1,11 +0,0 @@
-import {createStackNavigator} from '@react-navigation/stack';
-import {MomentType} from '../../types';
-
-export type MomentStackParams = {
- Profile: undefined;
- IndividualMoment: {
- moment: MomentType;
- };
-};
-
-export const MomentStack = createStackNavigator<MomentStackParams>();
diff --git a/src/routes/profile/MomentStackScreen.tsx b/src/routes/profile/MomentStackScreen.tsx
deleted file mode 100644
index 8768199a..00000000
--- a/src/routes/profile/MomentStackScreen.tsx
+++ /dev/null
@@ -1,46 +0,0 @@
-import React from 'react';
-import {IndividualMoment} from '../../screens';
-import {MomentStack} from './MomentStack';
-import Profile from './Profile';
-
-const MomentStackScreen: React.FC = () => {
- return (
- <MomentStack.Navigator
- screenOptions={{
- headerShown: false,
- cardStyle: {backgroundColor: 'transparent'},
- cardOverlayEnabled: true,
- cardStyleInterpolator: ({current: {progress}}) => ({
- cardStyle: {
- opacity: progress.interpolate({
- inputRange: [0, 0.5, 0.9, 1],
- outputRange: [0, 0.25, 0.7, 1],
- }),
- },
- overlayStyle: {
- backgroundColor: '#808080',
- opacity: progress.interpolate({
- inputRange: [0, 1],
- outputRange: [0, 0.9],
- extrapolate: 'clamp',
- }),
- },
- }),
- }}
- initialRouteName="Profile"
- mode="modal">
- <MomentStack.Screen
- name="Profile"
- component={Profile}
- options={{headerShown: false}}
- />
- <MomentStack.Screen
- name="IndividualMoment"
- component={IndividualMoment}
- options={{headerShown: false}}
- />
- </MomentStack.Navigator>
- );
-};
-
-export default MomentStackScreen;
diff --git a/src/routes/profile/Profile.tsx b/src/routes/profile/Profile.tsx
index b39b726e..363e9e21 100644
--- a/src/routes/profile/Profile.tsx
+++ b/src/routes/profile/Profile.tsx
@@ -1,29 +1,52 @@
import React from 'react';
import {
- ProfileScreen,
+ IndividualMoment,
CaptionScreen,
SocialMediaTaggs,
SearchScreen,
+ ProfileScreen,
} from '../../screens';
-import {RouteProp} from '@react-navigation/native';
import {ProfileStack, ProfileStackParams} from './ProfileStack';
+import {RouteProp} from '@react-navigation/native';
import {AvatarTitle} from '../../components';
-type ProfileScreenRouteProps = RouteProp<ProfileStackParams, 'Profile'>;
+type ProfileStackRouteProps = RouteProp<ProfileStackParams, 'Profile'>;
-interface ProfileScreenProps {
- route: ProfileScreenRouteProps;
+interface ProfileStackProps {
+ route: ProfileStackRouteProps;
}
-const Profile: React.FC<ProfileScreenProps> = ({route}) => {
+const Profile: React.FC<ProfileStackProps> = ({route}) => {
const {isProfileView} = route.params;
return (
<ProfileStack.Navigator
- initialRouteName={!isProfileView ? `Profile` : `Search`}
- screenOptions={{headerShown: false}}>
+ screenOptions={{
+ headerShown: false,
+ cardStyle: {backgroundColor: 'transparent'},
+ cardOverlayEnabled: true,
+ cardStyleInterpolator: ({current: {progress}}) => ({
+ cardStyle: {
+ opacity: progress.interpolate({
+ inputRange: [0, 0.5, 0.9, 1],
+ outputRange: [0, 0.25, 0.7, 1],
+ }),
+ },
+ overlayStyle: {
+ backgroundColor: '#808080',
+ opacity: progress.interpolate({
+ inputRange: [0, 1],
+ outputRange: [0, 0.9],
+ extrapolate: 'clamp',
+ }),
+ },
+ }),
+ }}
+ mode="modal"
+ initialRouteName={!isProfileView ? `Profile` : `Search`}>
<ProfileStack.Screen
name="Profile"
component={ProfileScreen}
+ options={{headerShown: false}}
initialParams={{isProfileView: isProfileView}}
/>
{isProfileView ? (
@@ -47,6 +70,12 @@ const Profile: React.FC<ProfileScreenProps> = ({route}) => {
) : (
<React.Fragment />
)}
+ <ProfileStack.Screen
+ name="IndividualMoment"
+ component={IndividualMoment}
+ options={{headerShown: false}}
+ initialParams={{isProfileView: isProfileView}}
+ />
</ProfileStack.Navigator>
);
};
diff --git a/src/routes/profile/ProfileStack.tsx b/src/routes/profile/ProfileStack.tsx
index df4d234f..1d7b907e 100644
--- a/src/routes/profile/ProfileStack.tsx
+++ b/src/routes/profile/ProfileStack.tsx
@@ -1,4 +1,5 @@
import {createStackNavigator} from '@react-navigation/stack';
+import {MomentType} from '../../types';
export type ProfileStackParams = {
Search: undefined;
@@ -14,6 +15,10 @@ export type ProfileStackParams = {
title: string;
image: object;
};
+ IndividualMoment: {
+ moment: MomentType;
+ isProfileView: boolean;
+ };
};
export const ProfileStack = createStackNavigator<ProfileStackParams>();
diff --git a/src/routes/profile/index.ts b/src/routes/profile/index.ts
index 1ab9cb7e..eed5c6b4 100644
--- a/src/routes/profile/index.ts
+++ b/src/routes/profile/index.ts
@@ -1,4 +1,2 @@
export * from './ProfileStack';
-export * from './MomentStack';
-export * from './MomentStackScreen';
-export {default} from './Profile';
+export * from './Profile';