File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,8 @@ class ReactTooltip extends Component {
3737 eventOff : PropTypes . string ,
3838 watchWindow : PropTypes . bool ,
3939 isCapture : PropTypes . bool ,
40- globalEventOff : PropTypes . string
40+ globalEventOff : PropTypes . string ,
41+ getContent : PropTypes . func
4142 }
4243
4344 constructor ( props ) {
@@ -165,10 +166,18 @@ class ReactTooltip extends Component {
165166 showTooltip ( e ) {
166167 // Get the tooltip content
167168 // calculate in this phrase so that tip width height can be detected
168- const { children, multiline} = this . props
169+ const { children, multiline, getContent } = this . props
169170 const originTooltip = e . currentTarget . getAttribute ( 'data-tip' )
170171 const isMultiline = e . currentTarget . getAttribute ( 'data-multiline' ) || multiline || false
171- const placeholder = getTipContent ( originTooltip , children , isMultiline )
172+
173+ let content
174+ if ( children ) {
175+ content = children
176+ } else if ( getContent ) {
177+ content = getContent ( )
178+ }
179+
180+ const placeholder = getTipContent ( originTooltip , content , isMultiline )
172181
173182 this . setState ( {
174183 placeholder,
You can’t perform that action at this time.
0 commit comments