Commit 1d64d891 authored by Carlos's avatar Carlos

remove core-decorators

parent 691e9fdb
import * as React from "react"; import * as React from "react";
import {autobind} from "core-decorators";
export interface PullToRefreshProps { export interface PullToRefreshProps {
pullDownContent: JSX.Element; pullDownContent: JSX.Element;
...@@ -18,19 +17,13 @@ export interface PullToRefreshState { ...@@ -18,19 +17,13 @@ export interface PullToRefreshState {
export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRefreshState> { export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRefreshState> {
private container: any; private container: any;
@autobind
private containerRef(container) { private containerRef(container) {
this.container = container; this.container = container;
} }
private pullTag: any;
@autobind
private pullTagRef(pullTag) {
this.pullTag = pullTag;
}
private pullDown: any; private pullDown: any;
@autobind
private pullDownRef(pullDown) { private pullDownRef(pullDown) {
this.pullDown = pullDown; this.pullDown = pullDown;
const maxPullDownDistance = this.pullDown && this.pullDown.firstChild && this.pullDown.firstChild["getBoundingClientRect"] const maxPullDownDistance = this.pullDown && this.pullDown.firstChild && this.pullDown.firstChild["getBoundingClientRect"]
...@@ -49,6 +42,12 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef ...@@ -49,6 +42,12 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef
maxPullDownDistance: 0, maxPullDownDistance: 0,
onRefreshing: false, onRefreshing: false,
}; };
this.containerRef = this.containerRef.bind(this);
this.pullDownRef = this.pullDownRef.bind(this);
this.onTouchStart = this.onTouchStart.bind(this);
this.onTouchMove = this.onTouchMove.bind(this);
this.onEnd = this.onEnd.bind(this);
} }
public componentDidMount(): void { public componentDidMount(): void {
...@@ -77,7 +76,6 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef ...@@ -77,7 +76,6 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef
this.container.removeEventListener("mouseup", this.onEnd); this.container.removeEventListener("mouseup", this.onEnd);
} }
@autobind
private onTouchStart(e) { private onTouchStart(e) {
this.startY = e["pageY"] || e.touches[0].pageY; this.startY = e["pageY"] || e.touches[0].pageY;
this.currentY = this.startY; this.currentY = this.startY;
...@@ -91,7 +89,6 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef ...@@ -91,7 +89,6 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef
this.pullDown.style.transition = "transform 0.2s cubic-bezier(0,0,0.31,1)"; this.pullDown.style.transition = "transform 0.2s cubic-bezier(0,0,0.31,1)";
} }
@autobind
private onTouchMove(e) { private onTouchMove(e) {
if (!this.dragging) { if (!this.dragging) {
return; return;
...@@ -118,7 +115,6 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef ...@@ -118,7 +115,6 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef
this.container.style.transform = `translate(0px, ${this.currentY - this.startY}px)`; this.container.style.transform = `translate(0px, ${this.currentY - this.startY}px)`;
} }
@autobind
private onEnd() { private onEnd() {
this.dragging = false; this.dragging = false;
this.startY = 0; this.startY = 0;
...@@ -146,11 +142,6 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef ...@@ -146,11 +142,6 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef
}); });
} }
@autobind
private stopScroll(e) {
e.preventDefault();
}
private initContainer() { private initContainer() {
requestAnimationFrame(() => { requestAnimationFrame(() => {
if (this.container) { if (this.container) {
......
...@@ -18,11 +18,6 @@ ...@@ -18,11 +18,6 @@
esutils "^2.0.2" esutils "^2.0.2"
js-tokens "^4.0.0" js-tokens "^4.0.0"
"@types/core-decorators@^0.10.32":
version "0.10.32"
resolved "https://registry.yarnpkg.com/@types/core-decorators/-/core-decorators-0.10.32.tgz#3cb635da99980176832ec420875f7efce1822b5e"
integrity sha1-PLY12pmYAXaDLsQgh19+/OGCK14=
"@types/jest@^23.3.5": "@types/jest@^23.3.5":
version "23.3.5" version "23.3.5"
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-23.3.5.tgz#870a1434208b60603745bfd214fc3fc675142364" resolved "https://registry.yarnpkg.com/@types/jest/-/jest-23.3.5.tgz#870a1434208b60603745bfd214fc3fc675142364"
...@@ -1238,11 +1233,6 @@ copy-descriptor@^0.1.0: ...@@ -1238,11 +1233,6 @@ copy-descriptor@^0.1.0:
resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d"
integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=
core-decorators@^0.20.0:
version "0.20.0"
resolved "https://registry.yarnpkg.com/core-decorators/-/core-decorators-0.20.0.tgz#605896624053af8c28efbe735c25a301a61c65c5"
integrity sha1-YFiWYkBTr4wo775zXCWjAaYcZcU=
core-js@^2.4.0, core-js@^2.5.0: core-js@^2.4.0, core-js@^2.5.0:
version "2.5.7" version "2.5.7"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.7.tgz#f972608ff0cead68b841a16a932d0b183791814e" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.7.tgz#f972608ff0cead68b841a16a932d0b183791814e"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment