Split out some type definitions into their own files
This commit is contained in:
parent
927e48ab2f
commit
39fafa353f
9
App.tsx
9
App.tsx
|
@ -12,18 +12,11 @@ import {
|
|||
Provider,
|
||||
} from 'react-native-paper';
|
||||
import Ionicon from 'react-native-vector-icons/Ionicons';
|
||||
import {DrawerParamList} from './drawer-param-list';
|
||||
import MassiveSnack from './MassiveSnack';
|
||||
import Routes from './Routes';
|
||||
|
||||
export const Drawer = createDrawerNavigator<DrawerParamList>();
|
||||
export type DrawerParamList = {
|
||||
Home: {};
|
||||
Settings: {};
|
||||
Best: {};
|
||||
Plans: {};
|
||||
Workouts: {};
|
||||
Loading: {};
|
||||
};
|
||||
|
||||
export const CombinedDefaultTheme = {
|
||||
...NavigationDefaultTheme,
|
||||
|
|
|
@ -3,8 +3,8 @@ 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';
|
||||
import BestList from './BestList';
|
||||
import {DrawerParamList} from './drawer-param-list';
|
||||
import Set from './set';
|
||||
import ViewBest from './ViewBest';
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ import React, {useCallback, useContext, useState} from 'react';
|
|||
import DocumentPicker from 'react-native-document-picker';
|
||||
import {FileSystem} from 'react-native-file-access';
|
||||
import {Divider, IconButton, Menu} from 'react-native-paper';
|
||||
import {DrawerParamList} from './App';
|
||||
import ConfirmDialog from './ConfirmDialog';
|
||||
import {DrawerParamList} from './drawer-param-list';
|
||||
import {SnackbarContext} from './MassiveSnack';
|
||||
import {Plan} from './plan';
|
||||
import {addPlans, deletePlans, getAllPlans} from './plan.service';
|
||||
|
|
|
@ -8,8 +8,8 @@ import {
|
|||
import React, {useCallback, useEffect, useState} from 'react';
|
||||
import {ScrollView, StyleSheet, Text, View} from 'react-native';
|
||||
import {Button, IconButton} from 'react-native-paper';
|
||||
import {DrawerParamList} from './App';
|
||||
import {MARGIN, PADDING} from './constants';
|
||||
import {DrawerParamList} from './drawer-param-list';
|
||||
import MassiveSwitch from './MassiveSwitch';
|
||||
import {addPlan, updatePlan} from './plan.service';
|
||||
import {PlanPageParams} from './PlanPage';
|
||||
|
|
|
@ -8,7 +8,7 @@ import React, {useCallback, useContext} from 'react';
|
|||
import {NativeModules, View} from 'react-native';
|
||||
import {IconButton} from 'react-native-paper';
|
||||
import {PADDING} from './constants';
|
||||
import {HomePageParams} from './HomePage';
|
||||
import {HomePageParams} from './home-page-params';
|
||||
import {SnackbarContext} from './MassiveSnack';
|
||||
import Set from './set';
|
||||
import {addSet, updateSet} from './set.service';
|
||||
|
|
11
HomePage.tsx
11
HomePage.tsx
|
@ -3,19 +3,12 @@ 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';
|
||||
import {DrawerParamList} from './drawer-param-list';
|
||||
import EditSet from './EditSet';
|
||||
import Set from './set';
|
||||
import {HomePageParams} from './home-page-params';
|
||||
import SetList from './SetList';
|
||||
|
||||
const Stack = createStackNavigator<HomePageParams>();
|
||||
export type HomePageParams = {
|
||||
Sets: {};
|
||||
EditSet: {
|
||||
set: Set;
|
||||
workouts: string[];
|
||||
};
|
||||
};
|
||||
|
||||
export default function HomePage() {
|
||||
const navigation = useNavigation<DrawerNavigationProp<DrawerParamList>>();
|
||||
|
|
10
PlanPage.tsx
10
PlanPage.tsx
|
@ -3,18 +3,12 @@ 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';
|
||||
import {DrawerParamList} from './drawer-param-list';
|
||||
import EditPlan from './EditPlan';
|
||||
import {Plan} from './plan';
|
||||
import {PlanPageParams} from './plan-page-params';
|
||||
import PlanList from './PlanList';
|
||||
|
||||
const Stack = createStackNavigator<PlanPageParams>();
|
||||
export type PlanPageParams = {
|
||||
PlanList: {};
|
||||
EditPlan: {
|
||||
plan: Plan;
|
||||
};
|
||||
};
|
||||
|
||||
export default function PlanPage() {
|
||||
const navigation = useNavigation<DrawerNavigationProp<DrawerParamList>>();
|
||||
|
|
|
@ -2,7 +2,7 @@ import {NavigationProp, useNavigation} from '@react-navigation/native';
|
|||
import React, {useCallback, useState} from 'react';
|
||||
import {GestureResponderEvent, Image} from 'react-native';
|
||||
import {Divider, List, Menu, Text} from 'react-native-paper';
|
||||
import {HomePageParams} from './HomePage';
|
||||
import {HomePageParams} from './home-page-params';
|
||||
import Set from './set';
|
||||
import {deleteSet} from './set.service';
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import {FlatList} from 'react-native';
|
|||
import {List} from 'react-native-paper';
|
||||
import {getBestSet} from './best.service';
|
||||
import DrawerMenu from './DrawerMenu';
|
||||
import {HomePageParams} from './HomePage';
|
||||
import {HomePageParams} from './home-page-params';
|
||||
import Page from './Page';
|
||||
import {getTodaysPlan} from './plan.service';
|
||||
import Set from './set';
|
||||
|
|
|
@ -3,7 +3,7 @@ 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';
|
||||
import {DrawerParamList} from './drawer-param-list';
|
||||
import EditWorkout from './EditWorkout';
|
||||
import Set from './set';
|
||||
import WorkoutList from './WorkoutList';
|
||||
|
|
8
drawer-param-list.ts
Normal file
8
drawer-param-list.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
export type DrawerParamList = {
|
||||
Home: {};
|
||||
Settings: {};
|
||||
Best: {};
|
||||
Plans: {};
|
||||
Workouts: {};
|
||||
Loading: {};
|
||||
};
|
9
home-page-params.ts
Normal file
9
home-page-params.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import Set from './set';
|
||||
|
||||
export type HomePageParams = {
|
||||
Sets: {};
|
||||
EditSet: {
|
||||
set: Set;
|
||||
workouts: string[];
|
||||
};
|
||||
};
|
8
plan-page-params.ts
Normal file
8
plan-page-params.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
import {Plan} from './plan';
|
||||
|
||||
export type PlanPageParams = {
|
||||
PlanList: {};
|
||||
EditPlan: {
|
||||
plan: Plan;
|
||||
};
|
||||
};
|
Loading…
Reference in New Issue
Block a user