Commit e04e2c62 authored by 李勇諭's avatar 李勇諭

support safari

parent cb5da6c6
...@@ -24,8 +24,8 @@ export class Basic extends React.Component<BasicProps, BasicState> { ...@@ -24,8 +24,8 @@ export class Basic extends React.Component<BasicProps, BasicState> {
pullDownThreshold={200} pullDownThreshold={200}
onRefresh={this.onRefresh} onRefresh={this.onRefresh}
> >
<div style={{height: "95vh", textAlign: "center"}}> <div style={{height: "150vh", textAlign: "center"}}>
<div onClick={console.log}>PullToRefresh</div> <div>PullToRefresh</div>
</div> </div>
</PullToRefresh> </PullToRefresh>
</div> </div>
......
...@@ -80,6 +80,7 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef ...@@ -80,6 +80,7 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef
this.dragging = true; this.dragging = true;
this.container.style.transition = "transform 0.2s cubic-bezier(0,0,0.31,1)"; this.container.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)"; this.pullDown.style.transition = "transform 0.2s cubic-bezier(0,0,0.31,1)";
e.preventDefault();
} }
@autobind @autobind
...@@ -93,6 +94,8 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef ...@@ -93,6 +94,8 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef
return; return;
} }
e.preventDefault();
if ((this.currentY - this.startY) >= this.props.pullDownThreshold) { if ((this.currentY - this.startY) >= this.props.pullDownThreshold) {
this.setState({ this.setState({
pullToRefreshThresholdBreached: true, pullToRefreshThresholdBreached: true,
...@@ -135,6 +138,11 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef ...@@ -135,6 +138,11 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef
}); });
} }
@autobind
private stopScroll(e) {
e.preventDefault();
}
private initContainer() { private initContainer() {
requestAnimationFrame(() => { requestAnimationFrame(() => {
this.container.style.overflow = "auto"; this.container.style.overflow = "auto";
......
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