@uiw/react-amap-circle
Advanced tools
Comparing version 6.0.0 to 6.0.1
@@ -25,3 +25,3 @@ "use strict"; | ||
setCircle = _useState2[1]; | ||
(0, _react.useEffect)(function () { | ||
(0, _react.useLayoutEffect)(function () { | ||
if (AMap && map && !circle) { | ||
@@ -31,11 +31,7 @@ var instance = new AMap.Circle((0, _objectSpread2["default"])({}, other)); | ||
setCircle(instance); | ||
return function () { | ||
map && map.remove(instance); | ||
setCircle(undefined); | ||
}; | ||
} | ||
return function () { | ||
setCircle(function (circle) { | ||
if (circle) { | ||
map && map.remove(circle); | ||
} | ||
return undefined; | ||
}); | ||
}; | ||
}, [map]); | ||
@@ -42,0 +38,0 @@ (0, _reactAmapUtils.useVisiable)(circle, visiable); |
import _extends from "@babel/runtime/helpers/extends"; | ||
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose"; | ||
var _excluded = ["visiable"]; | ||
import { useState, useEffect } from 'react'; | ||
import { useState, useLayoutEffect } from 'react'; | ||
import { useVisiable, useEventProperties, useSettingProperties } from '@uiw/react-amap-utils'; | ||
@@ -19,3 +19,3 @@ import { useMapContext } from '@uiw/react-amap-map'; | ||
var [circle, setCircle] = useState(); | ||
useEffect(() => { | ||
useLayoutEffect(() => { | ||
if (AMap && map && !circle) { | ||
@@ -25,11 +25,7 @@ var instance = new AMap.Circle(_extends({}, other)); | ||
setCircle(instance); | ||
return () => { | ||
map && map.remove(instance); | ||
setCircle(undefined); | ||
}; | ||
} | ||
return () => { | ||
setCircle(circle => { | ||
if (circle) { | ||
map && map.remove(circle); | ||
} | ||
return undefined; | ||
}); | ||
}; | ||
}, [map]); | ||
@@ -36,0 +32,0 @@ useVisiable(circle, visiable); |
{ | ||
"name": "@uiw/react-amap-circle", | ||
"version": "6.0.0", | ||
"version": "6.0.1", | ||
"description": "构造圆形对象,通过 CircleOptions 指定多边形样式", | ||
@@ -38,5 +38,5 @@ "funding": "https://jaywcjlove.github.io/#/sponsor", | ||
"dependencies": { | ||
"@uiw/react-amap-map": "6.0.0", | ||
"@uiw/react-amap-types": "6.0.0", | ||
"@uiw/react-amap-utils": "6.0.0" | ||
"@uiw/react-amap-map": "6.0.1", | ||
"@uiw/react-amap-types": "6.0.1", | ||
"@uiw/react-amap-utils": "6.0.1" | ||
}, | ||
@@ -43,0 +43,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
12070
212
+ Added@uiw/react-amap-map@6.0.1(transitive)
+ Added@uiw/react-amap-types@6.0.1(transitive)
+ Added@uiw/react-amap-utils@6.0.1(transitive)
- Removed@uiw/react-amap-map@6.0.0(transitive)
- Removed@uiw/react-amap-types@6.0.0(transitive)
- Removed@uiw/react-amap-utils@6.0.0(transitive)
Updated@uiw/react-amap-map@6.0.1
Updated@uiw/react-amap-types@6.0.1
Updated@uiw/react-amap-utils@6.0.1