Browse Source

Merge pull request #20 from Junyan/master

bugfix: 在预览中删除图片,如果没有图片时无法关闭预览
MinJie 5 years ago
parent
commit
ebe74e09d2
1 changed files with 2 additions and 4 deletions
  1. 2 4
      src/components/VisibleAnimationHandle.tsx

+ 2 - 4
src/components/VisibleAnimationHandle.tsx

@@ -32,10 +32,8 @@ export default function VisibleAnimationHandle({ visible, currentImage, children
   }
 
   React.useEffect(() => {
-    if (!currentImage) {
-      return;
-    }
-    const originRef = currentImage.originRef;
+    const originRef = (currentImage || {}).originRef;
+    
     if (originRef && originRef.nodeType === 1) {
       // 获取触发时节点位置
       const { top, left, width, height } = originRef.getBoundingClientRect();