// @flow import React from 'react'; import { View, SafeAreaView } from 'react-native'; import Food from './Products'; import Places from './Places'; import { BottomNavigation } from 'react-native-material-ui'; import { getLocation } from '../apis/PositionApi'; import { compose, pure, withHandlers, withProps } from 'recompose'; import { withRouterContext, type routerContext } from '../enhancers/routeEnhancers'; import { pathOr } from 'ramda'; import uiTheme from '../ui-theme'; import ProfilePage from './ProfilePage'; import Faves from './Faves'; import { fetchFaves } from '../apis/FavesApi'; type Props = { activeTab: string, router: routerContext, setRoute: (route: string) => () => void, location: { pathname: string, }, }; const Nav = (props: Props) => { const { activeTab, setRoute, location, pushRoute } = props; return ( {activeTab === 'food' && } {activeTab === 'places' && } {activeTab === 'faves' && } {activeTab === 'profile' && } {/* */} {/* */} ); }; export default compose( pure, withRouterContext, withProps((props: Props) => { const activeTab = pathOr('food', ['router', 'route', 'match', 'params', 'type'], props); return { activeTab }; }), withHandlers({ setRoute: (props: Props) => (route: string) => () => { props.router.history.replace(route); }, pushRoute: (props: Props) => (route: string) => () => { props.router.history.push(route); }, }) )(Nav);