rats-search/src/app/component.js
Alexey Kasyanchuk fd4ba2c392 fix eslint
2018-06-18 00:06:28 +03:00

33 lines
948 B
JavaScript

import React, { Component } from 'react';
import { listenSwipe, removeSwipeListener } from './touch'
export default class BTComponent extends Component {
componentDidMount() {
// Свайп действия
if(
this.props.onSwipeLeft ||
this.props.onSwipeRight ||
this.props.onSwipeTop ||
this.props.onSwipeBottom ||
this.onSwipeLeft ||
this.onSwipeRight ||
this.onSwipeTop ||
this.onSwipeBottom
)
{
this.swipeFunctions = listenSwipe(this, {
left: this.props.onSwipeLeft || this.onSwipeLeft,
right: this.props.onSwipeRight || this.onSwipeRight,
top: this.props.onSwipeTop || this.onSwipeTop,
bottom: this.props.onSwipeBottom || this.onSwipeBottom,
initSwipe: this.props.initSwipe || this.initSwipe,
});
}
}
componentWillUnmount() {
if(this.swipeFunctions)
{
removeSwipeListener(this, this.swipeFunctions);
}
}
}