Commit 80dcd3f8 authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Add location image and fix problem when max participants is null

parent 18d5e970
import React from 'react';
import { ScrollView, Text, View } from 'react-native';
import {Image, ScrollView, Text, View} from 'react-native';
import { connect } from 'react-redux';
import Moment from 'moment';
import 'moment/locale/nl';
......@@ -32,7 +32,11 @@ const Event = (props) => {
text += `Aanmelddeadline: ${registrationDeadline}\n`;
text += `Afmelddeadline: ${cancelDeadline}\n`;
text += `Aantal aanmeldingen: ${data.num_participants} aanmeldingen (${data.max_participants} max)\n`;
text += `Aantal aanmeldingen: ${data.num_participants} aanmeldingen`;
if (data.max_participants) {
text += ` (${data.max_participants} max)`;
}
text += '\n';
if (data.user_registration) {
let registrationState;
......@@ -123,6 +127,7 @@ const Event = (props) => {
return (
<ScrollView contentContainerStyle={styles.eventView}>
<Image style={styles.locationImage} source={{ uri: `https://maps.googleapis.com/maps/api/staticmap?center=${props.data.map_location}&zoom=13&size=450x250&markers=${props.data.map_location}` }} />
<Text style={styles.titleText}>{props.data.title}</Text>
<Text style={styles.infoText}>
{eventDesc(props.data)}
......@@ -149,6 +154,7 @@ Event.propTypes = {
end: React.PropTypes.string.isRequired,
organiser: React.PropTypes.number.isRequired,
location: React.PropTypes.string.isRequired,
map_location: React.PropTypes.string.isRequired,
status: React.PropTypes.number.isRequired,
registration_allowed: React.PropTypes.bool.isRequired,
has_fields: React.PropTypes.bool.isRequired,
......
......@@ -4,6 +4,13 @@ const styles = create({
eventView: {
padding: 16,
},
locationImage: {
height: 150,
marginLeft: -16,
marginRight: -16,
marginTop: -16,
marginBottom: 16,
},
titleText: {
marginBottom: 16,
fontFamily: 'sans-serif-medium',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment