/** * Created by MeePwn * https://github.com/maybewaityou * * description: * */ import React from 'react'; import { Image, Text, View } from 'react-native'; import { createBottomTabNavigator } from 'react-navigation'; import { BottomTabBar } from 'react-navigation-tabs'; import { navigator, router } from 'mario-navigation-extension'; import SplashScreen from 'react-native-splash-screen'; import { Images, Style, Color } from '@constant'; import { TabHeaderTitle } from '@configs/navigation'; import { HomeView } from './pages/home/index'; import { InformationView } from './pages/information/index'; import { MessageView } from './pages/message/index'; import { MeView } from './pages/me/index'; export enum TabSelector { HOME = 'Home', INFORMATION = 'Information', MESSAGE = 'Message', ME = 'Me', } export default createBottomTabNavigator( { Home: { screen: HomeView }, Information: { screen: InformationView }, Message: { screen: MessageView }, Me: { screen: MeView }, }, { defaultNavigationOptions: ({ navigation }: any) => ({ tabBarIcon: ({ focused, tintColor }: any) => { const { routeName } = navigation.state; const imageStyle = focused ? Style.tabBar.imageSelected : Style.tabBar.image; if (routeName === TabSelector.HOME) { return ; } else if (routeName === TabSelector.INFORMATION) { return ; } else if (routeName === TabSelector.MESSAGE) { return ; } else if (routeName === TabSelector.ME) { return ; } }, tabBarLabel: ({ focused, tintColor }: any) => { const { routeName } = navigation.state; const style = focused ? Style.tabBar.labelSelected : Style.tabBar.label; if (routeName === TabSelector.HOME) { return {TabHeaderTitle.HOME}; } else if (routeName === TabSelector.INFORMATION) { return {TabHeaderTitle.INFORMATION}; } else if (routeName === TabSelector.MESSAGE) { return {TabHeaderTitle.MESSAGE}; } else if (routeName === TabSelector.ME) { return {TabHeaderTitle.ME}; } }, }), tabBarComponent: (props: Readonly) => { router || SplashScreen.hide(); router || navigator.init(props.navigation); return ; }, tabBarOptions: { activeTintColor: Color.dark, inactiveTintColor: 'gray', }, tabBarPosition: 'bottom', }, );