diff --git a/lib/components/Control/BaseControl.js b/lib/components/Control/BaseControl.js index 8732f73..6ee018f 100644 --- a/lib/components/Control/BaseControl.js +++ b/lib/components/Control/BaseControl.js @@ -8,6 +8,8 @@ var _createClass = function () { function defineProperties(target, props) { for var _reactDom = require('react-dom'); +var _util = require('../_base/util'); + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var BaseControl = function () { @@ -25,6 +27,7 @@ var BaseControl = function () { key: 'onPropsUpdate', value: function onPropsUpdate(newProps) { this.props = newProps; + (0, _util.unBindEvents)(this.instance); this.destroy(); this.init(); } diff --git a/lib/components/Overlay/BaseOverlay.js b/lib/components/Overlay/BaseOverlay.js index 0d4c5a5..300a532 100644 --- a/lib/components/Overlay/BaseOverlay.js +++ b/lib/components/Overlay/BaseOverlay.js @@ -8,6 +8,8 @@ var _createClass = function () { function defineProperties(target, props) { for var _reactDom = require('react-dom'); +var _util = require('../_base/util'); + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var BaseOverlay = function () { @@ -34,6 +36,7 @@ var BaseOverlay = function () { key: 'onPropsUpdate', value: function onPropsUpdate(newProps) { this.props = newProps; + (0, _util.unBindEvents)(this.instance); this.destroy(); this.init(); } diff --git a/lib/components/_base/options.js b/lib/components/_base/options.js index b148156..44c4295 100644 --- a/lib/components/_base/options.js +++ b/lib/components/_base/options.js @@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var MAP_SET_OPTIONS = exports.MAP_SET_OPTIONS = ['minZoom', 'maxZoom', 'defaultCursor', 'draggingCursor', 'mapStyle', 'mapType', 'zoom']; +var MAP_SET_OPTIONS = exports.MAP_SET_OPTIONS = ['minZoom', 'maxZoom', 'defaultCursor', 'draggingCursor', 'mapStyle', 'zoom']; var MAP_BOOLEAN_OPTIONS = exports.MAP_BOOLEAN_OPTIONS = ['dragging', 'scrollWheelZoom', 'doubleClickZoom', 'keyboard', 'inertialDragging', 'continuousZoom', 'pinchToZoom', 'autoResize']; diff --git a/package.json b/package.json index 7640a53..e696097 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rc-bmap", - "version": "0.1.9", + "version": "0.2.0", "main": "lib/index.js", "typings": "types/index.d.ts", "repository": { diff --git a/src/components/Control/BaseControl.js b/src/components/Control/BaseControl.js index f4f20ef..a7f2984 100644 --- a/src/components/Control/BaseControl.js +++ b/src/components/Control/BaseControl.js @@ -1,5 +1,6 @@ import { render as reactRender } from 'react-dom'; +import { unBindEvents } from '../_base/util'; class BaseControl { constructor(props) { @@ -12,6 +13,7 @@ class BaseControl { onPropsUpdate(newProps) { this.props = newProps; + unBindEvents(this.instance); this.destroy(); this.init(); } diff --git a/src/components/Overlay/BaseOverlay.js b/src/components/Overlay/BaseOverlay.js index c09f40a..b2b7bc8 100644 --- a/src/components/Overlay/BaseOverlay.js +++ b/src/components/Overlay/BaseOverlay.js @@ -1,5 +1,6 @@ import { render as reactRender } from 'react-dom'; +import { unBindEvents } from '../_base/util'; class BaseOverlay { constructor(props) { @@ -20,6 +21,7 @@ class BaseOverlay { onPropsUpdate(newProps) { this.props = newProps; + unBindEvents(this.instance); this.destroy(); this.init(); }