Skip to content

Commit 7c0da64

Browse files
committed
First step to get rid of JSX
1 parent 4bd30f0 commit 7c0da64

File tree

1 file changed

+32
-29
lines changed

1 file changed

+32
-29
lines changed

src/Fable.ReactGoogleMaps/js/mapComponent.js

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -57,35 +57,38 @@ export class GoogleMapComponent extends React.PureComponent {
5757
}
5858

5959
render() {
60+
var loading = React.createElement("div", { className : this.props.mapLoadingContainer, style : { width: `100%` }}, "Loading");
61+
var container = React.createElement("div", { className : this.props.mapContainer});
62+
var mapElement = React.createElement("div", { style : { height: `100%` }});
6063
return (
61-
<TrafficMapComponent
62-
key="map"
63-
isMarkerShown={this.state.isMarkerShown}
64-
defaultZoom={this.props.defaultZoom}
65-
onZoomChanged={this.props.onZoomChanged}
66-
defaultCenter={this.props.defaultCenter}
67-
searchBoxText={this.props.searchBoxText}
68-
showSearchBox={this.props.showSearchBox}
69-
showTrafficLayer={this.props.showTrafficLayer}
70-
center={this.props.center}
71-
onPlacesChanged={() => {
72-
this.props.onPlacesChanged(this.searchBoxRef.getPlaces())
73-
}}
74-
onIdle={this.props.onIdle}
75-
onMapMounted={this.props.setRef}
76-
onSearchBoxMounted={ref => {
77-
this.searchBoxRef = ref;
78-
}}
79-
markers={this.props.markers}
80-
onMarkerClick={() => {
81-
this.setState({ isMarkerShown: false })
82-
this.delayedShowMarker()
83-
}}
84-
googleMapURL={"https://maps.googleapis.com/maps/api/js?key=" + this.props.apiKey + "&v=3.exp&libraries=geometry,drawing,places"}
85-
loadingElement={<div className={this.props.mapLoadingContainer} style={{ width: `100%` }} >Loading</div>}
86-
containerElement={<div className={this.props.mapContainer} style={{ width: `100%` }} /> }
87-
mapElement={<div style={{ height: `100%` }} />}
88-
/>
89-
)
64+
React.createElement(
65+
TrafficMapComponent,
66+
{ key:"map",
67+
isMarkerShown: this.state.isMarkerShown,
68+
defaultZoom: this.props.defaultZoom,
69+
onZoomChanged: this.props.onZoomChanged,
70+
defaultCenter: this.props.defaultCenter,
71+
searchBoxText: this.props.searchBoxText,
72+
showSearchBox: this.props.showSearchBox,
73+
showTrafficLayer: this.props.showTrafficLayer,
74+
center: this.props.center,
75+
onPlacesChanged: () => {
76+
this.props.onPlacesChanged(this.searchBoxRef.getPlaces())
77+
},
78+
onIdle: this.props.onIdle,
79+
onMapMounted: this.props.setRef,
80+
onSearchBoxMounted: ref => {
81+
this.searchBoxRef = ref;
82+
},
83+
markers: this.props.markers,
84+
onMarkerClick: () => {
85+
this.setState({ isMarkerShown: false })
86+
this.delayedShowMarker()
87+
},
88+
googleMapURL: "https://maps.googleapis.com/maps/api/js?key=" + this.props.apiKey + "&v=3.exp&libraries=geometry,drawing,places",
89+
loadingElement: loading,
90+
containerElement: container,
91+
mapElement: mapElement
92+
}))
9093
}
9194
}

0 commit comments

Comments
 (0)