You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
973 B
30 lines
973 B
import { useContext } from 'react'
|
|
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
import { AuthContext } from '../login/AuthContext';
|
|
import { ProductFormScreen } from './ProductFormScreen';
|
|
import { ProductListScreen } from './ProductListScreen';
|
|
|
|
export type RootStackParams = {
|
|
ProductListScreen: undefined,
|
|
ProductFormScreen: { id: number }
|
|
}
|
|
const Stack = createNativeStackNavigator<RootStackParams>();
|
|
|
|
export const ProductStack = () => {
|
|
const { isAuthenticated } = useContext(AuthContext)
|
|
|
|
return (
|
|
<Stack.Navigator
|
|
screenOptions={{
|
|
headerShown: true,
|
|
}}
|
|
>
|
|
{isAuthenticated && (
|
|
<>
|
|
<Stack.Screen name="ProductListScreen" component={ProductListScreen} />
|
|
<Stack.Screen name="ProductFormScreen" component={ProductFormScreen} />
|
|
</>
|
|
)}
|
|
</Stack.Navigator>
|
|
)
|
|
} |