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..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; @@ -437,6 +441,7 @@ class PopoverTooltip extends React.PureComponent { } else { this.openModal(); } + return this.state.isModalOpen; } }