2019-12-12 19:50:58 +03:00
|
|
|
import React from 'react';
|
2019-10-04 18:56:22 +03:00
|
|
|
import { createSwitchNavigator } from 'react-navigation';
|
2019-12-12 19:50:58 +03:00
|
|
|
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';
|
2018-10-04 05:18:36 +03:00
|
|
|
|
2019-12-12 19:50:58 +03:00
|
|
|
// Constants
|
2019-10-04 18:56:22 +03:00
|
|
|
import ROUTES from '../constants/routeNames';
|
2019-12-12 19:50:58 +03:00
|
|
|
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
|
2018-10-13 17:05:42 +03:00
|
|
|
import {
|
2019-01-10 12:05:58 +03:00
|
|
|
Bookmarks,
|
2019-09-04 22:17:39 +03:00
|
|
|
Boost,
|
2019-01-08 15:08:01 +03:00
|
|
|
Drafts,
|
2018-11-01 19:01:19 +03:00
|
|
|
Editor,
|
2019-12-12 19:50:58 +03:00
|
|
|
Feed,
|
2018-11-18 01:48:18 +03:00
|
|
|
Follows,
|
2018-10-31 11:54:33 +03:00
|
|
|
Login,
|
2019-12-12 19:50:58 +03:00
|
|
|
Notification,
|
2018-10-31 11:54:33 +03:00
|
|
|
Post,
|
2018-11-01 19:01:19 +03:00
|
|
|
Profile,
|
2019-09-04 22:17:39 +03:00
|
|
|
ProfileEdit,
|
|
|
|
Reblogs,
|
2019-09-12 23:01:12 +03:00
|
|
|
Redeem,
|
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,
|
2019-12-12 19:50:58 +03:00
|
|
|
Wallet,
|
2018-10-13 17:05:42 +03:00
|
|
|
} from '../screens';
|
2018-10-04 05:18:36 +03:00
|
|
|
|
2019-12-12 19:50:58 +03:00
|
|
|
const bottomTabNavigator = createBottomTabNavigator(
|
2018-10-05 06:42:27 +03:00
|
|
|
{
|
2019-12-12 19:50:58 +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)} />
|
|
|
|
),
|
|
|
|
}),
|
2018-10-26 15:34:45 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2019-12-12 19:50:58 +03:00
|
|
|
tabBarComponent: props => <BottomTabBar {...props} />,
|
|
|
|
tabBarOptions: {
|
|
|
|
showLabel: false,
|
|
|
|
activeTintColor: '#f6f6f6',
|
|
|
|
inactiveTintColor: '#c1c5c7',
|
|
|
|
},
|
2018-10-26 15:34:45 +03:00
|
|
|
},
|
|
|
|
);
|
|
|
|
|
2019-12-12 19:50:58 +03:00
|
|
|
const mainNavigation = createDrawerNavigator(
|
|
|
|
{ [ROUTES.SCREENS.FEED]: { screen: bottomTabNavigator } },
|
|
|
|
{ contentComponent: SideMenu },
|
|
|
|
);
|
|
|
|
|
2019-09-26 00:31:30 +03:00
|
|
|
const stackNavigator = createStackNavigator(
|
2018-10-26 15:34:45 +03:00
|
|
|
{
|
2019-12-12 19:50:58 +03:00
|
|
|
[ROUTES.DRAWER.MAIN]: { screen: mainNavigation },
|
|
|
|
[ROUTES.SCREENS.PROFILE]: { screen: Profile },
|
|
|
|
[ROUTES.SCREENS.PROFILE_EDIT]: { screen: ProfileEdit },
|
2020-01-11 13:08:26 +03:00
|
|
|
[ROUTES.SCREENS.POST]: {
|
|
|
|
screen: Post,
|
|
|
|
navigationOptions: {
|
|
|
|
gesturesEnabled: true,
|
|
|
|
gestureResponseDistance: { horizontal: 100 },
|
|
|
|
},
|
|
|
|
},
|
2019-12-12 19:50:58 +03:00
|
|
|
[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 },
|
2018-10-05 06:42:27 +03:00
|
|
|
},
|
2020-01-11 13:08:26 +03:00
|
|
|
{
|
|
|
|
headerMode: 'none',
|
|
|
|
},
|
2018-10-05 06:42:27 +03:00
|
|
|
);
|
2018-10-06 06:33:03 +03:00
|
|
|
|
2018-10-30 00:38:48 +03:00
|
|
|
export default createSwitchNavigator({
|
2019-09-26 00:31:30 +03:00
|
|
|
stackNavigator,
|
2019-07-12 11:39:25 +03:00
|
|
|
[ROUTES.SCREENS.LOGIN]: { screen: Login },
|
2018-10-06 06:33:03 +03:00
|
|
|
});
|