ecency-mobile/src/navigation/routes.js

144 lines
3.8 KiB
JavaScript
Raw Normal View History

import React from 'react';
2019-10-04 18:56:22 +03:00
import { createSwitchNavigator } from 'react-navigation';
import { createBottomTabNavigator } from 'react-navigation-tabs';
2019-10-04 18:56:22 +03:00
import { createDrawerNavigator } from 'react-navigation-drawer';
import { createStackNavigator } from 'react-navigation-stack';
// Constants
2019-10-04 18:56:22 +03:00
import ROUTES from '../constants/routeNames';
import scalePx from '../utils/scalePx';
// Components
import { Icon, IconContainer } from '../components/icon';
import { PostButton, BottomTabBar, SideMenu } from '../components';
2018-10-05 06:42:27 +03:00
// Screens
import {
Bookmarks,
2019-09-04 22:17:39 +03:00
Boost,
Drafts,
Editor,
Feed,
2018-11-18 01:48:18 +03:00
Follows,
2018-10-31 11:54:33 +03:00
Login,
Notification,
2018-10-31 11:54:33 +03:00
Post,
Profile,
2019-09-04 22:17:39 +03:00
ProfileEdit,
Reblogs,
Redeem,
2020-05-02 19:35:08 +03:00
Register,
2019-09-04 22:17:39 +03:00
SearchResult,
2018-11-18 01:48:18 +03:00
Settings,
2019-12-12 23:26:38 +03:00
SpinGame,
2019-04-11 12:05:13 +03:00
Transfer,
2019-09-04 22:17:39 +03:00
Voters,
Wallet,
2020-03-28 15:49:59 +03:00
AccountBoost,
} from '../screens';
const bottomTabNavigator = createBottomTabNavigator(
2018-10-05 06:42:27 +03:00
{
[ROUTES.TABBAR.FEED]: {
screen: Feed,
navigationOptions: () => ({
tabBarIcon: ({ tintColor }) => (
<Icon iconType="MaterialIcons" name="view-day" color={tintColor} size={scalePx(26)} />
),
}),
},
[ROUTES.TABBAR.NOTIFICATION]: {
screen: Notification,
navigationOptions: () => ({
tabBarIcon: ({ tintColor }) => (
<IconContainer
isBadge
badgeType="notification"
iconType="MaterialIcons"
name="notifications"
color={tintColor}
size={scalePx(26)}
/>
),
}),
},
[ROUTES.TABBAR.POST_BUTTON]: {
screen: () => null,
navigationOptions: {
tabBarIcon: () => <PostButton />,
},
},
[ROUTES.TABBAR.WALLET]: {
screen: Wallet,
navigationOptions: () => ({
tabBarIcon: ({ tintColor }) => (
<Icon
iconType="MaterialIcons"
name="account-balance-wallet"
color={tintColor}
size={scalePx(26)}
/>
),
}),
},
[ROUTES.TABBAR.PROFILE]: {
screen: Profile,
navigationOptions: () => ({
tabBarIcon: ({ tintColor }) => (
<Icon iconType="MaterialIcons" name="person" color={tintColor} size={scalePx(26)} />
),
}),
},
},
{
2020-03-24 13:52:23 +03:00
tabBarComponent: (props) => <BottomTabBar {...props} />,
tabBarOptions: {
showLabel: false,
activeTintColor: '#f6f6f6',
inactiveTintColor: '#c1c5c7',
},
},
);
const mainNavigation = createDrawerNavigator(
{ [ROUTES.SCREENS.FEED]: { screen: bottomTabNavigator } },
{ contentComponent: SideMenu },
);
2019-09-26 00:31:30 +03:00
const stackNavigator = createStackNavigator(
{
[ROUTES.DRAWER.MAIN]: { screen: mainNavigation },
[ROUTES.SCREENS.PROFILE]: { screen: Profile },
[ROUTES.SCREENS.PROFILE_EDIT]: { screen: ProfileEdit },
[ROUTES.SCREENS.POST]: {
screen: Post,
navigationOptions: {
gesturesEnabled: true,
2020-01-30 14:53:39 +03:00
gestureResponseDistance: { horizontal: 70 },
},
},
[ROUTES.SCREENS.EDITOR]: { screen: Editor },
[ROUTES.SCREENS.VOTERS]: { screen: Voters },
[ROUTES.SCREENS.FOLLOWS]: { screen: Follows },
[ROUTES.SCREENS.SETTINGS]: { screen: Settings },
[ROUTES.SCREENS.DRAFTS]: { screen: Drafts },
[ROUTES.SCREENS.BOOKMARKS]: { screen: Bookmarks },
[ROUTES.SCREENS.SEARCH_RESULT]: { screen: SearchResult },
[ROUTES.SCREENS.TRANSFER]: { screen: Transfer },
[ROUTES.SCREENS.BOOST]: { screen: Boost },
[ROUTES.SCREENS.REDEEM]: { screen: Redeem },
[ROUTES.SCREENS.REBLOGS]: { screen: Reblogs },
[ROUTES.SCREENS.SPIN_GAME]: { screen: SpinGame },
2020-03-28 15:49:59 +03:00
[ROUTES.SCREENS.ACCOUNT_BOOST]: { screen: AccountBoost },
2018-10-05 06:42:27 +03:00
},
{
headerMode: 'none',
},
2018-10-05 06:42:27 +03:00
);
2018-10-06 06:33:03 +03:00
export default createSwitchNavigator({
2019-09-26 00:31:30 +03:00
stackNavigator,
2020-05-02 19:35:08 +03:00
[ROUTES.SCREENS.REGISTER]: { screen: Register },
[ROUTES.SCREENS.LOGIN]: { screen: Login },
2018-10-06 06:33:03 +03:00
});