ENEI2019-Public/App/app/Router.js

273 lines
7.3 KiB
JavaScript
Raw Normal View History

2019-01-08 19:09:50 +00:00
import React from 'react';
2019-02-18 17:44:02 +00:00
import {
TouchableOpacity,
Text,
2019-03-02 18:18:04 +00:00
View,
2019-03-11 01:30:37 +00:00
Image,
2019-02-18 17:44:02 +00:00
} from 'react-native';
import {
createStackNavigator,
createAppContainer,
createSwitchNavigator,
2019-03-11 01:30:37 +00:00
createBottomTabNavigator,
HeaderBackButton
} from 'react-navigation';
2019-01-08 19:09:50 +00:00
import * as Screens from './screens';
2019-02-12 23:07:19 +00:00
2019-03-11 01:30:37 +00:00
/*Icons*/
import Icon from "react-native-vector-icons/Ionicons"
import IconF from "react-native-vector-icons/Foundation"
import IconFA from "react-native-vector-icons/FontAwesome5"
2019-01-30 14:32:25 +00:00
import AuthLoadingScreen from './screens/AuthLoading'
2019-01-08 19:09:50 +00:00
2019-01-30 14:32:25 +00:00
import Eventos from './screens/Eventos'
2019-03-02 18:18:04 +00:00
import Jogo from './screens/Jogo'
2019-01-30 14:32:25 +00:00
import Scan from './screens/Scan'
import Calendar from './screens/Calendar'
2019-01-31 00:46:49 +00:00
import Home from './screens/Home'
2019-02-12 23:07:19 +00:00
2019-01-31 00:46:49 +00:00
2019-02-08 14:23:56 +00:00
import Profile from "./screens/Profile";
2019-02-18 17:44:02 +00:00
import editCalendar from './screens/editCalendar';
import choosePath from './screens/choosePath';
2019-02-22 23:38:34 +00:00
import calendarDetail from './screens/calendarDetail';
2019-03-17 16:12:39 +00:00
2019-03-27 21:15:15 +00:00
//import resetPassword from './screens/resetPassword';
2019-01-30 14:32:25 +00:00
2019-03-18 19:14:00 +00:00
import eventDetail from './screens/eventDetail';
2019-03-18 19:36:08 +00:00
import teamDetail from './screens/teamDetail';
2019-03-18 19:14:00 +00:00
2019-03-23 19:03:56 +00:00
import event from './screens/event';
2019-04-09 05:19:08 +01:00
import map from './screens/map'
2019-03-11 01:30:37 +00:00
const navigationOptions = ({navigation}) => ({
headerLeft: <HeaderBackButton onPress={() => navigation.goBack(null)}/>,
headerStyle: {backgroundColor: 'transparent', zIndex: 100 },
});
2019-03-23 19:03:56 +00:00
const AppStack = createBottomTabNavigator(
{
2019-03-02 18:18:04 +00:00
Calendário: {
2019-02-18 17:44:02 +00:00
screen: Calendar,
2019-01-30 14:32:25 +00:00
navigationOptions: {
2019-01-31 00:46:49 +00:00
tabBarIcon: ({tintColor}) => (
2019-02-18 17:44:02 +00:00
<IconF name="calendar" color={tintColor} size={30}/>
2019-01-31 00:46:49 +00:00
)
},
2019-01-30 14:32:25 +00:00
},
2019-04-09 05:19:08 +01:00
Mapa:{
screen: map,
navigationOptions: {
tabBarIcon: ({tintColor}) => (
<IconF name="map" color={tintColor} size={25}/>
)
},
},
2019-03-11 01:30:37 +00:00
2019-03-23 19:03:56 +00:00
'Jogo': {
2019-03-02 18:18:04 +00:00
screen: Jogo,
2019-01-30 14:32:25 +00:00
navigationOptions: {
2019-01-31 00:46:49 +00:00
tabBarIcon: ({tintColor}) => (
2019-03-11 01:30:37 +00:00
<Image style={{width: 30, height: 30}} source={require('./assets/img/logo2.png')}></Image>
2019-01-31 00:46:49 +00:00
)
},
2019-01-30 14:32:25 +00:00
},
2019-02-08 14:23:56 +00:00
2019-01-31 00:46:49 +00:00
Scan: {
screen: Scan,
2019-01-30 14:32:25 +00:00
navigationOptions: {
2019-01-31 00:46:49 +00:00
tabBarIcon: ({tintColor}) => (
2019-02-22 23:38:34 +00:00
<Icon name="ios-qr-scanner" color={tintColor} size={30}/>
2019-01-31 00:46:49 +00:00
),
},
2019-01-30 14:32:25 +00:00
},
2019-01-31 00:46:49 +00:00
2019-03-11 01:30:37 +00:00
2019-04-09 05:19:08 +01:00
Atividades: {
2019-02-18 17:44:02 +00:00
screen: Eventos,
2019-01-31 00:46:49 +00:00
navigationOptions: {
tabBarIcon: ({tintColor}) => (
2019-02-18 17:44:02 +00:00
<Icon name="ios-beer" color={tintColor} size={30}/>
2019-01-31 00:46:49 +00:00
)
},
2019-01-30 14:32:25 +00:00
},
2019-04-09 05:19:08 +01:00
2019-02-18 17:44:02 +00:00
Home: {
screen: Home,
2019-01-30 14:32:25 +00:00
navigationOptions: {
2019-01-31 00:46:49 +00:00
tabBarIcon: ({tintColor}) => (
2019-02-22 23:38:34 +00:00
<Icon name="ios-person" color={tintColor} size={30}/>
2019-01-31 00:46:49 +00:00
)
2019-01-30 14:32:25 +00:00
},
},
2019-02-08 14:23:56 +00:00
2019-01-31 00:46:49 +00:00
},
{
2019-03-17 20:17:03 +00:00
initialRouteName: 'Home',
2019-01-31 00:46:49 +00:00
2019-03-18 19:14:00 +00:00
2019-01-31 00:46:49 +00:00
tabBarOptions: {
2019-02-22 23:38:34 +00:00
showLabel: true, // hide labels
activeTintColor: '#CC1A17', // active icon color
2019-03-02 18:18:04 +00:00
inactiveTintColor: 'black', // inactive icon color
2019-01-31 00:46:49 +00:00
style: {
backgroundColor: '#fff' // TabBar background
}
}
2019-01-31 00:46:49 +00:00
}
);
2019-01-08 19:09:50 +00:00
2019-02-08 14:23:56 +00:00
const Stack = createStackNavigator({
tabs: {
screen: AppStack,
navigationOptions: ({navigation}) => {
const index = navigation.state.index;
2019-03-12 03:34:40 +00:00
2019-02-18 17:44:02 +00:00
if (navigation.state.routes[index].routeName == 'Home') {
2019-02-08 14:23:56 +00:00
return {
headerTitle: `${navigation.state.routes[index].routeName}`,
headerRight: (
2019-03-11 01:30:37 +00:00
<TouchableOpacity style={{marginRight: 20, flex: 1, flexDirection: 'row'}}
onPress={() => navigation.navigate('Profile')}>
2019-03-23 19:03:56 +00:00
<Text style={{marginRight:5}}>Editar dados</Text>
2019-02-08 14:23:56 +00:00
<IconFA name="user-edit" size={22}/>
2019-03-11 01:30:37 +00:00
2019-02-08 14:23:56 +00:00
</TouchableOpacity>
)
}
2019-02-18 17:44:02 +00:00
}
2019-03-26 04:20:40 +00:00
2019-03-23 19:03:56 +00:00
if (navigation.state.routes[index].routeName == 'Jogo') {
2019-03-19 18:33:03 +00:00
return {
2019-04-06 00:37:03 +01:00
headerTitle: (<Text style={{
textAlign:'center',
color:'#CC1A17',
width:'100%',
fontWeight:'bold',
fontSize:25,
}}>Jogo do ENEI'19</Text>)
2019-03-19 18:33:03 +00:00
}
}
2019-03-11 01:30:37 +00:00
else if (navigation.state.routes[index].routeName == 'Calendário') {
2019-02-18 17:44:02 +00:00
return {
headerTitle: 'Calendário',
headerRight: (
2019-03-11 01:30:37 +00:00
<View style={{flex: 1, flexDirection: 'row'}}>
2019-03-17 16:12:39 +00:00
2019-03-11 01:30:37 +00:00
<TouchableOpacity style={{marginRight: 20, flex: 1, flexDirection: 'row'}}
onPress={() => navigation.navigate('choosePath')}>
2019-03-23 19:03:56 +00:00
<Text style={{color:'#CC1A17', marginRight:5}}>Inscrições</Text>
<IconFA name="user-edit" size={22} color={'#CC1A17'}/>
2019-03-11 01:30:37 +00:00
</TouchableOpacity></View>
2019-02-18 17:44:02 +00:00
)
}
2019-03-11 01:30:37 +00:00
}
else if (navigation.state.routes[index].routeName == 'choosePath') {
2019-03-01 17:36:52 +00:00
return {
headerTitle: 'Calendário',
headerRight: (
2019-03-11 01:30:37 +00:00
<View style={{flex: 1, flexDirection: 'row'}}>
<TouchableOpacity style={{marginRight: 20, flex: 1, flexDirection: 'row'}}
onPress={() => navigation.navigate('Edit')}>
<Text>FAQ</Text>
</TouchableOpacity>
<TouchableOpacity style={{marginRight: 20, flex: 1, flexDirection: 'row'}}
onPress={() => navigation.navigate('choosePath')}>
<Text>Escolher</Text>
<IconFA name="user-edit" size={22}/>
</TouchableOpacity></View>
2019-03-01 17:36:52 +00:00
)
}
2019-03-11 01:30:37 +00:00
}
2019-04-09 05:19:08 +01:00
else if (navigation.state.routes[index].routeName == 'Atividades') {
return {
2019-04-10 15:49:47 +01:00
headerTitle: 'Atividades',
2019-04-09 05:19:08 +01:00
}
}
else if (navigation.state.routes[index].routeName == 'Mapa') {
2019-03-13 01:07:27 +00:00
return {
2019-04-09 05:19:08 +01:00
headerTitle: 'Mapa do Evento',
2019-03-13 01:07:27 +00:00
}
2019-03-12 22:51:17 +00:00
2019-03-13 01:07:27 +00:00
}
2019-02-18 17:44:02 +00:00
else {
2019-02-08 14:23:56 +00:00
return {
header: null
2019-01-31 00:46:49 +00:00
}
}
}
2019-02-08 14:23:56 +00:00
},
Profile: {
screen: Profile
2019-02-18 17:44:02 +00:00
},
2019-03-11 01:30:37 +00:00
Edit: {
2019-02-18 17:44:02 +00:00
screen: editCalendar
},
2019-03-11 01:30:37 +00:00
choosePath: {
2019-02-18 17:44:02 +00:00
screen: choosePath
2019-02-22 23:38:34 +00:00
},
2019-03-11 01:30:37 +00:00
calendarDetail: {
screen: calendarDetail,
},
2019-03-17 16:12:39 +00:00
eventDetail: {
screen: eventDetail,
2019-03-13 20:23:59 +00:00
},
2019-03-18 19:36:08 +00:00
teamDetail:{
screen: teamDetail,
2019-03-18 19:14:00 +00:00
},
2019-03-13 20:23:59 +00:00
2019-03-27 21:15:15 +00:00
2019-03-23 19:03:56 +00:00
event:{
screen: event
2019-03-12 07:31:41 +00:00
}
2019-02-08 14:23:56 +00:00
});
export default createAppContainer(createSwitchNavigator(
{
AuthLoading: AuthLoadingScreen,
App: Stack,
2019-03-11 01:30:37 +00:00
},
{
2019-01-31 00:46:49 +00:00
initialRouteName: 'App'
})
);
2019-01-08 19:09:50 +00:00