Commit 9310e0f0 authored by AFOC-1709091830\echou's avatar AFOC-1709091830\echou

refactor

parent 951c7386
...@@ -2,7 +2,7 @@ import * as React from "react"; ...@@ -2,7 +2,7 @@ import * as React from "react";
import styled from "styled-components"; import styled from "styled-components";
export interface PullDownContentProps { export interface PullDownContentProps {
height?: number; height?: string;
background?: any; background?: any;
label?: string; label?: string;
} }
......
...@@ -51,6 +51,10 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef ...@@ -51,6 +51,10 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef
} }
public componentDidMount(): void { public componentDidMount(): void {
if (!this.container) {
return;
}
this.container.addEventListener("touchstart", this.onTouchStart); this.container.addEventListener("touchstart", this.onTouchStart);
this.container.addEventListener("touchmove", this.onTouchMove); this.container.addEventListener("touchmove", this.onTouchMove);
this.container.addEventListener("touchend", this.onEnd); this.container.addEventListener("touchend", this.onEnd);
...@@ -60,6 +64,10 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef ...@@ -60,6 +64,10 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef
} }
public componentWillUnmount(): void { public componentWillUnmount(): void {
if (!this.container) {
return;
}
this.container.removeEventListener("touchstart", this.onTouchStart); this.container.removeEventListener("touchstart", this.onTouchStart);
this.container.removeEventListener("touchmove", this.onTouchMove); this.container.removeEventListener("touchmove", this.onTouchMove);
this.container.removeEventListener("touchend", this.onEnd); this.container.removeEventListener("touchend", this.onEnd);
......
...@@ -2,7 +2,7 @@ import * as React from "react"; ...@@ -2,7 +2,7 @@ import * as React from "react";
import styled from "styled-components"; import styled from "styled-components";
export interface RefreshContentProps { export interface RefreshContentProps {
height?: number; height?: string;
background?: any; background?: any;
} }
......
...@@ -2,7 +2,7 @@ import * as React from "react"; ...@@ -2,7 +2,7 @@ import * as React from "react";
import styled from "styled-components"; import styled from "styled-components";
export interface ReleaseContentProps { export interface ReleaseContentProps {
height?: number; height?: string;
background?: any; background?: any;
label?: string; label?: string;
} }
......
import {PullToRefresh} from "./PullToRefresh"; import {PullToRefresh} from "./components/PullToRefresh";
import {RefreshContent} from "./components/RefreshContent"; import {RefreshContent} from "./components/RefreshContent";
import {PullDownContent} from "./components/PullDownContent"; import {PullDownContent} from "./components/PullDownContent";
import {ReleaseContent} from "./components/ReleaseContent"; import {ReleaseContent} from "./components/ReleaseContent";
......
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