Closed
Description
React-google-maps is nice library for my app, but I have trouble with using 'InfoBox'.
import { withGoogleMap, GoogleMap, Marker, InfoWindow } from 'react-google-maps';
import InfoBox from 'react-google-maps/lib/addons/InfoBox';
const GoogleMapWrapper = withGoogleMap((props) => (
<GoogleMap
ref={ props.onMapLoad }
zoom={ props.zoom || 13 }
center={ props.center }
onClick={ props.onMapClick }
onDragEnd={ props.onMapDragEnd }
onZoomChanged={ props.onZoomChanged }
options={{
streetViewControl: false,
disableDefaultUI: true
}} >
<Marker
position={props.center}
key={props.placeKey}
defaultAnimation={2}
onRightClick={() => props.onMarkerRightClick()}
icon={ MARKER_ICON_INFO } >
<InfoBox
position={ props.center }
options={{
position: props.center,
content: '<div>' + props.placeKey + '</div>',
closeBoxURL: "",
maxWidth: 200,
boxClass: 'txt_location',
disableDefaultUI: false,
visible: true
}}>
<div className="temp"></div>
</InfoBox>
</Marker>
</GoogleMap>
));
const MapCellSearchInput = React.createClass({
render() {
<div className="map_box">
<GoogleMapWrapper
containerElement={ <div style={{ width: '430px', height: '432px' }} /> }
mapElement={ <div style={{ width: '430px', height: '432px' }} /> }
onMapLoad={ (gmap) => {this.gmap = gmap;} }
onMapClick={this.onMapClick}
onMapDragEnd={ this.onMapDragEnd }
onZoomChanged={ this.onZoomChanged }
center={ mapCoordinate }
placeKey={ placeKey }
zoom={ zoom } />
</div>
}
})
It shows 'Uncaught Error: _registerComponent(...): Target container is not a DOM element' error. and when I remove InfoBox's child, like
<InfoBox
position={ props.center }
options={{
position: props.center,
content: '<div>' + props.placeKey + '</div>',
closeBoxURL: "",
maxWidth: 200,
boxClass: 'txt_location',
disableDefaultUI: false,
visible: true
}}>
</InfoBox>
It shows 'Uncaught Error: React.Children.only expected to receive a single React element child.', too. How can I solve this problem?
Metadata
Metadata
Assignees
Labels
No labels