diff --git a/src/Tooltip.js b/src/Tooltip.js index ade521f..53c3195 100644 --- a/src/Tooltip.js +++ b/src/Tooltip.js @@ -66,12 +66,22 @@ class Tooltip extends React.Component { }); }; + showTooltip = () => { + this.setState({ isVisible: true }); + } + + hideTooltip = () => { + this.setState({ isVisible: false }); + } + wrapWithAction = (actionType, children) => { switch (actionType) { case 'press': return ( @@ -82,6 +92,8 @@ class Tooltip extends React.Component { return ( @@ -173,7 +185,7 @@ class Tooltip extends React.Component { const { yOffset, xOffset, elementWidth, elementHeight } = this.state; const tooltipStyle = this.getTooltipStyle(); return ( - + { {withPointer && this.renderPointer(!tooltipStyle.top)} {popover} - + ); }; @@ -235,6 +247,8 @@ class Tooltip extends React.Component { {this.renderContent(true)} @@ -275,8 +289,8 @@ Tooltip.defaultProps = { containerStyle: {}, pointerStyle: {}, backgroundColor: '#617080', - onClose: () => {}, - onOpen: () => {}, + onClose: () => { }, + onOpen: () => { }, }; const styles = {