60 lines
1.5 KiB
TypeScript
60 lines
1.5 KiB
TypeScript
import { NavigationContainer } from '@react-navigation/native'
|
|
import { createStackNavigator } from '@react-navigation/stack'
|
|
import React from 'react'
|
|
import { StatusBar } from 'react-native'
|
|
import { schema } from '../app.json'
|
|
import Absence from './absence.component'
|
|
import { Child } from './child.component'
|
|
import { Children } from './children.component'
|
|
import { Auth } from './auth.component'
|
|
import { NewsItem } from './newsItem.component'
|
|
import {
|
|
Child as ChildType,
|
|
NewsItem as NewsItemType,
|
|
} from '@skolplattformen/embedded-api'
|
|
|
|
export type RootStackParamList = {
|
|
Login: undefined
|
|
Children: undefined
|
|
Child: {
|
|
child: ChildType
|
|
color: string
|
|
initialRouteName?: string
|
|
}
|
|
NewsItem: { newsItem: NewsItemType; child: ChildType }
|
|
Absence: { child: ChildType }
|
|
}
|
|
|
|
export type SigninStackParamList = {
|
|
Login: undefined
|
|
}
|
|
|
|
const { Navigator, Screen } = createStackNavigator()
|
|
|
|
const HomeNavigator = () => (
|
|
<Navigator headerMode="none">
|
|
<Screen name="Login" component={Auth} />
|
|
<Screen name="Children" component={Children} />
|
|
<Screen name="Child" component={Child} />
|
|
<Screen name="NewsItem" component={NewsItem} />
|
|
<Screen name="Absence" component={Absence} />
|
|
</Navigator>
|
|
)
|
|
|
|
const linking = {
|
|
prefixes: [schema],
|
|
config: {
|
|
screens: {
|
|
Login: 'login',
|
|
},
|
|
},
|
|
}
|
|
export const AppNavigator = () => {
|
|
return (
|
|
<NavigationContainer linking={linking}>
|
|
<StatusBar />
|
|
<HomeNavigator />
|
|
</NavigationContainer>
|
|
)
|
|
}
|