Skip to content

Commit 3b48785

Browse files
authored
Merge pull request #310 from stefanhayden/update-position-with-content
Update position with content
2 parents b633151 + c8cdf89 commit 3b48785

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

example/src/index.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ class Test extends React.Component {
231231
<div className="side">
232232
<a data-for='overTime' data-tip>=( •̀д•́)</a>
233233
<ReactTooltip id='overTime'
234-
getContent={[() => {return new Date().toISOString()}, 1000]}/>
234+
getContent={[() => {return 'Random length content'.slice(0, Math.floor(Math.random() * 21) + 1)}, 1000]}/>
235235
</div>
236236
</div>
237237
<br />
@@ -241,8 +241,10 @@ class Test extends React.Component {
241241
"<ReactTooltip id='getContent' getContent={() => Math.floor(Math.random() * 100)} />"}</p>
242242
</div>
243243
<div>
244-
<p>{"<a data-for='overTime' data-tip>=( •̀д•́)</a>\n" +
245-
"<ReactTooltip id='overTime' getContent={[() => {return new Date().toISOString()}, 1000]}/>"}</p>
244+
<p>{"<a data-for='overTime' data-tip>=( •̀д•́)</a>\naaaa" +
245+
"<ReactTooltip id='overTime' getContent={[() => {\n" +
246+
" return 'Random length content'.slice(0, Math.floor(Math.random() * 21) + 1)\n" +
247+
"}, 1000]}/>"}</p>
246248
</div>
247249
</pre>
248250
</div>

src/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ class ReactTooltip extends React.Component {
313313
this.setState({
314314
isEmptyTip
315315
})
316+
this.updatePosition()
316317
}
317318
}, getContent[1])
318319
}

0 commit comments

Comments
 (0)