@@ -2,42 +2,49 @@ import { withScriptjs, withGoogleMap, GoogleMap, TrafficLayer, Marker } from "re
22const { SearchBox } = require ( "react-google-maps/lib/components/places/SearchBox" ) ;
33import React , { Component , Children } from 'react' ;
44
5- const TrafficMapComponent = withScriptjs ( withGoogleMap ( ( props ) =>
6- < GoogleMap
7- defaultZoom = { props . defaultZoom }
8- onZoomChanged = { props . onZoomChanged }
9- onIdle = { props . onIdle }
10- defaultCenter = { props . defaultCenter }
11- center = { props . center }
12- ref = { props . onMapMounted } >
13- { props . showSearchBox && < SearchBox
14- ref = { props . onSearchBoxMounted }
15- bounds = { props . bounds }
16- controlPosition = { google . maps . ControlPosition . TOP_LEFT }
17- onPlacesChanged = { props . onPlacesChanged }
18- >
19- < input
20- type = "text"
21- placeholder = { props . searchBoxText }
22- style = { {
23- boxSizing : `border-box` ,
24- border : `1px solid transparent` ,
25- width : `240px` ,
26- height : `30px` ,
27- marginTop : `10px` ,
28- padding : `0 12px` ,
29- borderRadius : `3px` ,
30- boxShadow : `0 1px 6px rgba(0, 0, 0, 0.3)` ,
31- fontSize : `14px` ,
32- outline : `none` ,
33- textOverflow : `ellipses` ,
34- } }
35- />
36- </ SearchBox > }
37- { props . showTrafficLayer && < TrafficLayer autoUpdate /> }
38- { props . markers }
39- </ GoogleMap >
40- ) ) ;
5+ const TrafficMapComponent = withScriptjs ( withGoogleMap ( ( props ) => {
6+
7+ var inputBox =
8+ React . createElement ( "input" ,
9+ { type :"text" ,
10+ placeholder : props . searchBoxText ,
11+ style : {
12+ boxSizing : `border-box` ,
13+ border : `1px solid transparent` ,
14+ width : `240px` ,
15+ height : `30px` ,
16+ marginTop : `10px` ,
17+ padding : `0 12px` ,
18+ borderRadius : `3px` ,
19+ boxShadow : `0 1px 6px rgba(0, 0, 0, 0.3)` ,
20+ fontSize : `14px` ,
21+ outline : `none` ,
22+ textOverflow : `ellipses` }
23+ } ) ;
24+
25+ var searchBox =
26+ React . createElement ( SearchBox ,
27+ { ref : props . onSearchBoxMounted ,
28+ bounds : props . bounds ,
29+ controlPosition : google . maps . ControlPosition . TOP_LEFT ,
30+ onPlacesChanged : props . onPlacesChanged } ,
31+ inputBox
32+ ) ;
33+
34+ var traffic = React . createElement ( TrafficLayer , { } ) ;
35+ return (
36+ < GoogleMap
37+ defaultZoom = { props . defaultZoom }
38+ onZoomChanged = { props . onZoomChanged }
39+ onIdle = { props . onIdle }
40+ defaultCenter = { props . defaultCenter }
41+ center = { props . center }
42+ ref = { props . onMapMounted } >
43+ { props . showSearchBox && searchBox }
44+ { props . showTrafficLayer && traffic }
45+ { props . markers }
46+ </ GoogleMap > )
47+ } ) ) ;
4148
4249export class GoogleMapComponent extends React . PureComponent {
4350 refs = { }
0 commit comments