This repository has been archived on 2024-11-20. You can view files and clone it, but cannot push or open issues or pull requests.

33 lines
803 B
TypeScript
Raw Normal View History

import { Redirect, useLocalSearchParams } from "expo-router"
2024-03-24 23:41:23 +01:00
import { Text } from "react-native-paper"
import { SafeAreaView } from "react-native-safe-area-context"
import { useHabitsTracker } from "@/presentation/react/contexts/HabitsTracker"
2024-03-24 23:41:23 +01:00
const HabitPage: React.FC = () => {
const { habitId } = useLocalSearchParams()
const { habitsTracker } = useHabitsTracker()
2024-03-24 23:41:23 +01:00
const habitHistory = habitsTracker.getHabitHistoryById(habitId as string)
if (habitHistory == null) {
return <Redirect href="/application/habits/" />
}
2024-03-24 23:41:23 +01:00
return (
<SafeAreaView
style={[
{
flex: 1,
alignItems: "center",
},
]}
>
<Text>
Habit Page {habitId} {habitHistory.habit.name}
</Text>
2024-03-24 23:41:23 +01:00
</SafeAreaView>
)
}
export default HabitPage