From 81e130c317e47d1aff8400d7db162d601595aec4 Mon Sep 17 00:00:00 2001 From: "DESKTOP-SB1K7TM\\Madeeha Hasan" Date: Tue, 16 Jan 2018 19:33:04 +0500 Subject: [PATCH 1/2] return toggle state --- README.md | 2 +- src/index.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1e47fff..aa977c0 100644 --- a/README.md +++ b/README.md @@ -205,4 +205,4 @@ class App extends React.Component { | Property | Description | |----------------|---------------| -| toggle | Open or hide popover tooltip | +| toggle | Open or hide popover tooltip and returns the state of the modal | diff --git a/src/index.js b/src/index.js index 3f45312..15d4042 100644 --- a/src/index.js +++ b/src/index.js @@ -437,6 +437,7 @@ class PopoverTooltip extends React.PureComponent { } else { this.openModal(); } + return this.state.isModalOpen; } } From 232685980cb381625468fcbeba53cb7da918b697 Mon Sep 17 00:00:00 2001 From: Madeeha Hasan Date: Mon, 22 Jan 2018 12:38:20 +0500 Subject: [PATCH 2/2] tooltip position on x axis handled --- src/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/index.js b/src/index.js index 15d4042..c0ccf12 100644 --- a/src/index.js +++ b/src/index.js @@ -179,6 +179,10 @@ class PopoverTooltip extends React.PureComponent { ? pageY - tooltipContainerHeight - 20 : pageY + tooltipContainerHeight - 20; let tooltipTriangleDown = this.state.tooltipTriangleDown; + + if( tooltipContainerX_final < 0 ) { + tooltipContainerX_final = 0; + } if (pageY - tooltipContainerHeight - 20 < 0) { tooltipContainerY_final = pageY + height + 20; tooltipTriangleDown = false;