-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
navigation set up for future screens (#15)
* navigation set up for future screens --------- Co-authored-by: Matt McCoy <[email protected]>
- Loading branch information
1 parent
e457aab
commit 582d85a
Showing
5 changed files
with
75 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,45 @@ | ||
import * as React from 'react'; | ||
import { View, Text } from 'react-native'; | ||
import { getAllMedications } from './services/medication'; | ||
import UnionSvg from './assets/Union.svg'; | ||
import { Text } from 'react-native'; | ||
import { createNativeStackNavigator } from '@react-navigation/native-stack'; | ||
import { NavigationContainer, NavigationProp } from '@react-navigation/native'; | ||
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; | ||
import Medication from './screens/Medication'; | ||
import Home from './assets/home.svg'; | ||
|
||
export type ScreenNames = ['BottomNav', 'Landing']; | ||
export type RootStackParamList = Record<ScreenNames[number], any>; | ||
export type StackNavigation = NavigationProp<RootStackParamList>; | ||
|
||
const Stack = createNativeStackNavigator<RootStackParamList>(); | ||
const Tab = createBottomTabNavigator(); | ||
|
||
// TODO: figure out a way to do this better, I didnt enjoy this way of doing it in SaluTemp there HAS to be a better way | ||
export default function App() { | ||
const [medications, setMedications] = React.useState<Medication[]>(); | ||
React.useEffect(() => { | ||
getAllMedications().then((med) => setMedications(med)); | ||
}, []); | ||
// Adding the UnionSvg component here to show that it's able to be displayed here | ||
return ( | ||
<View className="flex-1 items-center w-[100vw] justify-center bg-white"> | ||
{medications && | ||
medications.map((med, index) => ( | ||
<Text key={index} className="pb-2"> | ||
{`Name: ${med.medication_name} id: ${med.medication_id}`} | ||
</Text> | ||
))} | ||
<UnionSvg/> | ||
</View> | ||
<NavigationContainer> | ||
<Stack.Navigator> | ||
<Stack.Screen | ||
name="BottomNav" | ||
options={{ headerShown: false }} | ||
component={Tabs} | ||
/> | ||
</Stack.Navigator> | ||
</NavigationContainer> | ||
); | ||
} | ||
|
||
function Tabs() { | ||
return ( | ||
<Tab.Navigator> | ||
<Tab.Screen | ||
name="Landing" | ||
options={{ | ||
headerShown: true, | ||
tabBarIcon: () => <Home color={'gray'} />, | ||
tabBarLabel: () => <Text>Landing</Text> | ||
}} | ||
component={Medication} | ||
/> | ||
</Tab.Navigator> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import * as React from 'react'; | ||
import { View, Text } from 'react-native'; | ||
import { getAllMedications } from '../services/medication'; | ||
|
||
export default function Medication() { | ||
const [medications, setMedications] = React.useState<Medication[]>(); | ||
React.useEffect(() => { | ||
getAllMedications().then((med) => setMedications(med)); | ||
}, []); | ||
|
||
return ( | ||
<View className="flex-1 items-center w-[100vw] justify-center bg-white"> | ||
{medications && | ||
medications.map((med, index) => ( | ||
<Text key={index} className="pb-2"> | ||
{`Name: ${med.medication_name} id: ${med.medication_id}`} | ||
</Text> | ||
))} | ||
</View> | ||
); | ||
} |