1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
import React from 'react';
import { compose, withProps } from 'recompose';
import {
withScriptjs,
withGoogleMap,
GoogleMap,
TrafficLayer,
} from 'react-google-maps';
const MapWithATrafficLayer = compose(
withProps({
googleMapURL: 'https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=geometry,drawing,places',
loadingElement: <div style={{ height: '100%' }} />,
containerElement: <div style={{ height: '400px' }} />,
mapElement: <div style={{ height: '100%' }} />,
}),
withScriptjs,
withGoogleMap
)(props => (
<GoogleMap
{...props}
defaultZoom={8}
defaultCenter={{ lat: 41.9, lng: -87.624 }}
>
<TrafficLayer autoUpdate />
</GoogleMap>
));
class Traffic extends React.Component {
render() {
return (
<MapWithATrafficLayer />
);
}
}
export default Traffic;
|