Skip to content

Commit

Permalink
fix: cycle import in app nav
Browse files Browse the repository at this point in the history
  • Loading branch information
MattCMcCoy committed Mar 18, 2024
1 parent fa9dcfb commit d329142
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 28 deletions.
21 changes: 1 addition & 20 deletions client/navigation/AppNavigation.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,9 @@
import React from 'react';

import { NavigationProp } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';

import LoginPage from '../screens/LoginPage';
import { TaskType } from '../screens/TaskType';
import { AppStackBottomTabNavigator } from './AppStackBottomTabNavigator';

export type AppStackParamList = {
Main: undefined;
Home: undefined;
Login: undefined;
Profile: undefined;
PatientView: undefined;
ProfileScreens: undefined;
Landing: undefined;
Calendar: undefined;
Notifications: undefined;
TaskType: undefined;
};

export type AppStackNavigation = NavigationProp<AppStackParamList>;

export const AppStack = createNativeStackNavigator<AppStackParamList>();
import { AppStack } from './types';

export function AppNavigation() {
return (
Expand Down
8 changes: 4 additions & 4 deletions client/navigation/AppStackBottomTabNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import User from '../assets/bottom-nav/user.svg';
import MedicationList from '../screens/MedicationList';
import PatientView from '../screens/Profile/PatientView';
import Profile from '../screens/Profile/Profile';
import { AppStack, AppStackParamList } from './AppNavigation';
import { AppStack } from './types';

const AppStackBottomTab = createBottomTabNavigator<AppStackParamList>();
const AppStackBottomTab = createBottomTabNavigator();

export function AppStackBottomTabNavigator() {
return (
Expand Down Expand Up @@ -56,13 +56,13 @@ export function AppStackBottomTabNavigator() {
tabBarIcon: ({ color }) => <User color={color} />,
tabBarLabel: () => <Text></Text>
}}
component={AppNavigation}
component={ProfileNavigation}
/>
</AppStackBottomTab.Navigator>
);
}

export function AppNavigation() {
export function ProfileNavigation() {
return (
<AppStack.Navigator>
<AppStack.Screen
Expand Down
19 changes: 19 additions & 0 deletions client/navigation/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { NavigationProp } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';

export type AppStackParamList = {
Main: undefined;
Home: undefined;
Login: undefined;
Profile: undefined;
PatientView: undefined;
ProfileScreens: undefined;
Landing: undefined;
Calendar: undefined;
Notifications: undefined;
TaskType: undefined;
};

export type AppStackNavigation = NavigationProp<AppStackParamList>;

export const AppStack = createNativeStackNavigator<AppStackParamList>();
2 changes: 1 addition & 1 deletion client/screens/LoginPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { onAuthStateChanged } from '@firebase/auth';
import { useNavigation } from '@react-navigation/native';

import { auth } from '../firebase.config';
import { AppStackNavigation } from '../navigation/AppNavigation';
import { AppStackNavigation } from '../navigation/types';
import { useAuth } from '../services/auth';

export default function LoginPage() {
Expand Down
2 changes: 1 addition & 1 deletion client/screens/Profile/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { CircleCard } from '../../components/profile/CircleCard';
import { Group } from '../../components/profile/Group';
import { Header } from '../../components/profile/Header';
import { useCareWalletContext } from '../../contexts/CareWalletContext';
import { AppStackNavigation } from '../../navigation/AppNavigation';
import { AppStackNavigation } from '../../navigation/types';
import { useAuth } from '../../services/auth';
import { useGroup } from '../../services/group';
import { useUsers } from '../../services/user';
Expand Down
4 changes: 2 additions & 2 deletions client/screens/TaskType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { Button, Text } from 'react-native-paper';

import { BackButton } from '../components/TaskType/BackButton';
import { CloseButton } from '../components/TaskType/CloseButton';
import { AppStackNavigation } from '../navigation/AppNavigation';
import { AppStackNavigation } from '../navigation/types';
import { Category, categoryToTypeMap, TypeOfTask } from '../types/type';

export function TaskType() {
Expand Down Expand Up @@ -99,7 +99,7 @@ export function TaskType() {
renderItem={({ item }) => (
<TouchableOpacity
className="m-2 h-[50px] overflow-hidden rounded-xl"
onPress={() => navigation.navigate('New ' + item + ' Task')}
onPress={() => navigation.navigate('Home')}
>
<Button
className="m-2 h-[50px] items-center justify-center rounded-xl"
Expand Down

0 comments on commit d329142

Please sign in to comment.