From 90befd45b6c99abfd001b0be65f4a33e32785b25 Mon Sep 17 00:00:00 2001
From: wangking873 <wangking873@163.com>
Date: Fri, 11 May 2018 20:13:56 +0800
Subject: [PATCH 1/4] Update Popup.js

add getTarget
---
 src/Popup.js | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/Popup.js b/src/Popup.js
index 8171b468..6e45164e 100644
--- a/src/Popup.js
+++ b/src/Popup.js
@@ -13,7 +13,7 @@ class Popup extends Component {
     style: PropTypes.object,
     getClassNameFromAlign: PropTypes.func,
     onAlign: PropTypes.func,
-    getRootDomNode: PropTypes.func,
+    getTarget: PropTypes.func,
     onMouseEnter: PropTypes.func,
     align: PropTypes.any,
     destroyPopupOnHide: PropTypes.bool,
@@ -61,7 +61,7 @@ class Popup extends Component {
 
   // Record size if stretch needed
   setStretchSize = () => {
-    const { stretch, getRootDomNode, visible } = this.props;
+    const { stretch, getTarget, visible } = this.props;
     const { stretchChecked, targetHeight, targetWidth } = this.state;
 
     if (!stretch || !visible) {
@@ -71,7 +71,7 @@ class Popup extends Component {
       return;
     }
 
-    const $ele = getRootDomNode();
+    const $ele = getTarget();
     if (!$ele) return;
 
     const height = $ele.offsetHeight;
@@ -90,10 +90,6 @@ class Popup extends Component {
     return ReactDOM.findDOMNode(this.popupInstance);
   }
 
-  getTarget = () => {
-    return this.props.getRootDomNode();
-  }
-
   getMaskTransitionName() {
     const props = this.props;
     let transitionName = props.maskTransitionName;
@@ -166,6 +162,7 @@ class Popup extends Component {
       ref: savePopupRef,
       onMouseEnter,
       onMouseLeave,
+      getTarget,
       style: newStyle,
     };
     if (destroyPopupOnHide) {
@@ -178,7 +175,7 @@ class Popup extends Component {
         >
           {visible ? (
             <Align
-              target={this.getTarget}
+              target={getTarget}
               key="popup"
               ref={this.saveAlignRef}
               monitorWindowResize
@@ -205,7 +202,7 @@ class Popup extends Component {
         showProp="xVisible"
       >
         <Align
-          target={this.getTarget}
+          target={getTarget}
           key="popup"
           ref={this.saveAlignRef}
           monitorWindowResize

From 4de233fc4ce298abb71d3fd0a5d9fd232ecb2148 Mon Sep 17 00:00:00 2001
From: wangking873 <wangking873@163.com>
Date: Fri, 11 May 2018 20:15:52 +0800
Subject: [PATCH 2/4] Update Popup.js

---
 src/Popup.js | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/Popup.js b/src/Popup.js
index 6e45164e..b8a76982 100644
--- a/src/Popup.js
+++ b/src/Popup.js
@@ -120,7 +120,7 @@ class Popup extends Component {
       align, visible,
       prefixCls, style, getClassNameFromAlign,
       destroyPopupOnHide, stretch, children,
-      onMouseEnter, onMouseLeave,
+      onMouseEnter, onMouseLeave, getTarget,
     } = this.props;
     const className = this.getClassName(this.currentAlignClassName ||
       getClassNameFromAlign(align));
@@ -162,7 +162,6 @@ class Popup extends Component {
       ref: savePopupRef,
       onMouseEnter,
       onMouseLeave,
-      getTarget,
       style: newStyle,
     };
     if (destroyPopupOnHide) {

From 18ef8294ba522bbf9083a30d64bb57069afedd09 Mon Sep 17 00:00:00 2001
From: wangking873 <wangking873@163.com>
Date: Fri, 11 May 2018 20:22:19 +0800
Subject: [PATCH 3/4] Update index.js

---
 src/index.js | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/index.js b/src/index.js
index fcde64f2..04767d3e 100644
--- a/src/index.js
+++ b/src/index.js
@@ -54,6 +54,7 @@ export default class Trigger extends React.Component {
     blurDelay: PropTypes.number,
     getPopupContainer: PropTypes.func,
     getDocument: PropTypes.func,
+    getTarget: PropTypes.func,
     forceRender: PropTypes.bool,
     destroyPopupOnHide: PropTypes.bool,
     mask: PropTypes.bool,
@@ -297,10 +298,6 @@ export default class Trigger extends React.Component {
     return null;
   }
 
-  getRootDomNode = () => {
-    return findDOMNode(this);
-  }
-
   getPopupClassNameFromAlign = (align) => {
     const className = [];
     const props = this.props;
@@ -327,7 +324,7 @@ export default class Trigger extends React.Component {
     const {
       prefixCls, destroyPopupOnHide, popupClassName, action,
       onPopupAlign, popupAnimation, popupTransitionName, popupStyle,
-      mask, maskAnimation, maskTransitionName, zIndex, popup, stretch,
+      mask, maskAnimation, maskTransitionName, zIndex, popup, stretch, getTarget,
     } = this.props;
     const { state } = this;
 
@@ -354,7 +351,7 @@ export default class Trigger extends React.Component {
         getClassNameFromAlign={this.getPopupClassNameFromAlign}
         {...mouseProps}
         stretch={stretch}
-        getRootDomNode={this.getRootDomNode}
+        getTarget={getTarget || this.getRootDomNode}
         style={popupStyle}
         mask={mask}
         zIndex={zIndex}

From af6bfc1c04611de904df102f1b0178b08b86c618 Mon Sep 17 00:00:00 2001
From: wangking873 <wangking873@163.com>
Date: Fri, 11 May 2018 20:25:56 +0800
Subject: [PATCH 4/4] Update index.js

---
 src/index.js | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/index.js b/src/index.js
index 04767d3e..589680fd 100644
--- a/src/index.js
+++ b/src/index.js
@@ -298,6 +298,10 @@ export default class Trigger extends React.Component {
     return null;
   }
 
+  getRootDomNode = () => {
+    return findDOMNode(this);
+  }
+
   getPopupClassNameFromAlign = (align) => {
     const className = [];
     const props = this.props;