Skip to content

Commit 29944ce

Browse files
committed
refactor arrow props code
1 parent 1e9c32f commit 29944ce

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/portal-popper.jsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,16 @@ class PortalPopper extends Component {
103103
}
104104

105105
_getArrowStyle () {
106-
const left = _.isNumber(this.state.arrowProps.left) ? Math.round(this.state.arrowProps.left) : null
107-
const top = _.isNumber(this.state.arrowProps.top) ? Math.round(this.state.arrowProps.top) : null
108-
109106
return {
110-
left,
111-
top,
107+
left: this._getArrowProp('left'),
108+
top: this._getArrowProp('top'),
112109
}
113110
}
114111

112+
_getArrowProp (position) {
113+
return _.isNumber(this.state.arrowProps[position]) ? Math.round(this.state.arrowProps[position]) : null
114+
}
115+
115116
componentWillUnmount () {
116117
this.isUnmounted = true
117118
this.popper && this.popper.destroy()

0 commit comments

Comments
 (0)