Skip to content

Commit a262264

Browse files
committed
Get rid of JSX
1 parent bf894d3 commit a262264

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

src/Fable.ReactGoogleMaps/js/mapComponent.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { withScriptjs, withGoogleMap, GoogleMap, TrafficLayer, Marker } from "react-google-maps";
1+
import { withScriptjs, withGoogleMap, GoogleMap, TrafficLayer } from "react-google-maps";
22
const { SearchBox } = require("react-google-maps/lib/components/places/SearchBox");
3-
import React, {Component, Children} from 'react';
3+
import React from 'react';
44

55
const TrafficMapComponent = withScriptjs(withGoogleMap((props) => {
66

@@ -32,18 +32,20 @@ const TrafficMapComponent = withScriptjs(withGoogleMap((props) => {
3232
);
3333

3434
var traffic = React.createElement(TrafficLayer, { });
35+
var childs = [props.markers ];
36+
if(props.showSearchBox) { childs = [ searchBox, ...childs ] };
37+
if(props.showTrafficLayer) { childs = [ traffic, ...childs ] };
38+
3539
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>)
40+
React.createElement(
41+
GoogleMap,
42+
{ defaultZoom : props.defaultZoom,
43+
onZoomChanged : props.onZoomChanged,
44+
onIdle : props.onIdle,
45+
defaultCenter : props.defaultCenter,
46+
center : props.center,
47+
ref : props.onMapMounted },
48+
childs))
4749
}));
4850

4951
export class GoogleMapComponent extends React.PureComponent {

0 commit comments

Comments
 (0)