blazerapp/app/App.js

95 lines
2.6 KiB
JavaScript
Raw Permalink Normal View History

2020-10-18 20:47:15 -04:00
import React, {Fragment, useEffect} from 'react';
2020-08-09 16:37:46 -04:00
import {
SafeAreaView,
StyleSheet,
ScrollView,
View,
Text,
StatusBar,
Image,
2020-08-09 16:37:46 -04:00
} from 'react-native';
import {
Header,
LearnMoreLinks,
Colors,
DebugInstructions,
ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';
import { NavigationContainer } from '@react-navigation/native'
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'
2020-08-09 17:01:25 -04:00
import Home from './Home'
import Calendar from './Calendar'
import Clubs from './Clubs'
import More from './More'
2020-08-18 21:29:44 -04:00
import Staff from './Staff'
2020-10-18 20:47:15 -04:00
import OpeningPage from './OpeningPage';
import OpenPage from './OpenPage';
import Ionicons from 'react-native-vector-icons/Ionicons';
2021-08-17 21:18:32 -04:00
import I18n from './i18n.js'
import AsyncStorage from '@react-native-async-storage/async-storage'
2021-01-01 00:23:17 -05:00
2020-08-09 17:01:25 -04:00
const Tab = createBottomTabNavigator();
2020-08-09 16:37:46 -04:00
2021-08-17 21:18:32 -04:00
AsyncStorage.getItem('language')
2021-01-01 00:23:17 -05:00
.then((token) => {
console.log("lang: " + token);
I18n.locale = token;
});
2021-08-17 21:18:32 -04:00
2020-08-09 16:37:46 -04:00
class App extends React.Component {
2020-10-18 20:47:15 -04:00
state = {
loaded: false
}
constructor() {
super();
OpeningPage.load(v => this.setState({loaded: true}));
}
2020-08-09 16:37:46 -04:00
render() {
return (
<NavigationContainer >
2020-10-18 20:47:15 -04:00
{this.state.loaded ?
<Tab.Navigator
screenOptions={({ route }) => ({
tabBarIcon: ({ focused, color, size }) => {
let iconName;
2021-01-01 00:23:17 -05:00
if (route.name === 'Home' || route.name === 'Casa') {
iconName = focused ? 'ios-home' : 'ios-home-outline';
2021-01-01 00:23:17 -05:00
} else if (route.name === 'Calendar' || route.name === 'Calendario') {
iconName = focused ? 'ios-calendar' : 'ios-calendar-outline';
2021-01-01 00:23:17 -05:00
} else if (route.name === 'Clubs' || route.name === 'Clubes') {
iconName = focused ? 'ios-people-circle' : 'ios-people-circle-outline';
2021-01-01 00:23:17 -05:00
} else if (route.name === 'Staff' || route.name === 'Personal') {
iconName = focused ? 'ios-nutrition' : 'ios-nutrition-outline';
2021-01-01 00:23:17 -05:00
} else if (route.name === 'More' || route.name === 'Más') {
iconName = focused ? 'ios-ellipsis-horizontal' : 'ios-ellipsis-horizontal-outline';
}
return <Ionicons name={iconName} size={size} color={color} />;
},
})}
tabBarOptions={{
activeTintColor: 'red',
labelStyle:{
fontSize:16
}}}
>
2021-08-17 21:18:32 -04:00
<Tab.Screen name={I18n.t("app.home")} component={Home}/>
<Tab.Screen name={I18n.t("app.calendar")} component={Calendar}/>
<Tab.Screen name={I18n.t("app.clubs")} component={Clubs}/>
<Tab.Screen name={I18n.t("app.staff")} component={Staff}/>
<Tab.Screen name={I18n.t("app.more")} component={More}/>
2020-08-09 16:37:46 -04:00
</Tab.Navigator>
2020-10-18 20:47:15 -04:00
: <OpenPage />}
2020-08-09 16:37:46 -04:00
</NavigationContainer>
2020-10-18 20:47:15 -04:00
);
2020-08-09 16:37:46 -04:00
}
}
export default App;