Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
R
react-pull-to-refresh
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jason.yap
react-pull-to-refresh
Commits
74367f12
Commit
74367f12
authored
Dec 21, 2017
by
李勇諭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve pull ux
parent
c79bf47c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
+18
-4
src/PullToRefresh.tsx
src/PullToRefresh.tsx
+18
-4
No files found.
src/PullToRefresh.tsx
View file @
74367f12
...
...
@@ -22,6 +22,12 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef
this
.
container
=
container
;
}
private
pullTag
:
any
;
@
autobind
private
pullTagRef
(
pullTag
)
{
this
.
pullTag
=
pullTag
;
}
private
pullDown
:
any
;
@
autobind
private
pullDownRef
(
pullDown
)
{
...
...
@@ -45,19 +51,19 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef
}
public
componentDidMount
():
void
{
this
.
container
.
addEventListener
(
"
touchstart
"
,
this
.
onTouchStart
);
this
.
pullTag
.
addEventListener
(
"
touchstart
"
,
this
.
onTouchStart
);
this
.
container
.
addEventListener
(
"
touchmove
"
,
this
.
onTouchMove
);
this
.
container
.
addEventListener
(
"
touchend
"
,
this
.
onEnd
);
this
.
container
.
addEventListener
(
"
mousedown
"
,
this
.
onTouchStart
);
this
.
pullTag
.
addEventListener
(
"
mousedown
"
,
this
.
onTouchStart
);
this
.
container
.
addEventListener
(
"
mousemove
"
,
this
.
onTouchMove
);
this
.
container
.
addEventListener
(
"
mouseup
"
,
this
.
onEnd
);
}
public
componentWillUnmount
():
void
{
this
.
container
.
removeEventListener
(
"
touchstart
"
,
this
.
onTouchStart
);
this
.
pullTag
.
removeEventListener
(
"
touchstart
"
,
this
.
onTouchStart
);
this
.
container
.
removeEventListener
(
"
touchmove
"
,
this
.
onTouchMove
);
this
.
container
.
removeEventListener
(
"
touchend
"
,
this
.
onEnd
);
this
.
container
.
removeEventListener
(
"
mousedown
"
,
this
.
onTouchStart
);
this
.
pullTag
.
removeEventListener
(
"
mousedown
"
,
this
.
onTouchStart
);
this
.
container
.
removeEventListener
(
"
mousemove
"
,
this
.
onTouchMove
);
this
.
container
.
removeEventListener
(
"
mouseup
"
,
this
.
onEnd
);
}
...
...
@@ -160,10 +166,18 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef
backgroundColor
:
"
white
"
,
};
const
pullHiddenTagStyle
:
React
.
CSSProperties
=
{
height
:
"
50px
"
,
width
:
"
100%
"
,
position
:
"
absolute
"
,
top
:
0
,
};
return
(
<
div
style=
{
containerStyle
}
>
{
this
.
renderPullDownContent
()
}
<
div
ref=
{
this
.
containerRef
}
style=
{
containerStyle
}
>
<
div
ref=
{
this
.
pullTagRef
}
style=
{
pullHiddenTagStyle
}
/>
{
this
.
props
.
children
}
</
div
>
</
div
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment