Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit df55899

Browse files
committed
schedule update immediately after creating Popper
1 parent 7851363 commit df55899

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/Popper.jsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,12 @@ class Popper extends Component {
8888
element: this._arrowNode,
8989
}
9090
}
91-
this._popper = new PopperJS(this._getTargetNode(), this._node, {
91+
this._popper = new PopperJS(this._getTargetNode(), this._popperNode, {
9292
placement,
9393
eventsEnabled,
9494
modifiers,
9595
})
96+
this._scheduleUpdate()
9697
}
9798

9899
_destroyPopper() {
@@ -118,8 +119,8 @@ class Popper extends Component {
118119
}
119120
}
120121

121-
_getPopperRef = node => {
122-
this._node = node
122+
_handlePopperRef = node => {
123+
this._popperNode = node
123124
if (node) {
124125
this._createPopper()
125126
} else {
@@ -149,7 +150,7 @@ class Popper extends Component {
149150

150151
if (typeof children === 'function') {
151152
const popperProps = {
152-
ref: this._getPopperRef,
153+
ref: this._handlePopperRef,
153154
'data-placement': popperPlacement,
154155
'data-x-out-of-boundaries': popperHide,
155156
}
@@ -167,9 +168,9 @@ class Popper extends Component {
167168
}
168169

169170
if (typeof component === 'string') {
170-
componentProps.ref = this._getPopperRef
171+
componentProps.ref = this._handlePopperRef
171172
} else {
172-
componentProps.innerRef = this._getPopperRef
173+
componentProps.innerRef = this._handlePopperRef
173174
}
174175

175176
return createElement(component, componentProps, children)

0 commit comments

Comments
 (0)