mattermost-mobile/app/components/tooltip.js
Jesse Hallam 58b72302d6 update eslint's comma-dangle rule to always-multiline (#1457)
* update eslint's `comma-dangle` rule to `always-multiline`

* add check and fix scripts to package.json

* Invoke `yarn fix` to adopt the updated eslint rules. No other changes are included.
2018-02-23 09:06:02 -05:00

52 lines
1.2 KiB
JavaScript

// Copyright (c) 2018-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import RNToolTip from 'react-native-tooltip';
import {setToolTipVisible} from 'app/utils/tooltip';
export default class ToolTip extends PureComponent {
static propTypes = {
onHide: PropTypes.func,
onShow: PropTypes.func,
};
handleHide = () => {
if (this.props.onHide) {
this.props.onHide();
}
setToolTipVisible(false);
};
handleShow = () => {
if (this.props.onShow) {
this.props.onShow();
}
setToolTipVisible();
};
hideMenu = () => {
if (this.refs.toolTip) {
this.refs.toolTip.hideMenu();
}
};
showMenu = () => {
if (this.refs.toolTip) {
this.refs.toolTip.showMenu();
}
};
render() {
return (
<RNToolTip
{...this.props}
onHide={this.handleHide}
onShow={this.handleShow}
ref='toolTip'
/>
);
}
}