diff --git a/lib/components/GoogleMap.js b/lib/components/GoogleMap.js index 2909ed09..c13de829 100644 --- a/lib/components/GoogleMap.js +++ b/lib/components/GoogleMap.js @@ -128,8 +128,8 @@ var Map = (exports.Map = (function(_React$PureComponent) { }, /* - * @see https://developers.google.com/maps/documentation/javascript/3.exp/reference#Map - */ + * @see https://developers.google.com/maps/documentation/javascript/3.exp/reference#Map + */ }, ]) @@ -317,14 +317,13 @@ var Map = (exports.Map = (function(_React$PureComponent) { }, ]) return Map -})( - _react2.default.PureComponent -)) /* - * ----------------------------------------------------------------------------- - * This file is auto-generated from the corresponding file at `src/macros/`. - * Please **DO NOT** edit this file directly when creating PRs. - * ----------------------------------------------------------------------------- - */ +})(_react2.default.PureComponent)) +/* + * ----------------------------------------------------------------------------- + * This file is auto-generated from the corresponding file at `src/macros/`. + * Please **DO NOT** edit this file directly when creating PRs. + * ----------------------------------------------------------------------------- + */ Map.displayName = "GoogleMap" Map.propTypes = { diff --git a/lib/components/GroundOverlay.js b/lib/components/GroundOverlay.js index 662b20ea..30503185 100644 --- a/lib/components/GroundOverlay.js +++ b/lib/components/GroundOverlay.js @@ -172,25 +172,26 @@ var GroundOverlay = (exports.GroundOverlay = (function(_React$PureComponent) { }, ]) return GroundOverlay -})( - _react2.default.PureComponent -)) /* - * ----------------------------------------------------------------------------- - * This file is auto-generated from the corresponding file at `src/macros/`. - * Please **DO NOT** edit this file directly when creating PRs. - * ----------------------------------------------------------------------------- - */ +})(_react2.default.PureComponent)) +/* + * ----------------------------------------------------------------------------- + * This file is auto-generated from the corresponding file at `src/macros/`. + * Please **DO NOT** edit this file directly when creating PRs. + * ----------------------------------------------------------------------------- + */ /* global google */ GroundOverlay.propTypes = { /** * @type string */ - defaultUrl: _propTypes2.default.string /* v10.0.0 .isRequired */ /** + defaultUrl: _propTypes2.default.string /* v10.0.0 .isRequired */ + /** * @see https://developers.google.com/maps/documentation/javascript/reference#GroundOverlay */, - defaultBounds: _propTypes2.default.object /* v10.0.0 .isRequired */ /** + defaultBounds: _propTypes2.default.object /* v10.0.0 .isRequired */ + /** * @type string * @deprecated use `defaultUrl` instead. It will be removed in v10.0.0 */, diff --git a/lib/components/InfoWindow.js b/lib/components/InfoWindow.js index dc443b97..10dfab6b 100644 --- a/lib/components/InfoWindow.js +++ b/lib/components/InfoWindow.js @@ -31,12 +31,13 @@ var _inherits2 = require("babel-runtime/helpers/inherits") var _inherits3 = _interopRequireDefault(_inherits2) -var _InfoWindow$contextTy /* - * ----------------------------------------------------------------------------- - * This file is auto-generated from the corresponding file at `src/macros/`. - * Please **DO NOT** edit this file directly when creating PRs. - * ----------------------------------------------------------------------------- - */ +var _InfoWindow$contextTy +/* + * ----------------------------------------------------------------------------- + * This file is auto-generated from the corresponding file at `src/macros/`. + * Please **DO NOT** edit this file directly when creating PRs. + * ----------------------------------------------------------------------------- + */ /* global google */ var _invariant = require("invariant") diff --git a/lib/components/Marker.js b/lib/components/Marker.js index ef7ffcab..8a74d964 100644 --- a/lib/components/Marker.js +++ b/lib/components/Marker.js @@ -31,12 +31,13 @@ var _inherits2 = require("babel-runtime/helpers/inherits") var _inherits3 = _interopRequireDefault(_inherits2) -var _Marker$contextTypes /* - * ----------------------------------------------------------------------------- - * This file is auto-generated from the corresponding file at `src/macros/`. - * Please **DO NOT** edit this file directly when creating PRs. - * ----------------------------------------------------------------------------- - */ +var _Marker$contextTypes +/* + * ----------------------------------------------------------------------------- + * This file is auto-generated from the corresponding file at `src/macros/`. + * Please **DO NOT** edit this file directly when creating PRs. + * ----------------------------------------------------------------------------- + */ /* global google */ var _react = require("react") diff --git a/lib/components/OverlayView.js b/lib/components/OverlayView.js index 01b03dfa..d6f554b4 100644 --- a/lib/components/OverlayView.js +++ b/lib/components/OverlayView.js @@ -47,12 +47,13 @@ var _bind2 = require("lodash/bind") var _bind3 = _interopRequireDefault(_bind2) -var _OverlayView$contextT /* - * ----------------------------------------------------------------------------- - * This file is auto-generated from the corresponding file at `src/macros/`. - * Please **DO NOT** edit this file directly when creating PRs. - * ----------------------------------------------------------------------------- - */ +var _OverlayView$contextT +/* + * ----------------------------------------------------------------------------- + * This file is auto-generated from the corresponding file at `src/macros/`. + * Please **DO NOT** edit this file directly when creating PRs. + * ----------------------------------------------------------------------------- + */ /* global google */ var _invariant = require("invariant") @@ -128,11 +129,9 @@ var OverlayView = (exports.OverlayView = (function(_React$PureComponent) { value: function onAdd() { this.containerElement = document.createElement("div") this.containerElement.style.position = "absolute" - }, - }, - { - key: "draw", - value: function draw() { + + _reactDom2.default.render(this.props.children, this.containerElement) + var mapPaneName = this.props.mapPaneName ;(0, _invariant2.default)( @@ -140,16 +139,15 @@ var OverlayView = (exports.OverlayView = (function(_React$PureComponent) { "OverlayView requires either props.mapPaneName or props.defaultMapPaneName but got %s", mapPaneName ) - // https://developers.google.com/maps/documentation/javascript/3.exp/reference#MapPanes + var mapPanes = this.state[_constants.OVERLAY_VIEW].getPanes() mapPanes[mapPaneName].appendChild(this.containerElement) - - _reactDom2.default.unstable_renderSubtreeIntoContainer( - this, - _react2.default.Children.only(this.props.children), - this.containerElement, - this.onPositionElement - ) + }, + }, + { + key: "draw", + value: function draw() { + this.onPositionElement() }, }, { diff --git a/lib/components/StreetViewPanorama.js b/lib/components/StreetViewPanorama.js index 163700bb..9118bcd8 100644 --- a/lib/components/StreetViewPanorama.js +++ b/lib/components/StreetViewPanorama.js @@ -258,14 +258,13 @@ var StreetViewPanorama = (exports.StreetViewPanorama = (function( }, ]) return StreetViewPanorama -})( - _react2.default.PureComponent -)) /* - * ----------------------------------------------------------------------------- - * This file is auto-generated from the corresponding file at `src/macros/`. - * Please **DO NOT** edit this file directly when creating PRs. - * ----------------------------------------------------------------------------- - */ +})(_react2.default.PureComponent)) +/* + * ----------------------------------------------------------------------------- + * This file is auto-generated from the corresponding file at `src/macros/`. + * Please **DO NOT** edit this file directly when creating PRs. + * ----------------------------------------------------------------------------- + */ StreetViewPanorama.propTypes = { /** diff --git a/lib/components/addons/InfoBox.js b/lib/components/addons/InfoBox.js index b55c452e..9d81b8b1 100644 --- a/lib/components/addons/InfoBox.js +++ b/lib/components/addons/InfoBox.js @@ -110,18 +110,18 @@ var InfoBox = (exports.InfoBox = (function(_React$PureComponent) { key: "componentWillMount", /* - * @see https://developers.google.com/maps/documentation/javascript/3.exp/reference#InfoBox - */ + * @see https://developers.google.com/maps/documentation/javascript/3.exp/reference#InfoBox + */ value: function componentWillMount() { if (!_canUseDom2.default || this.state[_constants.INFO_BOX]) { return } var _require = require(/* "google-maps-infobox" uses "google" as a global variable. Since we don't - * have "google" on the server, we can not use it in server-side rendering. - * As a result, we import "google-maps-infobox" here to prevent an error on - * a isomorphic server. - */ "google-maps-infobox"), + * have "google" on the server, we can not use it in server-side rendering. + * As a result, we import "google-maps-infobox" here to prevent an error on + * a isomorphic server. + */ "google-maps-infobox"), GoogleMapsInfobox = _require.InfoBox var infoBox = new GoogleMapsInfobox() diff --git a/lib/components/addons/MarkerWithLabel.js b/lib/components/addons/MarkerWithLabel.js index 1b78f4c2..25ee771b 100644 --- a/lib/components/addons/MarkerWithLabel.js +++ b/lib/components/addons/MarkerWithLabel.js @@ -31,12 +31,13 @@ var _inherits2 = require("babel-runtime/helpers/inherits") var _inherits3 = _interopRequireDefault(_inherits2) -var _MarkerWithLabel$cont /* - * ----------------------------------------------------------------------------- - * This file is auto-generated from the corresponding file at `src/macros/`. - * Please **DO NOT** edit this file directly when creating PRs. - * ----------------------------------------------------------------------------- - */ +var _MarkerWithLabel$cont +/* + * ----------------------------------------------------------------------------- + * This file is auto-generated from the corresponding file at `src/macros/`. + * Please **DO NOT** edit this file directly when creating PRs. + * ----------------------------------------------------------------------------- + */ /* global google */ var _react = require("react") diff --git a/lib/components/drawing/DrawingManager.js b/lib/components/drawing/DrawingManager.js index b51a2e49..341992ca 100644 --- a/lib/components/drawing/DrawingManager.js +++ b/lib/components/drawing/DrawingManager.js @@ -146,14 +146,13 @@ var DrawingManager = (exports.DrawingManager = (function(_React$PureComponent) { }, ]) return DrawingManager -})( - _react2.default.PureComponent -)) /* - * ----------------------------------------------------------------------------- - * This file is auto-generated from the corresponding file at `src/macros/`. - * Please **DO NOT** edit this file directly when creating PRs. - * ----------------------------------------------------------------------------- - */ +})(_react2.default.PureComponent)) +/* + * ----------------------------------------------------------------------------- + * This file is auto-generated from the corresponding file at `src/macros/`. + * Please **DO NOT** edit this file directly when creating PRs. + * ----------------------------------------------------------------------------- + */ /* global google */ DrawingManager.propTypes = { diff --git a/lib/components/places/SearchBox.js b/lib/components/places/SearchBox.js index eaf20e81..96e4bb26 100644 --- a/lib/components/places/SearchBox.js +++ b/lib/components/places/SearchBox.js @@ -181,8 +181,8 @@ var SearchBox = (exports.SearchBox = (function(_React$PureComponent) { key: "handleInitializeSearchBox", value: function handleInitializeSearchBox() { /* - * @see https://developers.google.com/maps/documentation/javascript/3.exp/reference#SearchBox - */ + * @see https://developers.google.com/maps/documentation/javascript/3.exp/reference#SearchBox + */ var searchBox = new google.maps.places.SearchBox( this.containerElement.querySelector("input") ) @@ -274,14 +274,13 @@ var SearchBox = (exports.SearchBox = (function(_React$PureComponent) { }, ]) return SearchBox -})( - _react2.default.PureComponent -)) /* - * ----------------------------------------------------------------------------- - * This file is auto-generated from the corresponding file at `src/macros/`. - * Please **DO NOT** edit this file directly when creating PRs. - * ----------------------------------------------------------------------------- - */ +})(_react2.default.PureComponent)) +/* + * ----------------------------------------------------------------------------- + * This file is auto-generated from the corresponding file at `src/macros/`. + * Please **DO NOT** edit this file directly when creating PRs. + * ----------------------------------------------------------------------------- + */ /* global google */ SearchBox.propTypes = { diff --git a/lib/components/places/StandaloneSearchBox.js b/lib/components/places/StandaloneSearchBox.js index 8e6f120f..dc81bf53 100644 --- a/lib/components/places/StandaloneSearchBox.js +++ b/lib/components/places/StandaloneSearchBox.js @@ -116,8 +116,8 @@ var SearchBox = (function(_React$PureComponent) { ) var element = _reactDom2.default.findDOMNode(this) /* - * @see https://developers.google.com/maps/documentation/javascript/3.exp/reference#SearchBox - */ + * @see https://developers.google.com/maps/documentation/javascript/3.exp/reference#SearchBox + */ var searchBox = new google.maps.places.SearchBox( element.querySelector("input") || element ) diff --git a/lib/components/visualization/HeatmapLayer.js b/lib/components/visualization/HeatmapLayer.js index dad2dc59..5caa69df 100644 --- a/lib/components/visualization/HeatmapLayer.js +++ b/lib/components/visualization/HeatmapLayer.js @@ -145,14 +145,13 @@ var HeatmapLayer = (exports.HeatmapLayer = (function(_React$PureComponent) { }, ]) return HeatmapLayer -})( - _react2.default.PureComponent -)) /* - * ----------------------------------------------------------------------------- - * This file is auto-generated from the corresponding file at `src/macros/`. - * Please **DO NOT** edit this file directly when creating PRs. - * ----------------------------------------------------------------------------- - */ +})(_react2.default.PureComponent)) +/* + * ----------------------------------------------------------------------------- + * This file is auto-generated from the corresponding file at `src/macros/`. + * Please **DO NOT** edit this file directly when creating PRs. + * ----------------------------------------------------------------------------- + */ /* global google */ HeatmapLayer.propTypes = { diff --git a/package.json b/package.json index e3d34ff9..b15a9d3c 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,12 @@ }, "homepage": "https://tomchentw.github.io/react-google-maps/", "main": "lib/index.js", - "files": ["types/index.d.ts", "lib/", "src/", "CHANGELOG.md"], + "files": [ + "types/index.d.ts", + "lib/", + "src/", + "CHANGELOG.md" + ], "keywords": [ "React", "Google", @@ -55,24 +60,21 @@ "test:once": "cross-env CI=true npm test", "build:src": "babel-node src/tx/jscodeshift", "precommit:src": "npm run build:src && npm run dtslint", - "commit:src": - "git add -A && git commit -m 'chore(src/components): compile from src/macros with `babel`'", + "commit:src": "git add -A && git commit -m 'chore(src/components): compile from src/macros with `babel`'", "prebuild:lib": "rimraf lib", - "build:lib": - "cross-env NODE_ENV=production babel src --out-dir lib --ignore macros,tx,spec.js", + "build:lib": "cross-env NODE_ENV=production babel src --out-dir lib --ignore macros,tx,spec.js", "precommit:lib": "npm run build:lib", - "commit:lib": - "git add -A && git commit -m 'chore(lib): compile from src with `babel`'", + "commit:lib": "git add -A && git commit -m 'chore(lib): compile from src with `babel`'", "precommit:docs": "npm run styleguide:build", - "commit:docs": - "git add -A && git commit -m 'docs: compile from src with `styleguidist`'", - "prerelease": - "npm run commit:src && npm run commit:lib && npm run commit:docs", - "release": - "standard-version -m 'chore(release): %s \n\n* CHANGELOG: https://github.com/tomchentw/react-google-maps/blob/v%s/CHANGELOG.md'" + "commit:docs": "git add -A && git commit -m 'docs: compile from src with `styleguidist`'", + "prerelease": "npm run commit:src && npm run commit:lib && npm run commit:docs", + "release": "standard-version -m 'chore(release): %s \n\n* CHANGELOG: https://github.com/tomchentw/react-google-maps/blob/v%s/CHANGELOG.md'" }, "lint-staged": { - "*.{js,jsx,json,css}": ["prettier --write", "git add"] + "*.{js,jsx,json,css}": [ + "prettier --write", + "git add" + ] }, "babel": { "plugins": [ diff --git a/src/components/OverlayView.jsx b/src/components/OverlayView.jsx index 4bbe0508..7cfb043f 100644 --- a/src/components/OverlayView.jsx +++ b/src/components/OverlayView.jsx @@ -87,25 +87,22 @@ export class OverlayView extends React.PureComponent { onAdd() { this.containerElement = document.createElement(`div`) this.containerElement.style.position = `absolute` - } - draw() { + ReactDOM.render(this.props.children, this.containerElement) + const { mapPaneName } = this.props invariant( !!mapPaneName, `OverlayView requires either props.mapPaneName or props.defaultMapPaneName but got %s`, mapPaneName ) - // https://developers.google.com/maps/documentation/javascript/3.exp/reference#MapPanes + const mapPanes = this.state[OVERLAY_VIEW].getPanes() mapPanes[mapPaneName].appendChild(this.containerElement) + } - ReactDOM.unstable_renderSubtreeIntoContainer( - this, - React.Children.only(this.props.children), - this.containerElement, - this.onPositionElement - ) + draw() { + this.onPositionElement() } onPositionElement() { diff --git a/src/macros/OverlayView.jsx b/src/macros/OverlayView.jsx index d0e6878a..af9f55be 100644 --- a/src/macros/OverlayView.jsx +++ b/src/macros/OverlayView.jsx @@ -84,25 +84,22 @@ export class OverlayView extends React.PureComponent { onAdd() { this.containerElement = document.createElement(`div`) this.containerElement.style.position = `absolute` - } - draw() { + ReactDOM.render(this.props.children, this.containerElement) + const { mapPaneName } = this.props invariant( !!mapPaneName, `OverlayView requires either props.mapPaneName or props.defaultMapPaneName but got %s`, mapPaneName ) - // https://developers.google.com/maps/documentation/javascript/3.exp/reference#MapPanes + const mapPanes = this.state[OVERLAY_VIEW].getPanes() mapPanes[mapPaneName].appendChild(this.containerElement) + } - ReactDOM.unstable_renderSubtreeIntoContainer( - this, - React.Children.only(this.props.children), - this.containerElement, - this.onPositionElement - ) + draw() { + this.onPositionElement() } onPositionElement() {