From e2f973e35e7e329b3f012ca79744a4745ad200f9 Mon Sep 17 00:00:00 2001 From: Aron Helser Date: Thu, 3 Jan 2019 15:56:05 -0500 Subject: [PATCH] fix(event): expose the original event to `afterShow` and `afterHide` Originally contributed by cjzcpsyx , add docs and reformat commit message. --- README.md | 4 ++-- src/index.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 572742c3..e69e9012 100644 --- a/README.md +++ b/README.md @@ -71,8 +71,8 @@ className | data-class | String | | extra custom class, can use !importan insecure | null | Bool | true, false | Whether to inject the style header into the page dynamically (violates CSP style-src but is a convenient default) border | data-border | Bool | true, false | Add one pixel white border getContent | null | Func or Array | (dataTip) => {}, [(dataTip) => {}, Interval] | Generate the tip content dynamically - afterShow | null | Func | () => {} | Function that will be called after tooltip show - afterHide | null | Func | () => {} | Function that will be called after tooltip hide + afterShow | null | Func | (evt) => {} | Function that will be called after tooltip show, with event that triggered show + afterHide | null | Func | (evt) => {} | Function that will be called after tooltip hide, with event that triggered hide disable | data-tip-disable | Bool | true, false | Disable the tooltip behaviour, default is false scrollHide | data-scroll-hide | Bool | true, false | Hide the tooltip when scrolling, default is true resizeHide | null | Bool | true, false | Hide the tooltip when resizing the window, default is true diff --git a/src/index.js b/src/index.js index 88305a0e..fb32612a 100644 --- a/src/index.js +++ b/src/index.js @@ -389,7 +389,7 @@ class ReactTooltip extends React.Component { show: true }, () => { this.updatePosition() - if (isInvisible && afterShow) afterShow() + if (isInvisible && afterShow) afterShow(e) }) } } @@ -450,7 +450,7 @@ class ReactTooltip extends React.Component { show: false }, () => { this.removeScrollListener() - if (isVisible && afterHide) afterHide() + if (isVisible && afterHide) afterHide(e) }) }