Skip to content

Instantly share code, notes, and snippets.

@bogoslavskiy
Created December 9, 2018 17:17
Show Gist options
  • Save bogoslavskiy/08813efb5076eeee85ec379fcb152b31 to your computer and use it in GitHub Desktop.
Save bogoslavskiy/08813efb5076eeee85ec379fcb152b31 to your computer and use it in GitHub Desktop.
import React from 'react';
import { StyleSheet, View } from 'react-native';
import { MapView, Marker } from 'expo';
import { Viewport } from '../utils';
import MyLocationMapMarker from '../components/Maps/MyLocationMapMarker';
/*
Array [
Object {
"_id": "5bb39d0da06ff5a154122136",
"address": "Edinburgh, UK",
"phones": Array [],
"point": Array [
55.953252,
-3.188266999999999,
],
"time": Array [],
"type_time": 3,
},
]
*/
const PLACES_CONTAINER_HEIGHT = 350;
export default class CompanyPlacesScreen extends React.PureComponent {
static navigationOptions = {
title: 'All address',
};
state = {
selectedPlace: false,
};
onRegionChange = () => {
//console.log();
};
render() {
let { getParam } = this.props.navigation;
let places = getParam('places');
return (
<View style={{flex: 1}}>
<MapView
//region={this.state.region}
//onRegionChange={this.onRegionChange}
style={styles.map}
initialRegion={{
latitude: places[0].point[0],
longitude: places[0].point[1],
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
}}
>
{places.map((marker, index) => (
<MapView.Marker
key={index}
coordinate={{
latitude: marker.point[0],
longitude: marker.point[1],
}}
title={'asd'}
description={'asas'}
/>
))}
</MapView>
<View style={styles.placesContainer}>
</View>
</View>
);
}
}
const styles = StyleSheet.create({
map: {
width: Viewport.width,
height: Viewport.height - PLACES_CONTAINER_HEIGHT
},
placesContainer: {
width: Viewport.width,
height: PLACES_CONTAINER_HEIGHT,
backgroundColor: '#fff',
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment