From d329142d770cdbb99a60a4d66e82829db8b411ed Mon Sep 17 00:00:00 2001 From: Matt McCoy Date: Mon, 18 Mar 2024 15:53:07 -0400 Subject: [PATCH] fix: cycle import in app nav --- client/navigation/AppNavigation.tsx | 21 +------------------ .../navigation/AppStackBottomTabNavigator.tsx | 8 +++---- client/navigation/types.ts | 19 +++++++++++++++++ client/screens/LoginPage.tsx | 2 +- client/screens/Profile/Profile.tsx | 2 +- client/screens/TaskType.tsx | 4 ++-- 6 files changed, 28 insertions(+), 28 deletions(-) create mode 100644 client/navigation/types.ts diff --git a/client/navigation/AppNavigation.tsx b/client/navigation/AppNavigation.tsx index 309a89b..d84eff0 100644 --- a/client/navigation/AppNavigation.tsx +++ b/client/navigation/AppNavigation.tsx @@ -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; - -export const AppStack = createNativeStackNavigator(); +import { AppStack } from './types'; export function AppNavigation() { return ( diff --git a/client/navigation/AppStackBottomTabNavigator.tsx b/client/navigation/AppStackBottomTabNavigator.tsx index 3d42c31..4b3fb45 100644 --- a/client/navigation/AppStackBottomTabNavigator.tsx +++ b/client/navigation/AppStackBottomTabNavigator.tsx @@ -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(); +const AppStackBottomTab = createBottomTabNavigator(); export function AppStackBottomTabNavigator() { return ( @@ -56,13 +56,13 @@ export function AppStackBottomTabNavigator() { tabBarIcon: ({ color }) => , tabBarLabel: () => }} - component={AppNavigation} + component={ProfileNavigation} /> ); } -export function AppNavigation() { +export function ProfileNavigation() { return ( ; + +export const AppStack = createNativeStackNavigator(); diff --git a/client/screens/LoginPage.tsx b/client/screens/LoginPage.tsx index 21051a9..e23a132 100644 --- a/client/screens/LoginPage.tsx +++ b/client/screens/LoginPage.tsx @@ -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() { diff --git a/client/screens/Profile/Profile.tsx b/client/screens/Profile/Profile.tsx index 08a47d7..30f90c0 100644 --- a/client/screens/Profile/Profile.tsx +++ b/client/screens/Profile/Profile.tsx @@ -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'; diff --git a/client/screens/TaskType.tsx b/client/screens/TaskType.tsx index 35bc59d..066ab6a 100644 --- a/client/screens/TaskType.tsx +++ b/client/screens/TaskType.tsx @@ -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() { @@ -99,7 +99,7 @@ export function TaskType() { renderItem={({ item }) => ( navigation.navigate('New ' + item + ' Task')} + onPress={() => navigation.navigate('Home')} >