mirror of
https://github.com/google-map-react/google-map-react.git
synced 2025-12-08 18:26:32 +00:00
Remove React 0.14rc1 warnings
This commit is contained in:
parent
c5b7c41b1c
commit
3a4d275f46
@ -1,4 +1,6 @@
|
||||
import React, {PropTypes, Component} from 'react';
|
||||
import { isReact14 } from './utils/react_version.js';
|
||||
|
||||
import shouldPureComponentUpdate from 'react-pure-render/function';
|
||||
|
||||
import MarkerDispatcher from './marker_dispatcher.js';
|
||||
@ -19,6 +21,11 @@ import pick from 'lodash.pick';
|
||||
import assign from 'lodash.assign';
|
||||
import isNumber from 'lodash.isnumber';
|
||||
|
||||
const ReactDOM = isReact14(React)
|
||||
? require('react-dom')
|
||||
: React;
|
||||
|
||||
|
||||
const kEPS = 0.00001;
|
||||
const K_GOOGLE_TILE_SIZE = 256;
|
||||
|
||||
@ -135,7 +142,7 @@ export default class GoogleMap extends Component {
|
||||
|
||||
const mapOptions = {...defaultOptions, ...options, ...propsOptions};
|
||||
|
||||
const map = new maps.Map(React.findDOMNode(this.refs.google_map_dom), mapOptions);
|
||||
const map = new maps.Map(ReactDOM.findDOMNode(this.refs.google_map_dom), mapOptions);
|
||||
this.map_ = map;
|
||||
this.maps_ = maps;
|
||||
|
||||
@ -158,7 +165,7 @@ export default class GoogleMap extends Component {
|
||||
const panes = this.getPanes();
|
||||
panes.overlayMouseTarget.appendChild(div);
|
||||
|
||||
React.render((
|
||||
ReactDOM.render((
|
||||
<GoogleMapMarkers
|
||||
onChildClick={this_._onChildClick}
|
||||
onChildMouseEnter={this_._onChildMouseEnter}
|
||||
@ -272,7 +279,7 @@ export default class GoogleMap extends Component {
|
||||
}
|
||||
|
||||
_setViewSize = () => {
|
||||
const mapDom = React.findDOMNode(this.refs.google_map_dom);
|
||||
const mapDom = ReactDOM.findDOMNode(this.refs.google_map_dom);
|
||||
this.geoService_.setViewSize(mapDom.clientWidth, mapDom.clientHeight);
|
||||
this._onBoundsChanged();
|
||||
}
|
||||
|
||||
13
src/utils/react_version.js
Normal file
13
src/utils/react_version.js
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
export function isReact14(React) {
|
||||
const { version } = React;
|
||||
if (typeof version !== 'string') {
|
||||
return false;
|
||||
}
|
||||
|
||||
const sections = version.split('.');
|
||||
const major = parseInt(sections[0], 10);
|
||||
const minor = parseInt(sections[1], 10);
|
||||
|
||||
return major === 0 && minor > 13;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user