diff options
Diffstat (limited to 'src/routes')
| -rw-r--r-- | src/routes/index.ts | 2 | ||||
| -rw-r--r-- | src/routes/main/MainStackNavigator.tsx (renamed from src/routes/profile/ProfileStackNavigator.tsx) | 7 | ||||
| -rw-r--r-- | src/routes/main/MainStackScreen.tsx (renamed from src/routes/profile/ProfileStackScreen.tsx) | 76 | ||||
| -rw-r--r-- | src/routes/main/index.ts | 2 | ||||
| -rw-r--r-- | src/routes/profile/index.ts | 2 | ||||
| -rw-r--r-- | src/routes/tabs/NavigationBar.tsx | 15 |
6 files changed, 62 insertions, 42 deletions
diff --git a/src/routes/index.ts b/src/routes/index.ts index 3b74e130..ed61d92f 100644 --- a/src/routes/index.ts +++ b/src/routes/index.ts @@ -1,3 +1,3 @@ export * from './onboarding'; -export * from './profile'; +export * from './main'; export {default} from './Routes'; diff --git a/src/routes/profile/ProfileStackNavigator.tsx b/src/routes/main/MainStackNavigator.tsx index bc0a9560..c156c725 100644 --- a/src/routes/profile/ProfileStackNavigator.tsx +++ b/src/routes/main/MainStackNavigator.tsx @@ -4,7 +4,7 @@ import {createStackNavigator} from '@react-navigation/stack'; import {CategorySelectionScreenType, MomentType, ScreenType} from '../../types'; -export type ProfileStackParams = { +export type MainStackParams = { Search: { screenType: ScreenType; }; @@ -45,6 +45,9 @@ export type ProfileStackParams = { categories: Array<string>; screenType: CategorySelectionScreenType; }; + Notifications: { + screenType: ScreenType; + }; }; -export const ProfileStack = createStackNavigator<ProfileStackParams>(); +export const MainStack = createStackNavigator<MainStackParams>(); diff --git a/src/routes/profile/ProfileStackScreen.tsx b/src/routes/main/MainStackScreen.tsx index 4fc9f0c7..cd053bde 100644 --- a/src/routes/profile/ProfileStackScreen.tsx +++ b/src/routes/main/MainStackScreen.tsx @@ -9,12 +9,14 @@ import { FollowersListScreen, EditProfile, CategorySelection, + NotificationsScreen, } from '../../screens'; -import {ProfileStack, ProfileStackParams} from './ProfileStackNavigator'; +import {MainStack, MainStackParams} from './MainStackNavigator'; import {RouteProp} from '@react-navigation/native'; import {ScreenType} from '../../types'; import {AvatarHeaderHeight} from '../../utils'; import {StackNavigationOptions} from '@react-navigation/stack'; +import {Screen} from 'react-native-screens'; /** * Trying to explain the purpose of each route on the stack (ACTUALLY A STACK) @@ -27,16 +29,29 @@ import {StackNavigationOptions} from '@react-navigation/stack'; * EditProfile : To edit logged in user's information. */ -type ProfileStackRouteProps = RouteProp<ProfileStackParams, 'Profile'>; +type MainStackRouteProps = RouteProp<MainStackParams, 'Profile'>; -interface ProfileStackProps { - route: ProfileStackRouteProps; +interface MainStackProps { + route: MainStackRouteProps; } -const ProfileStackScreen: React.FC<ProfileStackProps> = ({route}) => { +const MainStackScreen: React.FC<MainStackProps> = ({route}) => { const {screenType} = route.params; - const isProfileStack = screenType === ScreenType.Profile; + // const isProfileTab = screenType === ScreenType.Profile; + const isSearchTab = screenType === ScreenType.Search; + const isNotificationsTab = screenType === ScreenType.Notifications; + + const initialRouteName = (() => { + switch (screenType) { + case ScreenType.Profile: + return 'Profile'; + case ScreenType.Search: + return 'Search'; + case ScreenType.Notifications: + return 'Notifications'; + } + })(); const modalStyle: StackNavigationOptions = { cardStyle: {backgroundColor: 'transparent'}, @@ -61,13 +76,13 @@ const ProfileStackScreen: React.FC<ProfileStackProps> = ({route}) => { }; return ( - <ProfileStack.Navigator + <MainStack.Navigator screenOptions={{ headerShown: false, }} mode="card" - initialRouteName={isProfileStack ? 'Profile' : 'Search'}> - <ProfileStack.Screen + initialRouteName={initialRouteName}> + <MainStack.Screen name="Profile" component={ProfileScreen} options={{ @@ -82,16 +97,26 @@ const ProfileStackScreen: React.FC<ProfileStackProps> = ({route}) => { screenType, }} /> - {!isProfileStack ? ( - <ProfileStack.Screen + {isSearchTab && ( + <MainStack.Screen name="Search" component={SearchScreen} initialParams={{screenType}} /> - ) : ( - <React.Fragment /> )} - <ProfileStack.Screen + {isNotificationsTab && ( + <MainStack.Screen + name="Notifications" + component={NotificationsScreen} + initialParams={{screenType}} + /> + )} + <MainStack.Screen + name="CaptionScreen" + component={CaptionScreen} + options={{...modalStyle, gestureEnabled: false}} + /> + <MainStack.Screen name="SocialMediaTaggs" component={SocialMediaTaggs} options={{ @@ -104,7 +129,7 @@ const ProfileStackScreen: React.FC<ProfileStackProps> = ({route}) => { }} initialParams={{screenType}} /> - <ProfileStack.Screen + <MainStack.Screen name="CategorySelection" component={CategorySelection} options={{ @@ -115,16 +140,7 @@ const ProfileStackScreen: React.FC<ProfileStackProps> = ({route}) => { headerTitle: '', }} /> - {isProfileStack ? ( - <ProfileStack.Screen - name="CaptionScreen" - component={CaptionScreen} - options={{...modalStyle, gestureEnabled: false}} - /> - ) : ( - <React.Fragment /> - )} - <ProfileStack.Screen + <MainStack.Screen name="IndividualMoment" component={IndividualMoment} options={{ @@ -132,7 +148,7 @@ const ProfileStackScreen: React.FC<ProfileStackProps> = ({route}) => { }} initialParams={{screenType}} /> - <ProfileStack.Screen + <MainStack.Screen name="MomentCommentsScreen" component={MomentCommentsScreen} options={{ @@ -140,7 +156,7 @@ const ProfileStackScreen: React.FC<ProfileStackProps> = ({route}) => { }} initialParams={{screenType}} /> - <ProfileStack.Screen + <MainStack.Screen name="FollowersListScreen" component={FollowersListScreen} options={{ @@ -148,7 +164,7 @@ const ProfileStackScreen: React.FC<ProfileStackProps> = ({route}) => { }} initialParams={{screenType}} /> - <ProfileStack.Screen + <MainStack.Screen name="EditProfile" component={EditProfile} options={{ @@ -159,8 +175,8 @@ const ProfileStackScreen: React.FC<ProfileStackProps> = ({route}) => { headerTintColor: 'white', }} /> - </ProfileStack.Navigator> + </MainStack.Navigator> ); }; -export default ProfileStackScreen; +export default MainStackScreen; diff --git a/src/routes/main/index.ts b/src/routes/main/index.ts new file mode 100644 index 00000000..945c3fb0 --- /dev/null +++ b/src/routes/main/index.ts @@ -0,0 +1,2 @@ +export * from './MainStackNavigator'; +export * from './MainStackScreen'; diff --git a/src/routes/profile/index.ts b/src/routes/profile/index.ts deleted file mode 100644 index 05a6b24a..00000000 --- a/src/routes/profile/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './ProfileStackNavigator'; -export * from './ProfileStackScreen'; diff --git a/src/routes/tabs/NavigationBar.tsx b/src/routes/tabs/NavigationBar.tsx index f3043696..9d7d4b12 100644 --- a/src/routes/tabs/NavigationBar.tsx +++ b/src/routes/tabs/NavigationBar.tsx @@ -2,7 +2,7 @@ import {createBottomTabNavigator} from '@react-navigation/bottom-tabs'; import React, {Fragment} from 'react'; import {NavigationIcon} from '../../components'; import {ScreenType} from '../../types'; -import Profile from '../profile/ProfileStackScreen'; +import MainStackScreen from '../main/MainStackScreen'; const Tabs = createBottomTabNavigator(); @@ -39,18 +39,19 @@ const NavigationBar: React.FC = () => { bottom: '1%', }, }}> - {/* Removed for Alpha for now */} - {/* <Tabs.Screen name="Home" component={Home} /> - <Tabs.Screen name="Notifications" component={Notifications} /> - <Tabs.Screen name="Upload" component={Upload} /> */} + <Tabs.Screen + name="Notifications" + component={MainStackScreen} + initialParams={{screenType: ScreenType.Notifications}} + /> <Tabs.Screen name="Search" - component={Profile} + component={MainStackScreen} initialParams={{screenType: ScreenType.Search}} /> <Tabs.Screen name="Profile" - component={Profile} + component={MainStackScreen} initialParams={{screenType: ScreenType.Profile}} /> </Tabs.Navigator> |
