From 6629bb4605b3d64ef1f3d0a2ffa7cb42599d7bf9 Mon Sep 17 00:00:00 2001 From: Federico Zivolo Date: Thu, 24 Sep 2020 15:15:14 +0200 Subject: [PATCH] feat: expose instance argument from render prop --- src/Tippy.js | 6 +++++- test/Tippy.test.js | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/Tippy.js b/src/Tippy.js index 9b3681e..02f4019 100644 --- a/src/Tippy.js +++ b/src/Tippy.js @@ -221,7 +221,11 @@ export default function TippyGenerator(tippy) { {mounted && createPortal( render - ? render(toDataAttributes(attrs), singletonContent) + ? render( + toDataAttributes(attrs), + singletonContent, + mutableBox.instance, + ) : content, mutableBox.container, )} diff --git a/test/Tippy.test.js b/test/Tippy.test.js index 6c5fd2d..e9433c0 100644 --- a/test/Tippy.test.js +++ b/test/Tippy.test.js @@ -459,6 +459,25 @@ describe('', () => { expect(instance.popper.firstElementChild).toMatchSnapshot(); }); + test('render prop instance', () => { + let _instance; + render( + { + _instance = instance; + return
Hello
; + }} + showOnCreate={true} + > +