Moves marker dispatcher binds to componentDidMount (#873)

This commit is contained in:
Brandon DeMello 2020-07-30 02:31:45 -07:00 committed by GitHub
parent fe76674757
commit 307476f02e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,13 +48,6 @@ export default class GoogleMapMarkers extends Component {
constructor(props) {
super(props);
this.props.dispatcher.on('kON_CHANGE', this._onChangeHandler);
this.props.dispatcher.on(
'kON_MOUSE_POSITION_CHANGE',
this._onMouseChangeHandler
);
this.props.dispatcher.on('kON_CLICK', this._onChildClick);
this.props.dispatcher.on('kON_MDOWN', this._onChildMouseDown);
this.dimensionsCache_ = {};
this.hoverKey_ = null;
@ -64,6 +57,16 @@ export default class GoogleMapMarkers extends Component {
this.state = { ...this._getState(), hoverKey: null };
}
componentDidMount() {
this.props.dispatcher.on('kON_CHANGE', this._onChangeHandler);
this.props.dispatcher.on(
'kON_MOUSE_POSITION_CHANGE',
this._onMouseChangeHandler
);
this.props.dispatcher.on('kON_CLICK', this._onChildClick);
this.props.dispatcher.on('kON_MDOWN', this._onChildMouseDown);
}
shouldComponentUpdate(nextProps, nextState) {
if (this.props.experimental === true) {
return (