-
Notifications
You must be signed in to change notification settings - Fork 9
/
Tooltip.js
43 lines (37 loc) · 970 Bytes
/
Tooltip.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import PropTypes from 'prop-types';
import React from 'react';
import InnerTooltip from 'reactstrap/lib/Tooltip';
export default class Tooltip extends React.Component {
static propTypes = {
...InnerTooltip.propTypes,
isOpen: PropTypes.bool
};
static defaultProps = {
...InnerTooltip.defaultProps,
isOpen: false,
fade: false
};
state = {
isOpen: this.props.isOpen
};
toggle = () => this.setState({
isOpen: !this.state.isOpen
});
render() {
const { isOpen, ...props } = this.props; // eslint-disable-line no-unused-vars
return (
<InnerTooltip
isOpen={this.state.isOpen}
toggle={this.toggle}
{...props}
// This is a workaround for the reactstrap Tooltip memory leak issue.
// https://github.com/reactstrap/reactstrap/issues/1482#issuecomment-498747688
modifiers={{
flip: {
enabled: false,
},
}}
/>
);
}
}