moment dependencia
This commit is contained in:
parent
094b5ee5bb
commit
338bee8192
188
App/app/App.js
188
App/app/App.js
|
@ -1,14 +1,13 @@
|
|||
|
||||
import React, {Component} from 'react';
|
||||
import {Platform, StyleSheet, Text, View, StatusBar,Dimensions,Image,ActivityIndicator} from 'react-native';
|
||||
import {Platform, StyleSheet, Text, View, StatusBar, Dimensions, Image, ActivityIndicator} from 'react-native';
|
||||
|
||||
import {bindActionCreators} from 'redux';
|
||||
import { connect } from 'react-redux';
|
||||
import {connect} from 'react-redux';
|
||||
|
||||
import QRCodeScanner from 'react-native-qrcode-scanner';
|
||||
import {UtilStyles} from './assets/styles'
|
||||
import * as Actions from './actions'; //Import your actions
|
||||
import {RkButton, RkTheme , RkText} from 'react-native-ui-kitten';
|
||||
import {RkButton, RkTheme, RkText} from 'react-native-ui-kitten';
|
||||
|
||||
import Router from './Router'
|
||||
|
||||
|
@ -16,140 +15,130 @@ const SCREEN_HEIGHT = Dimensions.get("window").height;
|
|||
const SCREEN_WIDTH = Dimensions.get("window").width;
|
||||
|
||||
|
||||
class App extends Component {
|
||||
class App extends Component {
|
||||
|
||||
constructor(props) {
|
||||
|
||||
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
|
||||
token:{valid:false},
|
||||
|
||||
token: {valid: false},
|
||||
tokenData: '',
|
||||
onHold: true,
|
||||
logged:false
|
||||
logged: false
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
|
||||
|
||||
//verifica se o utilizador tem token guardado
|
||||
this.props.checkUser();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
onSuccess = (e) => {
|
||||
|
||||
|
||||
this.props.login(e.data,'80f3b6e5');
|
||||
this.props.login(e.data, '80f3b6e5');
|
||||
console.log("tentativa de login");
|
||||
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
render() {
|
||||
|
||||
if(this.props.onHold && !this.props.logged){
|
||||
|
||||
|
||||
if (this.props.onHold && !this.props.logged) {
|
||||
|
||||
|
||||
return (
|
||||
|
||||
<View>
|
||||
<Text>CARREGANDO {this.props.onHold}</Text>
|
||||
<ActivityIndicator size="large" color="#0000ff" />
|
||||
<View style={UtilStyles.containerLoading}>
|
||||
<Text>CARREGANDO {this.props.onHold}</Text>
|
||||
<ActivityIndicator size="large" color="#0000ff"/>
|
||||
</View>
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
//console.log('token... '+ this.props.logged)
|
||||
|
||||
|
||||
//se existir token
|
||||
|
||||
|
||||
if(this.props.logged){
|
||||
|
||||
if (this.props.logged) {
|
||||
|
||||
return (
|
||||
|
||||
<Router></Router>
|
||||
|
||||
)
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
else {
|
||||
|
||||
//se não existir vai para o ecrã de scan QR
|
||||
return (
|
||||
|
||||
<QRCodeScanner
|
||||
|
||||
|
||||
showMarker
|
||||
reactivate={true}
|
||||
onRead={this.onSuccess.bind(this)}
|
||||
cameraStyle={{ height: SCREEN_HEIGHT }}
|
||||
|
||||
cameraStyle={{height: SCREEN_HEIGHT}}
|
||||
|
||||
customMarker={
|
||||
|
||||
<View style={styles.rectangleContainer}>
|
||||
<View style={styles.logo}>
|
||||
<Image style={UtilStyles.loginImage}
|
||||
source={require('./assets/img/logo.png')}
|
||||
/>
|
||||
</View>
|
||||
|
||||
|
||||
<View style={{ flexDirection: "row" }}>
|
||||
<View style={styles.leftAndRightOverlay}>
|
||||
<View style={styles.rectangleContainer}>
|
||||
<View style={styles.logo}>
|
||||
<Image style={UtilStyles.loginImage}
|
||||
source={require('./assets/img/logo.png')}
|
||||
/>
|
||||
</View>
|
||||
|
||||
|
||||
<View style={{flexDirection: "row"}}>
|
||||
<View style={styles.leftAndRightOverlay}>
|
||||
</View>
|
||||
|
||||
<View style={styles.rectangle}>
|
||||
|
||||
</View>
|
||||
|
||||
|
||||
<View style={styles.leftAndRightOverlay}>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View style={styles.bottomOverlay}>
|
||||
|
||||
<View style={{flex: 1, alignItems: 'center', alignContent: 'center'}}>
|
||||
|
||||
<RkText rkType='primary' style={styles.recover}>Recuperar pin de acesso</RkText>
|
||||
<RkButton rkType='dark' style={styles.manual}>lols</RkButton>
|
||||
</View>
|
||||
|
||||
</View>
|
||||
</View>
|
||||
}
|
||||
/>
|
||||
|
||||
<View style={styles.rectangle}>
|
||||
|
||||
</View>
|
||||
|
||||
|
||||
<View style={styles.leftAndRightOverlay}>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View style={styles.bottomOverlay}>
|
||||
|
||||
<View style={{flex:1, alignItems: 'center', alignContent: 'center'}}>
|
||||
|
||||
<RkText rkType='primary' style={styles.recover}>Recuperar pin de acesso</RkText>
|
||||
<RkButton rkType='dark' style={styles.manual}>lols</RkButton>
|
||||
</View>
|
||||
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
/>
|
||||
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
RkTheme.setType('RkButton', 'dark', {
|
||||
container: {
|
||||
paddingTop:10,
|
||||
backgroundColor: 'gray',
|
||||
|
||||
borderRadius: 90,
|
||||
paddingTop: 10,
|
||||
backgroundColor: 'gray',
|
||||
|
||||
borderRadius: 90,
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
const rectDimensions = SCREEN_WIDTH * 0.85; // this is equivalent to 255 from a 393 device width
|
||||
|
@ -157,35 +146,31 @@ const rectDimensions = SCREEN_WIDTH * 0.85; // this is equivalent to 255 from a
|
|||
const overlayColor = 'rgba(0,0,0,0.30)';
|
||||
|
||||
const styles = {
|
||||
|
||||
recover:{
|
||||
paddingTop:10,
|
||||
|
||||
recover: {
|
||||
paddingTop: 10,
|
||||
color: "red",
|
||||
paddingBottom:10
|
||||
paddingBottom: 10
|
||||
},
|
||||
manual:{
|
||||
|
||||
|
||||
manual: {},
|
||||
|
||||
},
|
||||
|
||||
logo:{
|
||||
logo: {
|
||||
|
||||
height:SCREEN_HEIGHT*0.35,
|
||||
width:SCREEN_WIDTH,
|
||||
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",
|
||||
|
@ -215,23 +200,20 @@ const styles = {
|
|||
},
|
||||
};
|
||||
|
||||
mapStateToProps = (state, props) => {
|
||||
|
||||
function mapStateToProps(state, props) {
|
||||
|
||||
return {
|
||||
|
||||
token: state.apiReducer.token,
|
||||
token: state.apiReducer.token,
|
||||
loggedIn: state.apiReducer.loggedIn,
|
||||
onHold: state.apiReducer.onHold,
|
||||
logged:state.apiReducer.logged
|
||||
|
||||
logged: state.apiReducer.logged
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function mapDispatchToProps(dispatch) {
|
||||
mapDispatchToProps = (dispatch) => {
|
||||
|
||||
return bindActionCreators(Actions, dispatch);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(App);
|
|
@ -13,6 +13,8 @@ import { AsyncStorage } from 'react-native';
|
|||
//Import the sample data
|
||||
import Data from '../intructions.json';
|
||||
import Login from '../screens/Login.js';
|
||||
|
||||
import moment from 'moment'
|
||||
|
||||
export function getData(){
|
||||
return (dispatch) => {
|
||||
|
@ -30,15 +32,15 @@ export function getData(){
|
|||
|
||||
export function getEvents(user){
|
||||
return (dispatch)=>{
|
||||
var o=[];
|
||||
let events = [];
|
||||
console.log("chegou aqui")
|
||||
|
||||
|
||||
for(var key in user.Sessions){
|
||||
|
||||
o.push({
|
||||
time:user.Sessions[key].SessionStart.substr(11, 14),
|
||||
timeEnd: user.Sessions[key].SessionEnd.substr(11, 14),
|
||||
for(let key in user.Sessions){
|
||||
|
||||
events.push({
|
||||
time: moment(user.Sessions[key].SessionStart).format('h:mm'),
|
||||
timeEnd: moment(user.Sessions[key].SessionEnd).format('h:mm'),
|
||||
lineColor:'#009688',
|
||||
imageUrl: 'https://d2v9y0dukr6mq2.cloudfront.net/video/thumbnail/Vjkyj2hBg/welcome-white-sign-with-falling-colorful-confetti-animation-on-white-background_sglmmh3qm__F0013.png',
|
||||
description:user.Sessions[key].Description,
|
||||
|
@ -51,8 +53,7 @@ export function getEvents(user){
|
|||
|
||||
dispatch({
|
||||
type: GET_EVENTS,
|
||||
events: o
|
||||
|
||||
events: events
|
||||
|
||||
});
|
||||
|
||||
|
@ -89,7 +90,6 @@ const saveToken = async token => {
|
|||
obj={}
|
||||
try {
|
||||
|
||||
|
||||
obj.access_token = await AsyncStorage.getItem('userToken') || 'none';
|
||||
obj.expirationDateToken = await AsyncStorage.getItem('expirationDateToken') || 'none';
|
||||
obj.refreshToken = await AsyncStorage.getItem('refreshToken') || 'none';
|
||||
|
|
|
@ -23,7 +23,7 @@ const apiReducer = (state = apiState, action) => {
|
|||
|
||||
case HOLD:
|
||||
|
||||
state=Object.assign({},state, {onHold:true});
|
||||
state=Object.assign({},state, { onHold:true });
|
||||
return state;
|
||||
|
||||
case API_LOGIN:
|
||||
|
|
|
@ -1,333 +1,330 @@
|
|||
import * as React from 'react';
|
||||
import { View, StyleSheet, Dimensions , Image, ScrollView,Text, Button} from 'react-native';
|
||||
import { TabView, TabBar, SceneMap } from 'react-native-tab-view';
|
||||
import {View, StyleSheet, Dimensions, Image, ScrollView, Text, Button} from 'react-native';
|
||||
import {TabView, TabBar, SceneMap} from 'react-native-tab-view';
|
||||
import {
|
||||
RkButton,RkCard, RkText,
|
||||
RkTheme
|
||||
RkButton, RkCard, RkText,
|
||||
RkTheme
|
||||
} from 'react-native-ui-kitten';
|
||||
import Timeline from 'react-native-timeline-feed'
|
||||
|
||||
import * as Progress from 'react-native-progress';
|
||||
|
||||
|
||||
import { connect } from 'react-redux';
|
||||
import {connect} from 'react-redux';
|
||||
|
||||
import {bindActionCreators} from 'redux';
|
||||
|
||||
import * as Actions from '../actions'; //Import your actionss
|
||||
|
||||
|
||||
const formatObj = (obj) => {
|
||||
|
||||
const formatObj= (obj)=>{
|
||||
|
||||
let a={};
|
||||
|
||||
a.push({
|
||||
let a = {};
|
||||
|
||||
a.push({})
|
||||
|
||||
})
|
||||
return a
|
||||
|
||||
return a
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const ThirdRoute = () => (
|
||||
<View style={[styles.scene, { backgroundColor: '#efc44a' }]} />
|
||||
<View style={[styles.scene, {backgroundColor: '#efc44a'}]}/>
|
||||
);
|
||||
|
||||
|
||||
const FourthRoute = () => (
|
||||
<View style={[styles.scene, { backgroundColor: '#49ef97' }]} />
|
||||
<View style={[styles.scene, {backgroundColor: '#49ef97'}]}/>
|
||||
);
|
||||
|
||||
|
||||
class Calendar extends React.Component {
|
||||
|
||||
state = {
|
||||
index: 0,
|
||||
routes: [
|
||||
{key: 'first', title: 'Sex 12'},
|
||||
{key: 'second', title: 'Sab 13'},
|
||||
{key: 'third', title: 'Dom 14'},
|
||||
{key: 'fourth', title: 'Seg 15'},
|
||||
|
||||
],
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
|
||||
this.props.getEvents(this.props.user);
|
||||
console.log('didMount');
|
||||
console.log(this.props.events);
|
||||
}
|
||||
|
||||
|
||||
class Calendar extends React.Component {
|
||||
|
||||
state = {
|
||||
index: 0,
|
||||
routes: [
|
||||
{ key: 'first', title: 'Sex 12' },
|
||||
{ key: 'second', title: 'Sab 13' },
|
||||
{ key: 'third', title: 'Dom 14' },
|
||||
{ key: 'fourth', title: 'Seg 15' },
|
||||
|
||||
],
|
||||
};
|
||||
|
||||
componentDidMount(){
|
||||
|
||||
this.props.getEvents(this.props.user);
|
||||
console.log('didMount');
|
||||
console.log(this.props.events);
|
||||
}
|
||||
renderDetail = ({item, index}) => {
|
||||
// <Image source={{ uri:item.imageUrl, width:'100%' , height:100 }} style={{borderRadius:0}}/>
|
||||
return (
|
||||
|
||||
|
||||
<View style={styles.event}>
|
||||
<Text style={[styles.title]}>{item.name}</Text>
|
||||
<View>
|
||||
|
||||
renderDetail = ({ item, index })=> {
|
||||
// <Image source={{ uri:item.imageUrl, width:'100%' , height:100 }} style={{borderRadius:0}}/>
|
||||
return (
|
||||
|
||||
|
||||
<View style={styles.event}>
|
||||
<Text style={[styles.title]}>{item.name}</Text>
|
||||
<View>
|
||||
<Text style={styles.description}>{item.description}</Text>
|
||||
<View style={styles.details}>
|
||||
<Progress.Bar color={'#42a5f5'} progress={0.3} unfilledColor={'white'} width={210}/>
|
||||
<Text>{item.Enrolled} / {item.MaxAttendees}</Text>
|
||||
</View>
|
||||
|
||||
|
||||
<Text style={styles.description}>{item.description}</Text>
|
||||
<View style={styles.details}>
|
||||
<Progress.Bar color={'#42a5f5'} progress={0.3} unfilledColor = {'white'}width={210} />
|
||||
<Text>{item.Enrolled} / {item.MaxAttendees}</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
renderEvents = ({ item, index })=> {
|
||||
renderEvents = ({item, index}) => {
|
||||
|
||||
return (
|
||||
<View style={styles.event}>
|
||||
<Text style={[styles.title]}>{item.title}</Text>
|
||||
<View>
|
||||
return (
|
||||
<View style={styles.event}>
|
||||
<Text style={[styles.title]}>{item.title}</Text>
|
||||
<View>
|
||||
|
||||
<Image source={{ uri:item.imageUrl, width:'100%' , height:100 }} style={{borderRadius:0}}/>
|
||||
<Image source={{uri: item.imageUrl, width: '100%', height: 100}} style={{borderRadius: 0}}/>
|
||||
|
||||
|
||||
|
||||
<Text style={styles.description}>{item.description}</Text>
|
||||
<View style={styles.details}>
|
||||
<Progress.Bar color={'#42a5f5'} progress={0.3} unfilledColor = {'white'}width={210} />
|
||||
<Text>1/50</Text>
|
||||
<Text style={styles.description}>{item.description}</Text>
|
||||
<View style={styles.details}>
|
||||
<Progress.Bar color={'#42a5f5'} progress={0.3} unfilledColor={'white'} width={210}/>
|
||||
<Text>1/50</Text>
|
||||
</View>
|
||||
|
||||
</View>
|
||||
</View>
|
||||
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
_update=()=>{
|
||||
this.setState({ user: this.props.user });
|
||||
console.log(this.props.events);
|
||||
}
|
||||
_update = () => {
|
||||
this.setState({user: this.props.user});
|
||||
console.log(this.props.events);
|
||||
}
|
||||
|
||||
|
||||
constructor() {
|
||||
|
||||
constructor(){
|
||||
|
||||
super()
|
||||
|
||||
|
||||
|
||||
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');
|
||||
|
||||
const ArcheryImage = (props) => <Image source={archeryImgSource} {...props} />;
|
||||
const BadmintonImage = (props) => <Image source={badmintonImgSource} {...props} />;
|
||||
const LunchImage = (props) => <Image source={lunchImgSource} {...props} />;
|
||||
const SoccerImage = (props) => <Image source={soccerImgSource} {...props} />;
|
||||
const DumbbellImage = (props) => <Image source={dumbbellImgSource} {...props} />;
|
||||
const VectorIconImage = (props) => <Image source={vectorIconImgSource} {...props} />;
|
||||
|
||||
this.data = [
|
||||
super()
|
||||
|
||||
|
||||
{
|
||||
time: '09:30',
|
||||
title: 'Sessão de Check-In',
|
||||
description: 'Os participantes devem fazer o check-in e recolher o kit fornecido pela organização',
|
||||
lineColor:'#009688',
|
||||
icon: ArcheryImage,
|
||||
imageUrl: 'https://blogsimages.adobe.com/conversations/files/2014/03/Check_In-1.jpg'
|
||||
},
|
||||
{
|
||||
time: '17:45',
|
||||
title: 'Sessão de Abertura',
|
||||
lineColor:'#009688',
|
||||
description: 'Bem vindo a Coimbra, a cidade dos estudantes! Obrigado por participares na 13ª edição do ENEI.',
|
||||
icon: BadmintonImage,
|
||||
imageUrl: 'https://d2v9y0dukr6mq2.cloudfront.net/video/thumbnail/Vjkyj2hBg/welcome-white-sign-with-falling-colorful-confetti-animation-on-white-background_sglmmh3qm__F0013.png'
|
||||
},
|
||||
{
|
||||
time: '19:30',
|
||||
title: 'Jantar',
|
||||
lineColor:'#009688',
|
||||
description: 'Time to eat',
|
||||
icon: BadmintonImage,
|
||||
imageUrl: 'https://www.retailmenot.com/blog/wp-content/uploads/2016/08/kids-eat-free-hero1-1471459190.jpg'
|
||||
},
|
||||
|
||||
{
|
||||
time: '23:30',
|
||||
title: 'Festarola',
|
||||
lineColor:'#009688',
|
||||
description: 'Sabes beber? Se não sabes, aprende com os da casa!',
|
||||
icon: BadmintonImage,
|
||||
imageUrl: 'http://www.revistaversatille.com.br/wp-content/uploads/Party.jpg'
|
||||
},
|
||||
|
||||
|
||||
]
|
||||
}
|
||||
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');
|
||||
|
||||
render() {
|
||||
|
||||
const FirstRoute = () => (
|
||||
|
||||
const ArcheryImage = (props) => <Image source={archeryImgSource} {...props} />;
|
||||
const BadmintonImage = (props) => <Image source={badmintonImgSource} {...props} />;
|
||||
const LunchImage = (props) => <Image source={lunchImgSource} {...props} />;
|
||||
const SoccerImage = (props) => <Image source={soccerImgSource} {...props} />;
|
||||
const DumbbellImage = (props) => <Image source={dumbbellImgSource} {...props} />;
|
||||
const VectorIconImage = (props) => <Image source={vectorIconImgSource} {...props} />;
|
||||
|
||||
<ScrollView contentContainerStyle={styles.contentContainer} >
|
||||
|
||||
|
||||
<Button onPress={this._update} title="LOGOUT"/>
|
||||
<Timeline
|
||||
|
||||
|
||||
|
||||
data={this.props.events}
|
||||
|
||||
timeContainerStyle={{minWidth:52, marginTop: 5}}
|
||||
timeStyle={{textAlign: 'center', backgroundColor:'#ff9797', color:'white', padding:5, borderRadius:13}}
|
||||
descriptionStyle={{color:'gray'}}
|
||||
|
||||
renderDetail={this.renderDetail}
|
||||
|
||||
|
||||
flatListProps={{
|
||||
style:{
|
||||
|
||||
margin:15
|
||||
}
|
||||
this.data = [
|
||||
|
||||
|
||||
}}
|
||||
keyExtractor={(item, index) => index.toString()}
|
||||
|
||||
|
||||
{
|
||||
time: '09:30',
|
||||
title: 'Sessão de Check-In',
|
||||
description: 'Os participantes devem fazer o check-in e recolher o kit fornecido pela organização',
|
||||
lineColor: '#009688',
|
||||
icon: ArcheryImage,
|
||||
imageUrl: 'https://blogsimages.adobe.com/conversations/files/2014/03/Check_In-1.jpg'
|
||||
},
|
||||
{
|
||||
time: '17:45',
|
||||
title: 'Sessão de Abertura',
|
||||
lineColor: '#009688',
|
||||
description: 'Bem vindo a Coimbra, a cidade dos estudantes! Obrigado por participares na 13ª edição do ENEI.',
|
||||
icon: BadmintonImage,
|
||||
imageUrl: 'https://d2v9y0dukr6mq2.cloudfront.net/video/thumbnail/Vjkyj2hBg/welcome-white-sign-with-falling-colorful-confetti-animation-on-white-background_sglmmh3qm__F0013.png'
|
||||
},
|
||||
{
|
||||
time: '19:30',
|
||||
title: 'Jantar',
|
||||
lineColor: '#009688',
|
||||
description: 'Time to eat',
|
||||
icon: BadmintonImage,
|
||||
imageUrl: 'https://www.retailmenot.com/blog/wp-content/uploads/2016/08/kids-eat-free-hero1-1471459190.jpg'
|
||||
},
|
||||
|
||||
{
|
||||
time: '23:30',
|
||||
title: 'Festarola',
|
||||
lineColor: '#009688',
|
||||
description: 'Sabes beber? Se não sabes, aprende com os da casa!',
|
||||
icon: BadmintonImage,
|
||||
imageUrl: 'http://www.revistaversatille.com.br/wp-content/uploads/Party.jpg'
|
||||
},
|
||||
|
||||
|
||||
]
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
const FirstRoute = () => (
|
||||
|
||||
|
||||
<ScrollView contentContainerStyle={styles.contentContainer}>
|
||||
|
||||
|
||||
<Button onPress={this._update} title="LOGOUT"/>
|
||||
<Timeline
|
||||
|
||||
data={this.props.events}
|
||||
|
||||
timeContainerStyle={{minWidth: 52, marginTop: 5}}
|
||||
timeStyle={{
|
||||
textAlign: 'center',
|
||||
backgroundColor: '#ff9797',
|
||||
color: 'white',
|
||||
padding: 5,
|
||||
borderRadius: 13
|
||||
}}
|
||||
descriptionStyle={{color: 'gray'}}
|
||||
|
||||
renderDetail={this.renderDetail}
|
||||
|
||||
|
||||
flatListProps={{
|
||||
style: {
|
||||
|
||||
margin: 15
|
||||
}
|
||||
|
||||
|
||||
}}
|
||||
keyExtractor={(item, index) => index.toString()}
|
||||
|
||||
|
||||
/>
|
||||
|
||||
|
||||
</ScrollView>
|
||||
|
||||
)
|
||||
|
||||
const SecondRoute = () => (
|
||||
|
||||
|
||||
<ScrollView contentContainerStyle={styles.contentContainer}>
|
||||
|
||||
<Timeline
|
||||
|
||||
|
||||
data={this.props.events}
|
||||
|
||||
timeContainerStyle={{minWidth: 52, marginTop: 5}}
|
||||
timeStyle={{
|
||||
textAlign: 'center',
|
||||
backgroundColor: '#ff9797',
|
||||
color: 'white',
|
||||
padding: 5,
|
||||
borderRadius: 13
|
||||
}}
|
||||
descriptionStyle={{color: 'gray'}}
|
||||
|
||||
renderDetail={this.renderDetail}
|
||||
|
||||
|
||||
flatListProps={{
|
||||
style: {
|
||||
|
||||
margin: 15
|
||||
}
|
||||
|
||||
|
||||
}}
|
||||
keyExtractor={(item, index) => index.toString()}
|
||||
|
||||
|
||||
/>
|
||||
|
||||
|
||||
</ScrollView>
|
||||
|
||||
)
|
||||
return (
|
||||
|
||||
<TabView
|
||||
navigationState={this.state}
|
||||
renderScene={SceneMap({
|
||||
first: FirstRoute,
|
||||
second: SecondRoute,
|
||||
third: ThirdRoute,
|
||||
fourth: FourthRoute
|
||||
})}
|
||||
onIndexChange={index => this.setState({index})}
|
||||
initialLayout={{width: Dimensions.get('window').width, height: Dimensions.get('window').height}}
|
||||
/>
|
||||
|
||||
|
||||
</ScrollView>
|
||||
|
||||
)
|
||||
const SecondRoute = () => (
|
||||
|
||||
|
||||
<ScrollView contentContainerStyle={styles.contentContainer} >
|
||||
|
||||
|
||||
<Timeline
|
||||
|
||||
|
||||
|
||||
data={this.props.events}
|
||||
|
||||
timeContainerStyle={{minWidth:52, marginTop: 5}}
|
||||
timeStyle={{textAlign: 'center', backgroundColor:'#ff9797', color:'white', padding:5, borderRadius:13}}
|
||||
descriptionStyle={{color:'gray'}}
|
||||
|
||||
renderDetail={this.renderDetail}
|
||||
|
||||
|
||||
flatListProps={{
|
||||
style:{
|
||||
|
||||
margin:15
|
||||
}
|
||||
|
||||
|
||||
}}
|
||||
keyExtractor={(item, index) => index.toString()}
|
||||
|
||||
|
||||
/>
|
||||
|
||||
|
||||
</ScrollView>
|
||||
|
||||
)
|
||||
return (
|
||||
|
||||
|
||||
<TabView
|
||||
navigationState={this.state}
|
||||
renderScene={SceneMap({
|
||||
first: FirstRoute,
|
||||
second: SecondRoute,
|
||||
third: ThirdRoute,
|
||||
fourth: FourthRoute
|
||||
})}
|
||||
onIndexChange={index => this.setState({ index })}
|
||||
initialLayout={{ width: Dimensions.get('window').width,height: Dimensions.get('window').height}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
details:{
|
||||
backgroundColor:"#e0e0e0",
|
||||
borderBottomRightRadius:10,
|
||||
borderBottomLeftRadius:10,
|
||||
padding:10
|
||||
},
|
||||
description:{
|
||||
padding:10
|
||||
},
|
||||
title:{
|
||||
color:'#212121',
|
||||
fontWeight: 'bold',
|
||||
fontSize:15,
|
||||
padding:10
|
||||
},
|
||||
event:{
|
||||
borderRadius:10,
|
||||
backgroundColor:'#eeeeee',
|
||||
|
||||
},
|
||||
scene: {
|
||||
flex: 1,
|
||||
},
|
||||
contentContainer: {
|
||||
paddingVertical: 20
|
||||
}
|
||||
});RkTheme.setType('RkCard', 'story', {
|
||||
img: {
|
||||
height: 100,
|
||||
opacity: 0.7
|
||||
},
|
||||
header: {
|
||||
alignSelf: 'center'
|
||||
},
|
||||
content:{
|
||||
alignSelf:'center'
|
||||
}
|
||||
details: {
|
||||
backgroundColor: "#e0e0e0",
|
||||
borderBottomRightRadius: 10,
|
||||
borderBottomLeftRadius: 10,
|
||||
padding: 10
|
||||
},
|
||||
description: {
|
||||
padding: 10
|
||||
},
|
||||
title: {
|
||||
color: '#212121',
|
||||
fontWeight: 'bold',
|
||||
fontSize: 15,
|
||||
padding: 10
|
||||
},
|
||||
event: {
|
||||
borderRadius: 10,
|
||||
backgroundColor: '#eeeeee',
|
||||
|
||||
},
|
||||
scene: {
|
||||
flex: 1,
|
||||
},
|
||||
contentContainer: {
|
||||
paddingVertical: 20
|
||||
}
|
||||
});
|
||||
RkTheme.setType('RkCard', 'story', {
|
||||
img: {
|
||||
height: 100,
|
||||
opacity: 0.7
|
||||
},
|
||||
header: {
|
||||
alignSelf: 'center'
|
||||
},
|
||||
content: {
|
||||
alignSelf: 'center'
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
function mapStateToProps(state, props) {
|
||||
|
||||
return {
|
||||
|
||||
token: state.apiReducer.token,
|
||||
user: state.apiReducer.user,
|
||||
logged: state.apiReducer.logged,
|
||||
events: state.apiReducer.events
|
||||
|
||||
}
|
||||
return {
|
||||
|
||||
token: state.apiReducer.token,
|
||||
user: state.apiReducer.user,
|
||||
logged: state.apiReducer.logged,
|
||||
events: state.apiReducer.events
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function mapDispatchToProps(dispatch) {
|
||||
|
||||
return bindActionCreators(Actions, dispatch);
|
||||
return bindActionCreators(Actions, dispatch);
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(Calendar);
|
|
@ -1,6 +1,6 @@
|
|||
import React, {Component} from 'react';
|
||||
|
||||
import { Button, View, Text , TouchableOpacity, FlatList, ActivityIndicator} from 'react-native';
|
||||
import {Button, View, Text, TouchableOpacity, FlatList, ActivityIndicator} from 'react-native';
|
||||
|
||||
|
||||
import {
|
||||
|
@ -9,7 +9,7 @@ import {
|
|||
} from 'react-native-ui-kitten';
|
||||
|
||||
|
||||
import { connect } from 'react-redux';
|
||||
import {connect} from 'react-redux';
|
||||
|
||||
import {bindActionCreators} from 'redux';
|
||||
|
||||
|
@ -30,10 +30,10 @@ class Home extends Component {
|
|||
|
||||
this.state = {
|
||||
|
||||
token:{valid:false},
|
||||
logged:true,
|
||||
onHold:true,
|
||||
user:{Name:''}
|
||||
token: {valid: false},
|
||||
logged: true,
|
||||
onHold: true,
|
||||
user: {Name: ''}
|
||||
};
|
||||
|
||||
|
||||
|
@ -46,89 +46,89 @@ class Home extends Component {
|
|||
//this.props.logoutUser();
|
||||
|
||||
//console.log(this.props.token);
|
||||
|
||||
|
||||
this.props.getUserInfo(this.props.token);
|
||||
|
||||
|
||||
|
||||
//console.log('logged:'+this.props.logged);
|
||||
|
||||
//console.log(th2is.props)
|
||||
|
||||
console.log(this.props.user)
|
||||
|
||||
|
||||
}
|
||||
|
||||
bClick() {
|
||||
|
||||
//this.props.logoutUser();
|
||||
|
||||
let a={};
|
||||
// this.setState({ user: this.props.user });
|
||||
// console.log(this.props.user)
|
||||
//
|
||||
|
||||
let a = {};
|
||||
// this.setState({ user: this.props.user });
|
||||
// console.log(this.props.user)
|
||||
//
|
||||
|
||||
|
||||
//var navigate = this.props.navigation.navigate
|
||||
}
|
||||
|
||||
_logout = () => {
|
||||
|
||||
|
||||
// this.props.navigation.navigate('scan');
|
||||
|
||||
// this.props.logout();
|
||||
|
||||
// this.props.navigation.navigate('scan');
|
||||
|
||||
// this.props.logout();
|
||||
this.props.logoutUser();
|
||||
}
|
||||
update=()=>{
|
||||
}
|
||||
update = () => {
|
||||
|
||||
|
||||
this.setState({ user: this.props.user });
|
||||
var o=[];
|
||||
this.setState({user: this.props.user});
|
||||
var o = [];
|
||||
|
||||
for (var key in this.props.user.Sessions) {
|
||||
|
||||
|
||||
for(var key in this.props.user.Sessions){
|
||||
|
||||
|
||||
o.push({
|
||||
time:this.props.user.Sessions[key].SessionStart.substr(11, 16),
|
||||
time: this.props.user.Sessions[key].SessionStart.substr(11, 16),
|
||||
timeEnd: this.props.user.Sessions[key].SessionEnd.substr(11, 16),
|
||||
lineColor:'#009688',
|
||||
lineColor: '#009688',
|
||||
imageUrl: 'https://d2v9y0dukr6mq2.cloudfront.net/video/thumbnail/Vjkyj2hBg/welcome-white-sign-with-falling-colorful-confetti-animation-on-white-background_sglmmh3qm__F0013.png',
|
||||
description:this.props.user.Sessions[key].Description,
|
||||
name:this.props.user.Sessions[key].Name,
|
||||
|
||||
description: this.props.user.Sessions[key].Description,
|
||||
name: this.props.user.Sessions[key].Name,
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
console.log(this.props.user.Sessions);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
|
||||
|
||||
const { navigate } = this.props.navigation;
|
||||
|
||||
|
||||
if(this.props.onHold){
|
||||
|
||||
const {navigate} = this.props.navigation;
|
||||
|
||||
|
||||
if (this.props.onHold) {
|
||||
|
||||
return (
|
||||
<View>
|
||||
<Text>lollsss {this.props.onHold}</Text>
|
||||
<ActivityIndicator size="large" color="#0000ff" />
|
||||
<ActivityIndicator size="large" color="#0000ff"/>
|
||||
</View>
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
if(this.props.logged){
|
||||
if (this.props.logged) {
|
||||
|
||||
return (
|
||||
<View>
|
||||
|
||||
<Button onPress={this._logout} title="LOGOUT"/>
|
||||
<Button onPress={this.update} title="update"/>
|
||||
<Button onPress={this.bClick} title="Parse"/>
|
||||
<Text> Nomess: {this.props.user.Name}</Text>
|
||||
|
||||
|
||||
<Button onPress={this._logout} title="LOGOUT"/>
|
||||
<Button onPress={this.update} title="update"/>
|
||||
<Button onPress={this.bClick} title="Parse"/>
|
||||
<Text> Nomess: {this.props.user.Name}</Text>
|
||||
|
||||
<Text> city: {this.props.user.City}</Text>
|
||||
<Text> phone: {this.props.user.Mobile}</Text>
|
||||
|
||||
|
@ -171,7 +171,7 @@ function mapStateToProps(state, props) {
|
|||
|
||||
token: state.apiReducer.token,
|
||||
user: state.apiReducer.user,
|
||||
logged: state.apiReducer.logged
|
||||
logged: state.apiReducer.logged
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6076,6 +6076,11 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"moment": {
|
||||
"version": "2.24.0",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz",
|
||||
"integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg=="
|
||||
},
|
||||
"morgan": {
|
||||
"version": "1.9.1",
|
||||
"resolved": "https://registry.npmjs.org/morgan/-/morgan-1.9.1.tgz",
|
||||
|
|
|
@ -8,8 +8,9 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.18.0",
|
||||
"prop-types": "^15.6.2",
|
||||
"material-icons-react": "^1.0.4",
|
||||
"moment": "^2.24.0",
|
||||
"prop-types": "^15.6.2",
|
||||
"react": "16.6.3",
|
||||
"react-native": "0.57.8",
|
||||
"react-native-app-intro-slider": "^1.0.1",
|
||||
|
|
Loading…
Reference in New Issue