mattermost-mobile/app/components/drawer.js
enahum dabad3eca6 Improving Performance Part 1 (#1009)
* Dispatch retry failed action | fix refreshing state | change postVisibility to 15

* Improve channel switching

* Improve handling of visible tooltip

* Improve watching for status bar height changes

* Remove unnecessary mapStateToProps from code screen

* Use drawer native functions to open/close instead of state

* Feedback review
2017-10-11 14:33:26 -03:00

36 lines
1.1 KiB
JavaScript

// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import PropTypes from 'prop-types';
import BaseDrawer from 'react-native-drawer';
// Extends react-native-drawer to allow better control over the open/closed state from the parent
export default class Drawer extends BaseDrawer {
static propTypes = {
...BaseDrawer.propTypes,
onRequestClose: PropTypes.func.isRequired
};
// To fix the android onLayout issue give this a value of 100% as it does not need another one
getMainHeight = () => '100%';
processTapGestures = () => {
// Note that we explicitly don't support tap to open or double tap because I didn't copy them over
if (this._activeTween) { // eslint-disable-line no-underscore-dangle
return false;
}
if (this.props.tapToClose && this._open) { // eslint-disable-line no-underscore-dangle
this.props.onRequestClose();
return true;
}
return false;
};
isOpened = () => {
return this._open; // eslint-disable-line no-underscore-dangle
}
}