ecency-mobile/src/navigation/routes.js

170 lines
4.4 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,
TagResult,
2020-07-15 21:11:16 +03:00
Community,
2021-01-13 20:23:16 +03:00
Communities,
WebBrowser,
2022-02-11 06:04:27 +03:00
ReferScreen,
2022-02-13 11:54:23 +03:00
CoinDetails,
} from '../screens';
const bottomTabNavigator = createBottomTabNavigator(
2018-10-05 06:42:27 +03:00
{
[ROUTES.TABBAR.FEED]: {
screen: Feed,
navigationOptions: () => ({
tabBarIcon: ({ tintColor }) => (
2020-08-07 08:47:20 +03:00
<Icon
iconType="MaterialIcons"
style={{ padding: 15 }}
name="view-day"
color={tintColor}
size={scalePx(26)}
/>
),
}),
},
[ROUTES.TABBAR.NOTIFICATION]: {
screen: Notification,
navigationOptions: () => ({
tabBarIcon: ({ tintColor }) => (
<IconContainer
isBadge
badgeType="notification"
iconType="MaterialIcons"
2020-08-07 08:47:20 +03:00
style={{ padding: 15 }}
name="notifications"
color={tintColor}
size={scalePx(26)}
/>
),
}),
},
[ROUTES.TABBAR.POST_BUTTON]: {
screen: () => null,
navigationOptions: {
2020-08-07 10:42:23 +03:00
tabBarIcon: () => <PostButton />,
},
},
[ROUTES.TABBAR.WALLET]: {
screen: Wallet,
navigationOptions: () => ({
tabBarIcon: ({ tintColor }) => (
<Icon
iconType="MaterialIcons"
2020-08-07 08:47:20 +03:00
style={{ padding: 15 }}
name="account-balance-wallet"
color={tintColor}
size={scalePx(26)}
/>
),
}),
},
[ROUTES.TABBAR.PROFILE]: {
screen: Profile,
navigationOptions: () => ({
tabBarIcon: ({ tintColor }) => (
2020-08-07 08:47:20 +03:00
<Icon
iconType="MaterialIcons"
style={{ padding: 15 }}
name="person"
color={tintColor}
size={scalePx(26)}
/>
),
}),
},
},
{
2020-03-24 13:52:23 +03:00
tabBarComponent: (props) => <BottomTabBar {...props} />,
tabBarOptions: {
showLabel: false,
2020-08-07 08:47:20 +03:00
activeTintColor: '#357ce6',
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.TAG_RESULT]: { screen: TagResult },
[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 },
2020-07-15 21:11:16 +03:00
[ROUTES.SCREENS.COMMUNITY]: { screen: Community },
2021-01-13 20:23:16 +03:00
[ROUTES.SCREENS.COMMUNITIES]: { screen: Communities },
[ROUTES.SCREENS.WEB_BROWSER]: { screen: WebBrowser },
2022-02-11 06:04:27 +03:00
[ROUTES.SCREENS.REFER]: { screen: ReferScreen },
2022-02-13 11:54:23 +03:00
[ROUTES.SCREENS.COIN_DETAILS]: { screen: CoinDetails },
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
});