ENEI2019-Public/App/app/screens/calendarDetail.js

451 lines
11 KiB
JavaScript
Raw Normal View History

2019-02-22 23:38:34 +00:00
import * as React from 'react';
import {
2019-03-11 01:30:37 +00:00
View,
StyleSheet,
Dimensions,
Image,
ScrollView,
Text,
Button,
TouchableOpacity,
ImageBackground
} from 'react-native';
import {Divider, Icon, Avatar} from 'react-native-elements'
2019-02-22 23:38:34 +00:00
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';
2019-03-11 01:30:37 +00:00
import NavAbsolute from '../components/Nav';
2019-02-22 23:38:34 +00:00
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import * as Actions from '../store/actions'; //Import your actionss
import Swiper from 'react-native-swiper';
const SCREEN_HEIGHT = Dimensions.get("window").height;
const SCREEN_WIDTH = Dimensions.get("window").width;
2019-03-11 18:29:21 +00:00
2019-02-22 23:38:34 +00:00
import FitImage from 'react-native-fit-image';
2019-03-11 18:29:21 +00:00
2019-03-11 01:30:37 +00:00
import MapView, {PROVIDER_GOOGLE} from 'react-native-maps';
2019-02-22 23:38:34 +00:00
const formatObj = (obj) => {
let a = {};
a.push({})
return a
};
class calendarDetail extends React.Component {
2019-03-11 18:11:51 +00:00
2019-03-12 03:34:40 +00:00
2019-03-11 01:30:37 +00:00
static navigationOptions = ({navigation}) => ({
header: (
<NavAbsolute
navigation={navigation}
2019-03-12 03:34:40 +00:00
// title={navigation.state.params.info.name}
2019-03-11 01:30:37 +00:00
/>
),
});
2019-02-22 23:38:34 +00:00
2019-03-11 01:30:37 +00:00
state = {};
2019-02-22 23:38:34 +00:00
componentDidMount() {
this.props.getEvents(this.props.user);
console.log('didMount');
console.log(this.props.events);
2019-03-12 03:34:40 +00:00
const {navigation} = this.props;
const info = navigation.getParam('info', 'error');
console.log("putas")
console.log(info)
2019-02-22 23:38:34 +00:00
}
_update = () => {
this.setState({user: this.props.user});
console.log(this.props.events);
2019-03-11 01:30:37 +00:00
};
2019-02-22 23:38:34 +00:00
constructor(props) {
super(props)
2019-03-11 01:30:37 +00:00
this.data = []
}
2019-02-22 23:38:34 +00:00
2019-03-11 01:30:37 +00:00
renderHeader = (info) => {
return (
<View style={styles.headerContainer}>
<View style={styles.coverContainer}>
<ImageBackground
source={{
uri: info.imageUrl,
}}
style={styles.coverImage}
>
</ImageBackground>
</View>
</View>
)
};
2019-02-22 23:38:34 +00:00
2019-03-11 01:30:37 +00:00
renderDescription = (info) => {
return (
<View>
2019-03-12 03:34:40 +00:00
<View style={styles.header}>
2019-03-11 18:11:51 +00:00
<View style={{flexDirection: "row", alignItems: 'center', alignSelf:'center'}}>
2019-03-12 03:34:40 +00:00
2019-03-11 18:11:51 +00:00
<View style={styles.timeText}>
<Text style={{color: "#CC1A17", fontSize: 15}}>
{info.time === info.timeEnd ? info.time : `${info.time} - ${info.timeEnd}`}
</Text>
</View>
2019-03-11 01:30:37 +00:00
</View>
2019-03-12 03:34:40 +00:00
<View><Text style={{margin:10,marginTop:0, fontSize:20, color:'#CC1A17'}}>{info.name}</Text></View>
<View style={{margin:10}}>
2019-03-11 18:11:51 +00:00
<Progress.Bar color={'#000000'} progress={info.Enrolled / info.MaxAttendees} height={10}
unfilledColor={'white'} width={210}/>
2019-03-12 03:34:40 +00:00
<Text >{info.Enrolled} / {info.MaxAttendees}</Text>
</View>
<Divider style={{backgroundColor: '#000'}}/>
<View>
<Text style={{fontSize:15, color:'#CC1A17', padding:10}}>Descrição</Text>
<Text style={{paddingLeft:10, paddingRigh:10}}></Text>
2019-03-11 18:11:51 +00:00
</View>
2019-03-11 01:30:37 +00:00
</View>
2019-03-12 03:34:40 +00:00
<View style={styles.block}>
2019-03-11 18:11:51 +00:00
<Text style={{fontSize: 20, color: "#CC1A17"}}>Descrição</Text>
2019-03-11 01:30:37 +00:00
<Divider style={{backgroundColor: '#000'}}/>
<View style={{marginTop: 10}}>
2019-03-12 03:34:40 +00:00
<Text>
2019-03-11 01:30:37 +00:00
{info.description}
</Text>
</View>
</View>
</View>
)
};
2019-03-11 18:29:21 +00:00
/*
2019-02-22 23:38:34 +00:00
2019-03-11 01:30:37 +00:00
renderMap = () => {
return (
2019-03-11 18:11:51 +00:00
<MapView
provider={PROVIDER_GOOGLE}
style={{flex: 2}}
region={{
latitude: 40.19092111672049,
latitudeDelta: 0.007664297080957283,
longitude: -8.410662319511175,
longitudeDelta: 0.007551424205303192
}}
onRegionChangeComplete={(region) => {
console.log(region);
}}
/>
2019-03-11 01:30:37 +00:00
)
};
2019-03-11 18:29:21 +00:00
*/
2019-03-11 01:30:37 +00:00
renderAttendee = () => {
return (
<View style={{backgroundColor: '#fff', height: SCREEN_HEIGHT * 0.1}}>
<View style={styles.AttendeeContainer}>
<View style={styles.leftRow}>
<Avatar
rounded
size="medium"
source={{
uri: "https://cdn3.iconfinder.com/data/icons/vector-icons-6/96/256-512.png",
}}
/>
</View>
<View style={styles.centerRow}>
<Text style={styles.titleText} numberOfLines={1}>
Nome do gajo
</Text>
</View>
<View style={styles.rightRow}>
<Icon
size={24}
name="visibility"
type="material-icon"
onPress={() => navigation.goBack(null)}
color='#000'
iconStyle={styles.icon}
underlayColor="transparent"
underlineColorAndroid="transparent"
containerStyle={styles.iconContainer}
hitSlop={{top: 15, bottom: 15, left: 15, right: 15}}
/>
</View>
</View>
</View>
);
};
2019-02-22 23:38:34 +00:00
render() {
2019-03-11 01:30:37 +00:00
const {navigation} = this.props;
2019-02-22 23:38:34 +00:00
const info = navigation.getParam('info', 'error');
2019-03-12 03:34:40 +00:00
2019-03-11 01:30:37 +00:00
2019-02-22 23:38:34 +00:00
return (
2019-03-11 01:30:37 +00:00
<View style={styles.mainViewStyle}>
<ScrollView style={styles.scroll}>
<View style={styles.container}>
2019-03-11 18:11:51 +00:00
<View style={styles.headerContainer}>
2019-03-11 01:30:37 +00:00
{this.renderHeader(info)}
</View>
{this.renderDescription(info)}
</View>
2019-03-12 03:34:40 +00:00
<View style={styles.block}>
2019-03-11 18:11:51 +00:00
<Text style={{fontSize: 20, color: "#CC1A17"}}>Localização</Text>
2019-03-11 01:30:37 +00:00
<Divider style={{backgroundColor: '#000', marginBottom: 10}}/>
2019-03-12 03:34:40 +00:00
2019-03-11 01:30:37 +00:00
</View>
</ScrollView>
<Divider style={{backgroundColor: 'black'}}/>
2019-03-12 03:34:40 +00:00
2019-02-22 23:38:34 +00:00
</View>
2019-03-11 01:30:37 +00:00
2019-02-22 23:38:34 +00:00
)
}
2019-03-11 01:30:37 +00:00
2019-02-22 23:38:34 +00:00
}
const styles = StyleSheet.create({
2019-03-11 01:30:37 +00:00
2019-03-12 03:34:40 +00:00
block:{
marginTop:15,
backgroundColor:'white',
padding:20
},
2019-03-11 01:30:37 +00:00
AttendeeContainer: {
flexDirection: 'row',
height: 55,
justifyContent: 'center',
marginLeft: 10,
marginRight: 10,
2019-02-22 23:38:34 +00:00
},
2019-03-11 01:30:37 +00:00
centerRow: {
2019-03-11 18:11:51 +00:00
alignItems: 'center',
2019-03-11 01:30:37 +00:00
backgroundColor: 'transparent',
flex: 3,
flexDirection: 'column',
justifyContent: 'center',
},
leftRow: {
backgroundColor: 'transparent',
flex: 1,
flexDirection: 'row',
justifyContent: 'flex-start',
2019-03-11 18:11:51 +00:00
alignSelf: 'center',
2019-03-11 01:30:37 +00:00
},
rightRow: {
alignItems: 'flex-end',
backgroundColor: 'transparent',
flex: 2,
flexDirection: 'row',
justifyContent: 'flex-end',
marginRight: 4,
alignSelf: 'center'
2019-02-22 23:38:34 +00:00
},
2019-03-11 01:30:37 +00:00
icon: {
justifyContent: 'flex-start',
marginTop: 2.8,
},
nameAttendee: {
alignSelf: 'center',
fontSize: 20,
fontWeight: '400',
color: '#000',
marginBottom: 10,
},
details: {
marginTop: 20,
flex: 1,
alignSelf: 'center',
},
infoRow: {
margin: 25,
},
ramoText: {
alignSelf: 'flex-start',
marginBottom: 5,
2019-03-12 03:34:40 +00:00
color: 'white',
fontSize: 17,
2019-03-11 01:30:37 +00:00
fontWeight: '400',
},
timeText: {
alignItems: 'flex-end',
flex: 2,
2019-03-11 18:11:51 +00:00
lineHeight: 10,
2019-03-11 01:30:37 +00:00
marginRight: 4,
},
mainViewStyle: {
flex: 1,
flexGrow: 1,
flexDirection: 'column',
},
scroll: {
2019-03-11 18:11:51 +00:00
backgroundColor: '#eee',
2019-03-11 01:30:37 +00:00
flex: 1,
//marginBottom: 55,
},
2019-03-12 03:34:40 +00:00
header:{
flex: 1,
padding: 10,
backgroundColor: 'white',
borderRadius: 0,
},
2019-03-11 01:30:37 +00:00
cardContainer: {
flex: 1,
2019-03-11 18:11:51 +00:00
padding: 10,
2019-03-12 03:34:40 +00:00
// margin: 20,
2019-03-11 18:11:51 +00:00
backgroundColor: 'white',
borderRadius: 5,
2019-03-11 01:30:37 +00:00
},
2019-03-11 18:11:51 +00:00
headerContainer: {
flex: 1,
},
2019-03-11 01:30:37 +00:00
container: {
flex: 1,
flexDirection: 'column',
},
coverContainer: {
position: 'relative',
},
coverImage: {
height: Dimensions.get('window').width * (2 / 4),
width: Dimensions.get('window').width,
},
2019-03-11 18:11:51 +00:00
/*headerContainer: {
2019-03-11 01:30:37 +00:00
alignItems: 'center',
backgroundColor: '#FFF',
2019-03-11 18:11:51 +00:00
},*/
2019-03-11 01:30:37 +00:00
carreerPathContainer: {
backgroundColor: '#CC1A17',
height: 50,
flex: 1,
alignItems: 'center',
justifyContent: 'center',
paddingTop: 15,
2019-02-22 23:38:34 +00:00
},
2019-03-11 01:30:37 +00:00
carreerPathText: {
height: 50,
color: 'white',
fontWeight: 'bold',
fontSize: 20,
},
companyHeader: {
backgroundColor: '#dddddd',
// height:150,
borderRadius: 5,
margin: 10,
padding: 10
2019-02-22 23:38:34 +00:00
},
2019-03-11 01:30:37 +00:00
companyTitle: {
paddingBottom: 5,
fontWeight: 'bold',
color: '#777777',
fontSize: 17,
2019-02-22 23:38:34 +00:00
2019-03-11 01:30:37 +00:00
// padding:20
},
companyLogo: {
borderRadius: 20,
},
wrapper: {},
company: {
flex: 1,
flexDirection: 'row',
// backgroundColor:'red',
color: 'black'
},
companyLogoContainer: {
flex: 1,
2019-02-22 23:38:34 +00:00
justifyContent: 'center',
2019-03-11 01:30:37 +00:00
width: '60%',
// backgroundColor:'white',
margin: 20,
2019-02-22 23:38:34 +00:00
},
2019-03-11 01:30:37 +00:00
aboutCompany: {
width: SCREEN_WIDTH,
flex: 1,
2019-02-22 23:38:34 +00:00
justifyContent: 'center',
alignItems: 'center',
}
2019-03-11 01:30:37 +00:00
});
2019-02-22 23:38:34 +00:00
function mapStateToProps(state, props) {
return {
token: state.apiReducer.token,
user: state.apiReducer.user,
logged: state.apiReducer.logged,
2019-03-12 03:34:40 +00:00
events: state.apiReducer.events,
careerPath: state.apiReducer.careerPath,
2019-02-22 23:38:34 +00:00
}
}
function mapDispatchToProps(dispatch) {
return bindActionCreators(Actions, dispatch);
}
export default connect(mapStateToProps, mapDispatchToProps)(calendarDetail);