import React from 'react' import { StyleSheet, Text, TextInput, FlatList, Image, View } from 'react-native' import MapView, { Marker } from 'react-native-maps' import { api } from '../API' import centerImage from './images/center.png' import settingsImage from './images/settings.png' import searchImage from './images/search.png' import cancelImage from './images/cancel.png' export class Home extends React.Component { static navigatorButtons = { rightButtons: [ { icon: require('./images/ar-glases.png'), id: 'arview', } ], leftButtons: [ { icon: require('./images/logout.png'), id: 'logout', } ] } static styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#fff', alignItems: 'flex-start', justifyContent: 'flex-start', } }) static data = [ {key: '1', title: 'Remove Animal Carcass', location: 'Ossington Ave. | 0.2 mi.', state: 'planned', latlng: { latitude: 43.653226, longitude: -79.383184 } }, {key: '2', title: 'Fix sign post', location: 'Alexandre St. | 0.7 mi.', state: 'open', latlng: { latitude: 43.648118, longitude: 79.392636 }}, {key: '3', title: 'Overflowing trash', location: 'Bay St. | 0.8 mi.', state: 'open', latlng: { latitude: 43.640168, longitude: -79.409373 }}, {key: '4', title: 'Leaking water pipe', location: 'Bloor St. | 1.2 mi.', state: 'planned', latlng: { latitude: 43.633110, longitude: -79.415880 }}, {key: '5', title: 'Tree branch in road', location: 'Blue Jays Way | 2.2 mi.', state: 'open', latlng: { latitude: 43.653526, longitude: -79.361385 }}, {key: '6', title: 'Washing machine on sidewalk', location: 'Christie St. | 3.0 mi.', state: 'open', latlng: { latitude: 43.663870, longitude: -79.383705 }}, {key: '7', title: 'Dead moose', location: 'Cummer Ave. | 4.2 mi.', state: 'open', latlng: { latitude: 43.659166, longitude: -79.391350 }}, {key: '8', title: 'Glass in street', location: 'Danforth Ave. | 4.7 mi.', state: 'open', latlng: { latitude: 43.663538, longitude: -79.423212 }}, ] constructor(props) { super(props); this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this)) } onNavigatorEvent(event) { switch (event.id) { case 'logout': api.logout().then(() => { this.props.navigator.showModal({ screen: 'app.Login' }) }) case 'willAppear': break case 'didAppear': if (!api.loggedInUser) { this.props.navigator.showModal({ screen: 'app.Login' }) } break; case 'willDisappear': break case 'didDisappear': break case 'willCommitPreview': break } } render() { return ( { Home.data.map(marker => ( )) } { return ( {item.state.toUpperCase()} {item.title} {item.location} ) }} /> Hide List ); } }