diff --git a/App/android/app/build.gradle b/App/android/app/build.gradle index 2b2f7adc..ec49a2d4 100755 --- a/App/android/app/build.gradle +++ b/App/android/app/build.gradle @@ -149,6 +149,7 @@ android { } dependencies { + compile project(':react-native-maps') compile project(':react-native-device-info') compile project(':react-native-material-shadows') compile project(':react-native-linear-gradient') diff --git a/App/android/app/src/main/AndroidManifest.xml b/App/android/app/src/main/AndroidManifest.xml index 94c48efd..46057b3b 100755 --- a/App/android/app/src/main/AndroidManifest.xml +++ b/App/android/app/src/main/AndroidManifest.xml @@ -1,27 +1,30 @@ + package="com.app"> - + - - - - - - - + android:name=".MainApplication" + android:label="@string/app_name" + android:icon="@mipmap/ic_launcher" + android:allowBackup="false" + android:theme="@style/AppTheme"> + + + + + + + + diff --git a/App/android/app/src/main/java/com/app/MainApplication.java b/App/android/app/src/main/java/com/app/MainApplication.java index 8b11f16a..23ca3771 100755 --- a/App/android/app/src/main/java/com/app/MainApplication.java +++ b/App/android/app/src/main/java/com/app/MainApplication.java @@ -3,6 +3,7 @@ package com.app; import android.app.Application; import com.facebook.react.ReactApplication; +import com.airbnb.android.react.maps.MapsPackage; import com.learnium.RNDeviceInfo.RNDeviceInfo; import ui.materialshadows.RNMaterialShadowsPackage; import com.BV.LinearGradient.LinearGradientPackage; @@ -29,6 +30,7 @@ public class MainApplication extends Application implements ReactApplication { protected List getPackages() { return Arrays.asList( new MainReactPackage(), + new MapsPackage(), new RNDeviceInfo(), new RNMaterialShadowsPackage(), new LinearGradientPackage(), diff --git a/App/android/settings.gradle b/App/android/settings.gradle index 7c9cafb3..8dc9c679 100755 --- a/App/android/settings.gradle +++ b/App/android/settings.gradle @@ -1,4 +1,6 @@ rootProject.name = 'app' +include ':react-native-maps' +project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/lib/android') include ':react-native-device-info' project(':react-native-device-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-device-info/android') include ':react-native-material-shadows' @@ -11,5 +13,7 @@ include ':react-native-vector-icons' project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android') include ':react-native-gesture-handler' project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android') +include ':react-native-maps' +project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/lib/android') include ':app' diff --git a/App/app/App.js b/App/app/App.js index b4f401ee..33efa9f0 100755 --- a/App/app/App.js +++ b/App/app/App.js @@ -1,555 +1,584 @@ -import React, {Component} from 'react'; +import React, { Component } from "react"; import { - Platform, - StyleSheet, - Text, - View, - StatusBar, - Dimensions, - Image, - ActivityIndicator, - Button, - TouchableHighlight, - Keyboard, - ImageBackground, - LinearGradient, - TouchableOpacity, - TextInput, - NetInfo, - Animated + Platform, + StyleSheet, + Text, + View, + StatusBar, + Dimensions, + Image, + ActivityIndicator, + Button, + TouchableHighlight, + Keyboard, + ImageBackground, + LinearGradient, + TouchableOpacity, + TextInput, + NetInfo, + Animated +} from "react-native"; -} from 'react-native'; +import { bindActionCreators } from "redux"; +import { connect } from "react-redux"; -import {bindActionCreators} from 'redux'; -import {connect} from 'react-redux'; +import QRCodeScanner from "react-native-qrcode-scanner"; +import { UtilStyles } from "./assets/styles"; -import QRCodeScanner from 'react-native-qrcode-scanner'; -import {UtilStyles} from './assets/styles' +import * as Actions from "./store/actions"; -import * as Actions from './store/actions'; - -import {RkButton, RkTheme, RkText, RkTextInput} from 'react-native-ui-kitten'; +import { RkButton, RkTheme, RkText, RkTextInput } from "react-native-ui-kitten"; import Modal from "react-native-modal"; -import Router from './Router' +import Router from "./Router"; -import Icon from "react-native-vector-icons/Ionicons" +import Icon from "react-native-vector-icons/Ionicons"; const SCREEN_HEIGHT = Dimensions.get("window").height; const SCREEN_WIDTH = Dimensions.get("window").width; -import Swiper from 'react-native-swiper'; -var TimerMixin = require('react-timer-mixin'); +import Swiper from "react-native-swiper"; +import resetPassword from "./screens/resetPassword"; +var TimerMixin = require("react-timer-mixin"); function handleConnectivityChange() { console.log("asdasd"); - } - -class App extends Component { - handleConnectivityChange = isConnected => { - this.setState({ isConnected }); - } - _activate=()=>{ - - this.setState({ isModalVisible: !this.state.isModalVisible}); - this.scanner.reactivate(); - - } - _scanQr=()=>{ - this.props.openScannerLogin() - console.log(this.props.UI_loginScannerActive) - } - _tryLogin=()=>{ - - //console.log(this.state.text) - //this.scanner.reactivate(); - this.props.login(this.state.username, this.state.text); - - - - } - - _toggleModal = () => - this.setState({ isModalVisible: !this.state.isModalVisible }); - - constructor(props) { - - super(props); - - this.state = { - - token: {valid: false}, - tokenData: '', - onHold: true, - logged: false, - isModalVisible: false, - state : {text: ''}, - username:'QR code', - failedAttempt: false, - push:4, - UI_loginScannerActive:false, - userDetails:{username:'', password:''}, - isConnected: true - }; - - } - _print=()=>{ - console.log("hello") - this.setState({push:0}) - } - checkValue=(e)=>{ - console.log("check"+e) - } - _handleConnectionChange = (isConnected) => { - this.props.connectionState(true); - }; - - - componentDidMount() { - this.props.hold(); - NetInfo.isConnected.addEventListener('connectionChange', this.handleConnectivityChange); - - this.setState({isModalVisible: false}) - //verifica se o utilizador tem token guardado - this.props.checkUser(this.props.userDetails); - this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', this._keyboardDidShow); - this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this._keyboardDidHide); - - - } - componentWillUnmount() { - NetInfo.isConnected.removeEventListener('connectionChange', this.handleConnectivityChange); - } - - _keyboardDidShow () { - //alert('Keyboard Shown'); - // this.setState({push:0}) - - } - - _keyboardDidHide () { - - //this.setState({push:4}) - - } - onSuccess = (e) => { - - // this.setState({ isModalVisible: !this.state.isModalVisible }); - // this.props.login(e.data, 'f8908cc0'); - this.props.closeLoginQRScan(); - this.setState({username:e.data}) - - console.log("QR code lido"); - - - - }; - - render() { - if (!this.state.isConnected) { - return ( - - cenas da vida - - ); - } - if (!this.props.logged && this.props.onHold) { - - - return ( - - - - - ) - - } - else - { - - // console.log('token... '+ this.props.logged) - - //se existir token - - if (this.props.logged ) { - - return ( - - - ) - } - return ( - - - - - - - - - - - - - - - - - - - - - - - - {this.setState({searchString})}} - maxLength={15} - underlineColorAndroid="transparent" - /> - - - - - - Scan QR - - - - - - - this.setState({text})} - clearButtonMode='always' - value={this.state.text} - clearTextOnFocus={true} - onSubmitEditing={Keyboard.dismiss} - placeholder='Password' /> - - Entrar - - - - - - - - - - - - - - - - - - - - - - - Não sabes a password? - - - - Recuperar Password - - - - - - - - - - ); - - } - } } +class App extends Component { -RkTheme.setType('RkButton', 'dark', { - container: { - paddingTop: 10, - backgroundColor: 'gray', + - borderRadius: 90, + handleConnectivityChange = isConnected => { + this.setState({ isConnected }); + }; + _activate = () => { + this.setState({ isModalVisible: !this.state.isModalVisible }); + this.scanner.reactivate(); + }; + _scanQr = () => { + this.props.openScannerLogin(); + console.log(this.props.UI_loginScannerActive); + }; + _tryLogin = () => { + this.props.waitLogin(); + //console.log(this.state.text) + //this.scanner.reactivate(); + this.props.login(this.state.username, this.state.text); + }; + + _toggleModal = () => + this.setState({ isModalVisible: !this.state.isModalVisible }); + + constructor(props) { + super(props); + + this.state = { + token: { valid: false }, + tokenData: "", + onHold: true, + logged: false, + isModalVisible: false, + state: { text: "" }, + username: "QR code", + failedAttempt: false, + push: 4, + UI_loginScannerActive: false, + userDetails: { username: "", password: "" }, + isConnected: true, + modalOpen: false, + modalResetPassword:false, + resetText:'' + }; + } + _print = () => { + console.log("hello"); + this.setState({ push: 0 }); + }; + checkValue = e => { + console.log("check" + e); + }; + _handleConnectionChange = isConnected => { + this.props.connectionState(true); + }; + + componentDidMount() { + //this.props.hold(); + this.props.loginInternal(); + NetInfo.isConnected.addEventListener( + "connectionChange", + this.handleConnectivityChange + ); + + this.setState({ isModalVisible: false }); + //verifica se o utilizador tem token guardado + this.props.checkUser(this.props.userDetails); + this.keyboardDidShowListener = Keyboard.addListener( + "keyboardDidShow", + this._keyboardDidShow + ); + this.keyboardDidHideListener = Keyboard.addListener( + "keyboardDidHide", + this._keyboardDidHide + ); + } + componentWillUnmount() { + NetInfo.isConnected.removeEventListener( + "connectionChange", + this.handleConnectivityChange + ); + } + _toggle=()=>{ + this.setState({modalResetPassword:false}) + } + //faz call + _reset=()=>{ + //fecha modal + this.props.resetPassword(this.props.userDetails.token,this.state.resetText), + this.setState({modalResetPassword:false}) + //faz call + } + + _keyboardDidShow() { + //alert('Keyboard Shown'); + // this.setState({push:0}) + } + + _keyboardDidHide() { + //this.setState({push:4}) + } + onSuccess = e => { + // this.setState({ isModalVisible: !this.state.isModalVisible }); + // this.props.login(e.data, 'f8908cc0'); + this.props.closeLoginQRScan(); + this.setState({ username: e.data }); + + console.log("QR code lido"); + }; + + render() { + + + + + if (!this.props.logged && this.props.onHold) { + return ( + + + + ); + } else { + // console.log('token... '+ this.props.logged) + + //se existir token + + if (this.props.logged) { + return ; + } + return ( + + + + + + + + + + + + + Reset Password + Deves introduzir o email com o qual efectuaste a compra do bilhete. + this.setState({ resetText:r })} + clearButtonMode="always" + value={this.state.resetText} + clearTextOnFocus={true} + onSubmitEditing={Keyboard.dismiss} + placeholder="Email ou Qr code" + /> + + + Caso tenhas problemas com este processo deves contactar a comissão organizadora atravês do email geral. + + + + + + + + + + { + this.setState({ searchString }); + }} + maxLength={15} + underlineColorAndroid="transparent" + /> + + + + + + + + + this.setState({ text })} + clearButtonMode="always" + value={this.state.text} + clearTextOnFocus={true} + onSubmitEditing={Keyboard.dismiss} + placeholder="Password" + /> + { !this.props.loadingLogin && + + + Login + + + } + {this.props.alignItems && + + } + + + + + + + + + + + + + + + + Não sabes a password? + + {this.setState({modalResetPassword:true})}}> + + Reset Password + + + + + + + ); } -}); + } +} +RkTheme.setType("RkButton", "dark", { + container: { + paddingTop: 10, + backgroundColor: "gray", + + borderRadius: 90 + } +}); const rectDimensions = SCREEN_WIDTH * 0.85; // this is equivalent to 255 from a 393 device width -const overlayColor = 'rgba(0,0,0,0.30)'; +const overlayColor = "rgba(0,0,0,0.30)"; const styles = { - cameraContainer:{ - // height: Dimensions.get('window').height , - }, - passwordInput:{ - borderRadius: 90, - - borderColor:'#bfbdbd', - borderWidth: 1, - marginTop:20, - marginBottom:20, - width:SCREEN_WIDTH*0.8, - - backgroundColor: 'white', - - borderRadius: 90, - height: SCREEN_HEIGHT*0.08, - borderColor:'#bfbdbd', - borderWidth: 1, - paddingLeft:SCREEN_WIDTH*0.05, - - }, - scanQRText:{ - - paddingTop:50 - // paddingTop:20, - - - }, - scanQR:{ - - //flexDirection: 'row', - paddingTop:5, - backgroundColor:10, - - width:80, - paddingLeft:10, - backgroundColor:'#f24b4b', - borderBottomRightRadius:90, - borderTopRightRadius:90, - height:'100%', - - }, - inputSection: { - - flexDirection: 'row', - backgroundColor: '#fff', - - backgroundColor: 'white', - - borderRadius: 90, - height: SCREEN_HEIGHT*0.08, - borderColor:'#bfbdbd', - borderWidth: 1, - - - }, - searchIcon: { - paddingLeft:10 - }, - - input: { - - - - flex: 1, - paddingRight: 10, - - - paddingLeft: 0, - paddingLeft:SCREEN_WIDTH*0.05, - color: '#424242', - - }, - textRow:{ - marginBottom:40 - }, - loginContainer:{ - width: '100%', - height: '30%', - justifyContent: 'center', - alignItems: 'center' - }, - loginBtn:{ - marginTop:10, - marginBottom:20, - marginLeft: '25%', - - }, + cameraContainer: { + height: Dimensions.get('window').height , + }, + resetPassword:{ - button: { - borderWidth:1, - borderColor:'rgba(0,0,0,0.2)', - alignItems:'center', - justifyContent:'center', - width:60, - height:60, - backgroundColor:'#fff', - borderRadius:100, - marginRight: 10, - marginLeft:10 - }, - footer: {}, + - buttons: { - flexDirection: 'row', - marginBottom: 24, - marginHorizontal: 24, - marginTop:24, - justifyContent: 'space-around', - - - }, + borderColor: "#bfbdbd", + borderWidth: 1, + margin:20, + marginTop: 60, + marginBottom: 60, - logoContainer:{ + width: SCREEN_WIDTH * 0.8, - width:'100%', - - justifyContent: 'center', - alignItems: 'center', - marginTop:200 + backgroundColor: "white", - }, + borderRadius: 3, + height: SCREEN_HEIGHT * 0.08, + borderColor: "#bfbdbd", + borderWidth: 1, + paddingLeft: SCREEN_WIDTH * 0.05 + }, + passwordInput: { + - logo2:{ - - // flex: 1, - // resizeMode: 'contain', - width: 200, height: 200, + borderColor: "#bfbdbd", + borderWidth: 1, + marginTop: 20, + marginBottom: 20, + width: SCREEN_WIDTH * 0.8, - }, - wrapper: { - }, - slide1: { - flex: 1, - justifyContent: 'center', - alignItems: 'center', - backgroundColor: 'white', - }, - slide2: { - flex: 1, - justifyContent: 'center', - alignItems: 'center', - backgroundColor: 'white', - }, - slide3: { - flex: 1, - justifyContent: 'center', - alignItems: 'center', - color:'black', - backgroundColor: 'white', - }, - text: { - color: '#fff', - fontSize: 30, - fontWeight: 'bold', - }, - recover: { - paddingTop: 10, - color: "red", - paddingBottom: 10 - }, - manual: {}, + backgroundColor: "white", - logo: { + borderRadius: 3, + height: SCREEN_HEIGHT * 0.08, + borderColor: "#bfbdbd", + borderWidth: 1, + paddingLeft: SCREEN_WIDTH * 0.05 + }, + scanQRText: { + paddingTop: 50 + // paddingTop:20, + }, + scanQR: { + //flexDirection: 'row', + flex:1, +//paddingTop: 5, + backgroundColor: 10, + alignItems:'center', + padding:5, + paddingRight:15, - height: SCREEN_HEIGHT * 0.35, - width: SCREEN_WIDTH, - backgroundColor: overlayColor, - }, - rectangleContainer: { + //width: 80, + // paddingLeft: 10, + backgroundColor: "#CC1A17", + borderBottomRightRadius: 3, + borderTopRightRadius: 3, + // height: "100%" + }, + inputSection: { + flexDirection: "row", + backgroundColor: "#fff", - flex: 1, - alignItems: "center", - justifyContent: "center", - backgroundColor: "transparent", + backgroundColor: "white", - }, + borderRadius: 3, + height: SCREEN_HEIGHT * 0.08, + borderColor: "#bfbdbd", + borderWidth: 1 + }, + searchIcon: { + paddingLeft: 10 + }, - rectangle: { + input: { + flex: 1, + paddingRight: 10, - height: rectDimensions, - width: rectDimensions, - alignItems: "center", - justifyContent: "center", - backgroundColor: "transparent" - }, + paddingLeft: 0, + paddingLeft: SCREEN_WIDTH * 0.05, + color: "#424242" + }, + textRow: { + marginBottom: 40 + }, + loginContainer: { + width: "100%", + height: "30%", + justifyContent: "center", + alignItems: "center" + }, + loginBtn: { + marginTop: 10, + marginBottom: 20, + marginLeft: "25%" + }, - topOverlay: { - flex: 1, - backgroundColor: overlayColor, - justifyContent: "center", - alignItems: "center" - }, + button: { + borderWidth: 1, + borderColor: "rgba(0,0,0,0.2)", + alignItems: "center", + justifyContent: "center", + width: 60, + height: 60, + backgroundColor: "#fff", + borderRadius: 100, + marginRight: 10, + marginLeft: 10 + }, + footer: {}, - bottomOverlay: { - flex: 1, - height: SCREEN_HEIGHT, - width: SCREEN_WIDTH, - backgroundColor: overlayColor, - paddingBottom: SCREEN_WIDTH * 0.2 - }, + buttons: { + flexDirection: "row", + marginBottom: 24, + marginHorizontal: 24, + marginTop: 24, + justifyContent: "space-around" + }, - leftAndRightOverlay: { - height: rectDimensions, - width: SCREEN_WIDTH, - backgroundColor: overlayColor - }, + logoContainer: { + width: "100%", + + justifyContent: "center", + alignItems: "center", + marginTop: 200, + + }, + + logo2: { + // flex: 1, + // resizeMode: 'contain', + width: 200, + height: 200 + }, + wrapper: {}, + slide1: { + flex: 1, + justifyContent: "center", + alignItems: "center", + backgroundColor: "white" + }, + slide2: { + flex: 1, + justifyContent: "center", + alignItems: "center", + backgroundColor: "white" + }, + slide3: { + flex: 1, + justifyContent: "center", + alignItems: "center", + color: "black", + backgroundColor: "white" + }, + text: { + color: "#fff", + fontSize: 30, + fontWeight: "bold" + }, + recover: { + paddingTop: 10, + color: "red", + paddingBottom: 10 + }, + manual: {}, + + logo: { + height: SCREEN_HEIGHT * 0.35, + width: SCREEN_WIDTH, + backgroundColor: overlayColor + }, + rectangleContainer: { + flex: 1, + alignItems: "center", + justifyContent: "center", + backgroundColor: "transparent" + }, + + rectangle: { + height: rectDimensions, + width: rectDimensions, + alignItems: "center", + justifyContent: "center", + backgroundColor: "transparent" + }, + + topOverlay: { + flex: 1, + backgroundColor: overlayColor, + justifyContent: "center", + alignItems: "center" + }, + + bottomOverlay: { + flex: 1, + height: SCREEN_HEIGHT, + width: SCREEN_WIDTH, + backgroundColor: overlayColor, + paddingBottom: SCREEN_WIDTH * 0.2 + }, + + leftAndRightOverlay: { + height: rectDimensions, + width: SCREEN_WIDTH, + backgroundColor: overlayColor + } }; -RkTheme.setType('RkTextInput', 'frame', { - input: { - backgroundColor: 'white', - marginLeft: 0, - marginHorizontal: 0, - borderRadius: 5 - }, - color: 'gray', - backgroundColor: 'gray', - borderRadius: 10, - container: { - paddingHorizontal: 20 - } - }); - +RkTheme.setType("RkTextInput", "frame", { + input: { + backgroundColor: "white", + marginLeft: 0, + marginHorizontal: 0, + borderRadius: 5 + }, + color: "gray", + backgroundColor: "gray", + borderRadius: 10, + container: { + paddingHorizontal: 20 + } +}); + mapStateToProps = (state, props) => { - - return { - token: state.apiReducer.token, - loggedIn: state.apiReducer.loggedIn, - onHold: state.apiReducer.onHold, - logged: state.apiReducer.logged, - failedAttempt:state.apiReducer.failedAttempt, - UI_loginScannerActive: state.uiReducer.UI_loginScannerActive, - userDetails: state.apiReducer.userDetails, - } + return { + token: state.apiReducer.token, + loggedIn: state.apiReducer.loggedIn, + onHold: state.apiReducer.onHold, + logged: state.apiReducer.logged, + failedAttempt: state.apiReducer.failedAttempt, + UI_loginScannerActive: state.uiReducer.UI_loginScannerActive, + userDetails: state.apiReducer.userDetails, + modalOpen: state.apiReducer.modalOpen, + modalInfo: state.apiReducer.modalInfo, + type: state.apiReducer.type, + loadingLogin:state.apiReducer.loadingLogin + }; }; -mapDispatchToProps = (dispatch) => { - - return bindActionCreators(Actions, dispatch); +mapDispatchToProps = dispatch => { + return bindActionCreators(Actions, dispatch); }; - -export default connect(mapStateToProps, mapDispatchToProps)(App); \ No newline at end of file +export default connect( + mapStateToProps, + mapDispatchToProps +)(App); diff --git a/App/app/Router.js b/App/app/Router.js index 74783cfe..fc7db444 100755 --- a/App/app/Router.js +++ b/App/app/Router.js @@ -3,16 +3,23 @@ import { TouchableOpacity, Text, View, - Image + Image, + } from 'react-native'; import { createStackNavigator, createAppContainer, createSwitchNavigator, - createBottomTabNavigator + createBottomTabNavigator, + HeaderBackButton } from 'react-navigation'; import * as Screens from './screens'; +/*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" + import AuthLoadingScreen from './screens/AuthLoading' @@ -25,16 +32,18 @@ import Calendar from './screens/Calendar' import Home from './screens/Home' - -/*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" import Profile from "./screens/Profile"; import editCalendar from './screens/editCalendar'; import choosePath from './screens/choosePath'; import calendarDetail from './screens/calendarDetail'; +import FebradaDetail from './screens/FebradaDetail'; +import resetPassword from './screens/resetPassword'; +const navigationOptions = ({navigation}) => ({ + headerLeft: navigation.goBack(null)}/>, + headerStyle: {backgroundColor: 'transparent', zIndex: 100 }, + +}); const AppStack = createBottomTabNavigator( { @@ -48,15 +57,15 @@ const AppStack = createBottomTabNavigator( ) }, }, - + 'Jogo do...': { screen: Jogo, navigationOptions: { tabBarIcon: ({tintColor}) => ( - - + + ) }, }, @@ -71,8 +80,8 @@ const AppStack = createBottomTabNavigator( }, }, - - Eventos: { + + Eventos: { screen: Eventos, navigationOptions: { @@ -82,7 +91,7 @@ const AppStack = createBottomTabNavigator( ) }, }, - + Home: { screen: Home, navigationOptions: { @@ -94,10 +103,9 @@ const AppStack = createBottomTabNavigator( }, - }, { - initialRouteName: 'Home', + initialRouteName: 'Eventos', tabBarOptions: { showLabel: true, // hide labels @@ -115,56 +123,67 @@ const Stack = createStackNavigator({ screen: AppStack, navigationOptions: ({navigation}) => { const index = navigation.state.index; - + + if (navigation.state.routes[index].routeName == 'Home') { return { headerTitle: `${navigation.state.routes[index].routeName}`, headerRight: ( - navigation.navigate('Profile')}> - + navigation.navigate('Profile')}> + editar - + ) } } - else if(navigation.state.routes[index].routeName == 'Calendário'){ + else if (navigation.state.routes[index].routeName == 'Calendário') { return { headerTitle: 'Calendário', headerRight: ( - - navigation.navigate('Edit')}> - FAQ - - + + navigation.navigate('Edit')}> + FAQ + + + + navigation.navigate('choosePath')}> + Escolher + + - navigation.navigate('choosePath')}> - Escolher - - - ) } - } - else if(navigation.state.routes[index].routeName == 'choosePath'){ + } + else if (navigation.state.routes[index].routeName == 'choosePath') { return { headerTitle: 'Calendário', headerRight: ( - - navigation.navigate('Edit')}> - FAQ - - + + navigation.navigate('Edit')}> + FAQ + + + + navigation.navigate('choosePath')}> + Escolher + + - navigation.navigate('choosePath')}> - Escolher - - - ) } - } + } + else if (navigation.state.routes[index].routeName == 'Eventos') { + return { + headerTitle: 'Eventos', + } + } else { return { header: null @@ -175,18 +194,23 @@ const Stack = createStackNavigator({ Profile: { screen: Profile }, - Edit:{ + Edit: { screen: editCalendar }, - choosePath:{ + choosePath: { screen: choosePath }, - calendarDetail:{ - screen:calendarDetail + calendarDetail: { + screen: calendarDetail, + }, + FebradaDetail: { + screen: FebradaDetail, + }, + + + resetPassword:{ + screen:resetPassword } - - - }); @@ -194,7 +218,7 @@ export default createAppContainer(createSwitchNavigator( { AuthLoading: AuthLoadingScreen, App: Stack, - + }, { diff --git a/App/app/components/Nav.js b/App/app/components/Nav.js new file mode 100644 index 00000000..eb06de50 --- /dev/null +++ b/App/app/components/Nav.js @@ -0,0 +1,99 @@ +import React, { Component } from 'react' +import { StyleSheet, Text, View } from 'react-native' +import { Icon } from 'react-native-elements' + +const styles = StyleSheet.create({ + centerRow: { + alignItems: 'flex-start', + backgroundColor: 'transparent', + flex: 3, + flexDirection: 'column', + justifyContent: 'center', + }, + + container: { + backgroundColor: 'transparent', + borderBottomWidth: 0, + elevation: 0, + flexDirection: 'row', + height: 55, + justifyContent: 'center', + left: 0, + marginLeft: 10, + marginRight: 10, + //marginTop: 22, + position: 'absolute', + right: 0, + zIndex: 100, + }, + icon: { + justifyContent: 'flex-start', + marginTop: 2.8, + }, + iconContainer: { + alignSelf: 'center', + }, + leftRow: { + backgroundColor: 'transparent', + flex: 1, + flexDirection: 'row', + justifyContent: 'flex-start', + }, + rightRow: { + alignItems: 'flex-end', + backgroundColor: 'transparent', + flex: 2, + flexDirection: 'row', + justifyContent: 'flex-end', + marginRight: 4, + }, + titleText: { + color: '#000', + fontSize: 24, + fontWeight: '600', + }, + subTitleText: { + color: '#000', + fontSize: 14, + fontWeight: '400', + }, +}); + +class Nav extends Component { + + + render() { + const { navigation, title} = this.props; + + return ( + + + + navigation.goBack(null)} + color= '#000' + iconStyle={styles.icon} + underlayColor="transparent" + underlineColorAndroid="transparent" + containerStyle={styles.iconContainer} + hitSlop={{ top: 15, bottom: 15, left: 15, right: 15 }} + /> + + + + {title} + + + + + + + + ) + } +} + +export default Nav \ No newline at end of file diff --git a/App/app/screens/Calendar.js b/App/app/screens/Calendar.js index bb216504..6d841d91 100644 --- a/App/app/screens/Calendar.js +++ b/App/app/screens/Calendar.js @@ -1,397 +1,426 @@ -import * as React from 'react'; -import {View, StyleSheet, Dimensions, Image, ScrollView, Text, Button, TouchableOpacity, Animated} from 'react-native'; -import {TabView, TabBar, SceneMap} from 'react-native-tab-view'; +import * as React from "react"; import { - RkButton, RkCard, RkText, - RkTheme -} from 'react-native-ui-kitten'; -import Timeline from 'react-native-timeline-feed' + View, + StyleSheet, + Dimensions, + Image, + ScrollView, + Text, + Button, + TouchableOpacity, + Animated +} from "react-native"; +import { TabView, TabBar, SceneMap } from "react-native-tab-view"; +import { RkButton, RkCard, RkText, RkTheme } from "react-native-ui-kitten"; +import Timeline from "react-native-timeline-feed"; -import * as Progress from 'react-native-progress'; +import * as Progress from "react-native-progress"; +import { connect } from "react-redux"; -import {connect} from 'react-redux'; +import { bindActionCreators } from "redux"; +import PTRView from 'react-native-pull-to-refresh'; +import * as Actions from "../store/actions"; //Import your actionss -import {bindActionCreators} from 'redux'; +const formatObj = obj => { + let a = {}; -import * as Actions from '../store/actions'; //Import your actionss - - -const formatObj = (obj) => { - - let a = {}; - - a.push({}) - - return a + a.push({}); + return a; }; - -const ThirdRoute = () => ( - -); - - -const FourthRoute = () => ( - -); - - class Calendar extends React.Component { - - state = { - index: 0, - routes: [ - {key: 'first', weekDay: 'sex', day:12}, - {key: 'second', weekDay: 'sab',day:13}, - {key: 'third', weekDay: 'dom', day:14}, - {key: 'fourth', weekDay: 'seg', day:15}, + state = { + index: 0, + routes: [ + { key: "first", weekDay: "sex", day: 12 }, + { key: "second", weekDay: "sab", day: 13 }, + { key: "third", weekDay: "dom", day: 14 }, + { key: "fourth", weekDay: "seg", day: 15 } + ], + CP: "SEM", + cpColor: "white", + careerPath: { name: "", color: "" } + }; - ], - }; + componentDidMount() { + this.props.getEvents(this.props.user); - componentDidMount() { + this.props.getSessions(this.props.userDetails.token); + } - this.props.getEvents(this.props.user); - console.log('didMount'); - console.log(this.props.events); - } + _openDetails = () => { + console.log("los"); + }; - _openDetails=()=>{ - - console.log("los"); - } - - renderDetail = ({item, index}) => { - const {navigate} = this.props.navigation; - // - return ( - navigate('calendarDetail', { info: item })} > - - - - {item.name} - Local: 1 - - - - - - {item.description} - - - {item.Enrolled} / {item.MaxAttendees} - - - - - - - ); - } - - - - _update = () => { - this.setState({user: this.props.user}); - console.log(this.props.events); - } - - - _renderTabBar = props => { - const inputRange = props.navigationState.routes.map((x, i) => i); - - return ( - - {props.navigationState.routes.map((route, i) => { - const bgcolor = props.position.interpolate({ - inputRange, - outputRange: inputRange.map( - inputIndex => (inputIndex === i ? '#CC1A17' : 'rgba(0,0,0,0)') - ), - }); - const color = props.position.interpolate({ - inputRange, - outputRange: inputRange.map( - inputIndex => (inputIndex === i ? 'white' : 'black') - ), - }); - - - return ( - this.setState({ index: i })}> - - {route.weekDay} - {route.day} - - - ); - })} + renderDetail = ({ item, index }) => { + const { navigate } = this.props.navigation; + // + return ( + navigate("calendarDetail", { info: item })} + > + + + {item.name} + Local: 1 - ); - }; + + {item.description} + + + + {item.Enrolled} / {item.MaxAttendees} + + + + + + ); + }; - constructor() { + _update = () => { + this.setState({ user: this.props.user }); + console.log(this.props.events); + }; - super() + _renderTabBar = props => { + const inputRange = props.navigationState.routes.map((x, i) => i); - const archeryImgSource = require('../assets/img/archery.png'); - const badmintonImgSource = require('../assets/img/badminton.png'); - const lunchImgSource = require('../assets/img/lunch.png'); - const soccerImgSource = require('../assets/img/soccer.png'); - const dumbbellImgSource = require('../assets/img/dumbbell.png'); + return ( + + {props.navigationState.routes.map((route, i) => { + const bgcolor = props.position.interpolate({ + inputRange, + outputRange: inputRange.map(inputIndex => + inputIndex === i ? "#CC1A17" : "rgba(0,0,0,0)" + ) + }); + const color = props.position.interpolate({ + inputRange, + outputRange: inputRange.map(inputIndex => + inputIndex === i ? "white" : "black" + ) + }); - const ArcheryImage = (props) => ; - const BadmintonImage = (props) => ; - const LunchImage = (props) => ; - const SoccerImage = (props) => ; - const DumbbellImage = (props) => ; - const VectorIconImage = (props) => ; + return ( + this.setState({ index: i })} + > + + {route.weekDay} + + + {route.day} + + + ); + })} + + ); + }; - this.data = [ + constructor() { + super(); + } + _refresh=()=>{ + this.props.getEvents(this.props.user); + //this.props.getSessions(this.props.userDetails.token); + } + render() { + const ThirdRoute = () => ( + + {this.props.events != undefined && ( + index.toString()} + /> + )} + + ); + const FourthRoute = () => ( + + {this.props.events != undefined && ( + index.toString()} + /> + )} + + ); + const FirstRoute = () => ( + + {this.props.events != undefined && ( + index.toString()} + /> + )} + + ); + const SecondRoute = () => ( + + {this.props.events != undefined && ( + ( + height: 100, + color: "#CC1A17", + padding: 5, - + fontSize: 23 - index.toString()} + /> + )} + + ); - data={this.props.events} + return ( + + - timeContainerStyle={{ marginTop: 0}} - - timeStyle={{ - - textAlign: 'center', - // backgroundColor: 'red', - - height:100, - color:"#CC1A17", - padding: 5, - //marginTop:10, - // fontWeight:'bold', - fontSize:23, - - //borderRadius: 13 - }} - - descriptionStyle={{color: 'red'}} - - renderDetail={this.renderDetail} - - lineColor='rgba(0,0,0,0)' - lineWidth={1} - separator={false} - flatListProps={{ - style: { - - margin: 15 - } - - - }} - keyExtractor={(item, index) => index.toString()} - - - /> - - - - - ) - const SecondRoute = () => ( - - - - index.toString()} - - - /> - - - - - ) + + {this.props.careerPath != undefined && ( + + {this.props.careerPath.name} + + )} + + + this.setState({ index })} + initialLayout={{ + width: Dimensions.get("window").width, + height: Dimensions.get("window").height + }} + style={{ backgroundColor: "#F2F2F2" }} + indicatorStyle={{ backgroundColor: "pink" }} + /> +