katoikia-app/mobile-ui/App.js

60 lines
2.4 KiB
JavaScript
Raw Permalink Normal View History

2022-08-17 21:08:38 +00:00
import React,{useState} from "react";
2022-08-04 07:22:41 +00:00
import {
2022-08-17 21:08:38 +00:00
NativeBaseProvider,
Icon
2022-08-04 07:22:41 +00:00
} from "native-base";
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
2022-08-17 16:36:33 +00:00
import { createBottomTabNavigator} from '@react-navigation/bottom-tabs';
import LogIn from "./components/LogIn";
import Home from "./components/Home";
import RecoverPassword from "./components/RecoverPassword";
2022-08-17 16:36:33 +00:00
import Reservas from "./components/Reservas";
import Profile from "./components/Profile";
2022-08-17 21:08:38 +00:00
import { MaterialCommunityIcons } from '@expo/vector-icons';
2022-08-17 22:47:48 +00:00
import AreaComun from "./components/AreaComun";
2022-08-06 05:16:04 +00:00
const Stack = createNativeStackNavigator();
2022-08-17 16:36:33 +00:00
const Tab = createBottomTabNavigator();
2022-07-18 20:54:08 +00:00
2022-08-17 16:36:33 +00:00
2022-08-17 21:08:38 +00:00
2022-08-17 16:36:33 +00:00
function HomeTab() {
2022-08-17 21:08:38 +00:00
const [selected, setSelected] = useState(0);
2022-08-17 16:36:33 +00:00
return (
<Tab.Navigator initialRouteName="Comunicados" >
<Tab.Screen name="Comunicados" component={Home} options={{headerStyle: {
backgroundColor: "#D7A86E"
2022-08-17 21:08:38 +00:00
}, tabBarIcon: () => (<Icon mb="2" as={<MaterialCommunityIcons name={selected === 0 ? 'home' : 'home-outline'} />} color="#D7A86E" size="md" />)}} onclick={() => setSelected(0)} />
2022-08-17 16:36:33 +00:00
<Tab.Screen name="Reservas" component={Reservas } options={{headerStyle: {
backgroundColor: "#D7A86E"
2022-08-17 21:08:38 +00:00
}, tabBarIcon: () => (<Icon mb="2" as={<MaterialCommunityIcons name={selected === 1 ? 'tree' : 'tree-outline'} />} color="#D7A86E" size="md" />)} } onclick={() => setSelected(1)} />
2022-08-17 16:36:33 +00:00
<Tab.Screen name="Perfil" component={Profile} options={{headerStyle: {
backgroundColor: "#D7A86E"
2022-08-17 21:08:38 +00:00
}, tabBarIcon: () => (<Icon mb="2" as={<MaterialCommunityIcons name={selected === 2 ? 'account' : 'account-outline'} />} color="#D7A86E" size="md" />)}} onclick={() => setSelected(2)} />
2022-08-17 16:36:33 +00:00
</Tab.Navigator>
)
}
2022-08-04 07:22:41 +00:00
export default function App() {
return (
<NativeBaseProvider>
2022-07-18 20:54:08 +00:00
<NavigationContainer>
<Stack.Navigator initialRouteName="LogIn">
2022-08-17 16:36:33 +00:00
<Stack.Screen name="Inicio" component={LogIn} options={{headerStyle: {
backgroundColor: "#D7A86E"
}}} />
<Stack.Screen name="Comunicados" component={HomeTab} options={{headerShown: false}} />
2022-08-16 20:27:34 +00:00
<Stack.Screen name="Password" component={RecoverPassword} />
2022-08-18 22:02:50 +00:00
<Stack.Screen name="area" component={AreaComun} options={{headerStyle: {
backgroundColor: "#D7A86E"
}}} />
</Stack.Navigator>
2022-08-17 16:36:33 +00:00
</NavigationContainer>
2022-08-04 07:22:41 +00:00
</NativeBaseProvider>
);
}