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
08c3f9bc
Commit
08c3f9bc
authored
Oct 28, 2018
by
Carlos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve #7
parent
64c0146e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
3 deletions
+7
-3
__tests__/components/PullToRefresh.spec.tsx
__tests__/components/PullToRefresh.spec.tsx
+1
-2
examples/Basic.tsx
examples/Basic.tsx
+1
-0
src/components/PullToRefresh.tsx
src/components/PullToRefresh.tsx
+4
-1
tslint.json
tslint.json
+1
-0
No files found.
__tests__/components/PullToRefresh.spec.tsx
View file @
08c3f9bc
/*tslint:disable no-implicit-dependencies*/
import
*
as
React
from
"
react
"
;
import
*
as
renderer
from
"
react-test-renderer
"
;
import
{
PullToRefresh
}
from
"
../../src/
"
;
...
...
@@ -14,6 +12,7 @@ describe("PullToRefresh spec", () => {
releaseContent=
{
<
div
>
Release to refresh
</
div
>
}
refreshContent=
{
<
div
>
Refreshing
</
div
>
}
pullDownThreshold=
{
200
}
triggerHeight=
{
100
}
backgroundColor=
"white"
>
<
div
>
Test
</
div
>
...
...
examples/Basic.tsx
View file @
08c3f9bc
...
...
@@ -23,6 +23,7 @@ export class Basic extends React.Component<BasicProps, BasicState> {
refreshContent=
{
<
RefreshContent
/>
}
pullDownThreshold=
{
200
}
onRefresh=
{
this
.
onRefresh
}
triggerHeight=
{
100
}
backgroundColor=
"white"
>
<
div
id=
"basic-container"
>
...
...
src/components/PullToRefresh.tsx
View file @
08c3f9bc
...
...
@@ -6,6 +6,7 @@ export interface PullToRefreshProps {
refreshContent
:
JSX
.
Element
;
pullDownThreshold
:
number
;
onRefresh
:
()
=>
Promise
<
any
>
;
triggerHeight
?:
number
;
backgroundColor
?:
string
;
}
...
...
@@ -77,10 +78,12 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef
}
private
onTouchStart
(
e
)
{
const
{
triggerHeight
=
40
}
=
this
.
props
;
this
.
startY
=
e
[
"
pageY
"
]
||
e
.
touches
[
0
].
pageY
;
this
.
currentY
=
this
.
startY
;
const
top
=
this
.
container
.
getBoundingClientRect
().
top
||
this
.
container
.
getBoundingClientRect
().
y
||
0
;
if
(
this
.
startY
-
top
>
40
)
{
console
.
log
(
"
this.startY - top
"
,
this
.
startY
-
top
,
triggerHeight
);
if
(
this
.
startY
-
top
>
triggerHeight
)
{
return
;
}
...
...
tslint.json
View file @
08c3f9bc
...
...
@@ -11,6 +11,7 @@
"no-unused-expression"
:
false
,
"no-duplicate-imports"
:
false
,
"no-trailing-whitespace"
:
false
,
"no-implicit-dependencies"
:
false
,
"jsx-no-multiline-js"
:
false
,
"jsx-boolean-value"
:
false
,
"no-object-literal-type-assertion"
:
false
,
...
...
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