Skip to content

Commit e2f973e

Browse files
committed
fix(event): expose the original event to afterShow and afterHide
Originally contributed by cjzcpsyx <Jianzhong Chen>, add docs and reformat commit message.
1 parent 07d48ef commit e2f973e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Diff for: README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ className | data-class | String | | extra custom class, can use !importan
7171
insecure | null | Bool | true, false | Whether to inject the style header into the page dynamically (violates CSP style-src but is a convenient default)
7272
border | data-border | Bool | true, false | Add one pixel white border
7373
getContent | null | Func or Array | (dataTip) => {}, [(dataTip) => {}, Interval] | Generate the tip content dynamically
74-
afterShow | null | Func | () => {} | Function that will be called after tooltip show
75-
afterHide | null | Func | () => {} | Function that will be called after tooltip hide
74+
afterShow | null | Func | (evt) => {} | Function that will be called after tooltip show, with event that triggered show
75+
afterHide | null | Func | (evt) => {} | Function that will be called after tooltip hide, with event that triggered hide
7676
disable | data-tip-disable | Bool | true, false | Disable the tooltip behaviour, default is false
7777
scrollHide | data-scroll-hide | Bool | true, false | Hide the tooltip when scrolling, default is true
7878
resizeHide | null | Bool | true, false | Hide the tooltip when resizing the window, default is true

Diff for: src/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ class ReactTooltip extends React.Component {
389389
show: true
390390
}, () => {
391391
this.updatePosition()
392-
if (isInvisible && afterShow) afterShow()
392+
if (isInvisible && afterShow) afterShow(e)
393393
})
394394
}
395395
}
@@ -450,7 +450,7 @@ class ReactTooltip extends React.Component {
450450
show: false
451451
}, () => {
452452
this.removeScrollListener()
453-
if (isVisible && afterHide) afterHide()
453+
if (isVisible && afterHide) afterHide(e)
454454
})
455455
}
456456

0 commit comments

Comments
 (0)