aretherecookies-mobile/js/routes.js
2017-09-10 19:20:26 -05:00

85 lines
1.5 KiB
JavaScript

// @flow
import React from 'react';
import { PropTypes } from 'react';
import Food from './pages/Food';
import Places from './pages/Places';
import Faves from './pages/Faves';
import FoodItemDetail from './pages/FoodItemDetail';
import PlaceDetail from './pages/PlaceDetail';
const { shape, func, string, arrayOf } = PropTypes;
export type Route = {
title: string,
component: React.Component<any, any, any>,
icon: string,
};
export default {
food: {
title: 'Food',
component: Food,
icon: 'local-pizza',
},
places: {
title: 'Places',
component: Places,
icon: 'restaurant',
},
faves: {
title: 'Faves',
component: Faves,
icon: 'stars',
},
foodDetail: {
title: 'Food Details',
component: FoodItemDetail,
icon: 'local-pizza',
},
placeDetail: {
title: 'Place Details',
component: PlaceDetail,
icon: 'domain',
},
};
export const routingContextPropTypes = {
router: shape({
history: shape({
push: func.isRequired,
replace: func.isRequired,
goBack: func.isRequired,
entries: arrayOf(
shape({
pathname: string.isRequired,
search: string.isRequired,
})
),
}).isRequired,
}).isRequired,
};
export type RoutingContextFlowTypes = {
router: {
history: {
push: Function,
replace: Function,
goBack: Function,
entries: Array<{
pathname: string,
search: string,
}>,
},
route: {
location: {
pathname: string,
state: ?Object,
},
},
},
match: {
params: {
type?: string,
},
},
};