Massive/HomePage.tsx

51 lines
1.4 KiB
TypeScript
Raw Normal View History

import {DrawerNavigationProp} from '@react-navigation/drawer';
2022-07-10 12:06:48 +00:00
import {useNavigation} from '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack';
import React from 'react';
import {IconButton} from 'react-native-paper';
import {DrawerParamList} from './App';
2022-07-03 01:50:01 +00:00
import EditSet from './EditSet';
2022-07-04 04:03:48 +00:00
import Set from './set';
import SetsPage from './SetsPage';
2022-07-03 01:50:01 +00:00
const Stack = createStackNavigator<StackParams>();
export type StackParams = {
Sets: {};
EditSet: {
set: Set;
};
};
2022-07-03 01:50:01 +00:00
export default function HomePage() {
const navigation = useNavigation<DrawerNavigationProp<DrawerParamList>>();
2022-07-10 05:40:11 +00:00
2022-07-03 01:50:01 +00:00
return (
<Stack.Navigator
screenOptions={{headerShown: false, animationEnabled: false}}>
<Stack.Screen name="Sets" component={SetsPage} />
<Stack.Screen
name="EditSet"
component={EditSet}
listeners={{
focus: () => {
navigation.setOptions({
headerLeft: () => (
<IconButton icon="arrow-back" onPress={navigation.goBack} />
),
title: 'Set',
});
},
beforeRemove: () => {
navigation.setOptions({
headerLeft: () => (
<IconButton icon="menu" onPress={navigation.openDrawer} />
),
title: 'Home',
});
},
}}
2022-07-03 01:50:01 +00:00
/>
</Stack.Navigator>
2022-07-03 01:50:01 +00:00
);
}