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,
|
Provider,
|
||||||
} from 'react-native-paper';
|
} from 'react-native-paper';
|
||||||
import Ionicon from 'react-native-vector-icons/Ionicons';
|
import Ionicon from 'react-native-vector-icons/Ionicons';
|
||||||
|
import {DrawerParamList} from './drawer-param-list';
|
||||||
import MassiveSnack from './MassiveSnack';
|
import MassiveSnack from './MassiveSnack';
|
||||||
import Routes from './Routes';
|
import Routes from './Routes';
|
||||||
|
|
||||||
export const Drawer = createDrawerNavigator<DrawerParamList>();
|
export const Drawer = createDrawerNavigator<DrawerParamList>();
|
||||||
export type DrawerParamList = {
|
|
||||||
Home: {};
|
|
||||||
Settings: {};
|
|
||||||
Best: {};
|
|
||||||
Plans: {};
|
|
||||||
Workouts: {};
|
|
||||||
Loading: {};
|
|
||||||
};
|
|
||||||
|
|
||||||
export const CombinedDefaultTheme = {
|
export const CombinedDefaultTheme = {
|
||||||
...NavigationDefaultTheme,
|
...NavigationDefaultTheme,
|
||||||
|
|
|
@ -3,8 +3,8 @@ import {useNavigation} from '@react-navigation/native';
|
||||||
import {createStackNavigator} from '@react-navigation/stack';
|
import {createStackNavigator} from '@react-navigation/stack';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {IconButton} from 'react-native-paper';
|
import {IconButton} from 'react-native-paper';
|
||||||
import {DrawerParamList} from './App';
|
|
||||||
import BestList from './BestList';
|
import BestList from './BestList';
|
||||||
|
import {DrawerParamList} from './drawer-param-list';
|
||||||
import Set from './set';
|
import Set from './set';
|
||||||
import ViewBest from './ViewBest';
|
import ViewBest from './ViewBest';
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@ import React, {useCallback, useContext, useState} from 'react';
|
||||||
import DocumentPicker from 'react-native-document-picker';
|
import DocumentPicker from 'react-native-document-picker';
|
||||||
import {FileSystem} from 'react-native-file-access';
|
import {FileSystem} from 'react-native-file-access';
|
||||||
import {Divider, IconButton, Menu} from 'react-native-paper';
|
import {Divider, IconButton, Menu} from 'react-native-paper';
|
||||||
import {DrawerParamList} from './App';
|
|
||||||
import ConfirmDialog from './ConfirmDialog';
|
import ConfirmDialog from './ConfirmDialog';
|
||||||
|
import {DrawerParamList} from './drawer-param-list';
|
||||||
import {SnackbarContext} from './MassiveSnack';
|
import {SnackbarContext} from './MassiveSnack';
|
||||||
import {Plan} from './plan';
|
import {Plan} from './plan';
|
||||||
import {addPlans, deletePlans, getAllPlans} from './plan.service';
|
import {addPlans, deletePlans, getAllPlans} from './plan.service';
|
||||||
|
|
|
@ -8,8 +8,8 @@ import {
|
||||||
import React, {useCallback, useEffect, useState} from 'react';
|
import React, {useCallback, useEffect, useState} from 'react';
|
||||||
import {ScrollView, StyleSheet, Text, View} from 'react-native';
|
import {ScrollView, StyleSheet, Text, View} from 'react-native';
|
||||||
import {Button, IconButton} from 'react-native-paper';
|
import {Button, IconButton} from 'react-native-paper';
|
||||||
import {DrawerParamList} from './App';
|
|
||||||
import {MARGIN, PADDING} from './constants';
|
import {MARGIN, PADDING} from './constants';
|
||||||
|
import {DrawerParamList} from './drawer-param-list';
|
||||||
import MassiveSwitch from './MassiveSwitch';
|
import MassiveSwitch from './MassiveSwitch';
|
||||||
import {addPlan, updatePlan} from './plan.service';
|
import {addPlan, updatePlan} from './plan.service';
|
||||||
import {PlanPageParams} from './PlanPage';
|
import {PlanPageParams} from './PlanPage';
|
||||||
|
|
|
@ -8,7 +8,7 @@ import React, {useCallback, useContext} from 'react';
|
||||||
import {NativeModules, View} from 'react-native';
|
import {NativeModules, View} from 'react-native';
|
||||||
import {IconButton} from 'react-native-paper';
|
import {IconButton} from 'react-native-paper';
|
||||||
import {PADDING} from './constants';
|
import {PADDING} from './constants';
|
||||||
import {HomePageParams} from './HomePage';
|
import {HomePageParams} from './home-page-params';
|
||||||
import {SnackbarContext} from './MassiveSnack';
|
import {SnackbarContext} from './MassiveSnack';
|
||||||
import Set from './set';
|
import Set from './set';
|
||||||
import {addSet, updateSet} from './set.service';
|
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 {createStackNavigator} from '@react-navigation/stack';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {IconButton} from 'react-native-paper';
|
import {IconButton} from 'react-native-paper';
|
||||||
import {DrawerParamList} from './App';
|
import {DrawerParamList} from './drawer-param-list';
|
||||||
import EditSet from './EditSet';
|
import EditSet from './EditSet';
|
||||||
import Set from './set';
|
import {HomePageParams} from './home-page-params';
|
||||||
import SetList from './SetList';
|
import SetList from './SetList';
|
||||||
|
|
||||||
const Stack = createStackNavigator<HomePageParams>();
|
const Stack = createStackNavigator<HomePageParams>();
|
||||||
export type HomePageParams = {
|
|
||||||
Sets: {};
|
|
||||||
EditSet: {
|
|
||||||
set: Set;
|
|
||||||
workouts: string[];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export default function HomePage() {
|
export default function HomePage() {
|
||||||
const navigation = useNavigation<DrawerNavigationProp<DrawerParamList>>();
|
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 {createStackNavigator} from '@react-navigation/stack';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {IconButton} from 'react-native-paper';
|
import {IconButton} from 'react-native-paper';
|
||||||
import {DrawerParamList} from './App';
|
import {DrawerParamList} from './drawer-param-list';
|
||||||
import EditPlan from './EditPlan';
|
import EditPlan from './EditPlan';
|
||||||
import {Plan} from './plan';
|
import {PlanPageParams} from './plan-page-params';
|
||||||
import PlanList from './PlanList';
|
import PlanList from './PlanList';
|
||||||
|
|
||||||
const Stack = createStackNavigator<PlanPageParams>();
|
const Stack = createStackNavigator<PlanPageParams>();
|
||||||
export type PlanPageParams = {
|
|
||||||
PlanList: {};
|
|
||||||
EditPlan: {
|
|
||||||
plan: Plan;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export default function PlanPage() {
|
export default function PlanPage() {
|
||||||
const navigation = useNavigation<DrawerNavigationProp<DrawerParamList>>();
|
const navigation = useNavigation<DrawerNavigationProp<DrawerParamList>>();
|
||||||
|
|
|
@ -2,7 +2,7 @@ import {NavigationProp, useNavigation} from '@react-navigation/native';
|
||||||
import React, {useCallback, useState} from 'react';
|
import React, {useCallback, useState} from 'react';
|
||||||
import {GestureResponderEvent, Image} from 'react-native';
|
import {GestureResponderEvent, Image} from 'react-native';
|
||||||
import {Divider, List, Menu, Text} from 'react-native-paper';
|
import {Divider, List, Menu, Text} from 'react-native-paper';
|
||||||
import {HomePageParams} from './HomePage';
|
import {HomePageParams} from './home-page-params';
|
||||||
import Set from './set';
|
import Set from './set';
|
||||||
import {deleteSet} from './set.service';
|
import {deleteSet} from './set.service';
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {FlatList} from 'react-native';
|
||||||
import {List} from 'react-native-paper';
|
import {List} from 'react-native-paper';
|
||||||
import {getBestSet} from './best.service';
|
import {getBestSet} from './best.service';
|
||||||
import DrawerMenu from './DrawerMenu';
|
import DrawerMenu from './DrawerMenu';
|
||||||
import {HomePageParams} from './HomePage';
|
import {HomePageParams} from './home-page-params';
|
||||||
import Page from './Page';
|
import Page from './Page';
|
||||||
import {getTodaysPlan} from './plan.service';
|
import {getTodaysPlan} from './plan.service';
|
||||||
import Set from './set';
|
import Set from './set';
|
||||||
|
|
|
@ -3,7 +3,7 @@ import {useNavigation} from '@react-navigation/native';
|
||||||
import {createStackNavigator} from '@react-navigation/stack';
|
import {createStackNavigator} from '@react-navigation/stack';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {IconButton} from 'react-native-paper';
|
import {IconButton} from 'react-native-paper';
|
||||||
import {DrawerParamList} from './App';
|
import {DrawerParamList} from './drawer-param-list';
|
||||||
import EditWorkout from './EditWorkout';
|
import EditWorkout from './EditWorkout';
|
||||||
import Set from './set';
|
import Set from './set';
|
||||||
import WorkoutList from './WorkoutList';
|
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