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
c29c9110
Commit
c29c9110
authored
Oct 12, 2018
by
Carlos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PullToRefresh: set backgroundColor as optional
parent
f881710a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
17 additions
and
5 deletions
+17
-5
.gitignore
.gitignore
+1
-0
__tests__/components/PullToRefresh.spec.tsx
__tests__/components/PullToRefresh.spec.tsx
+1
-0
__tests__/components/__snapshots__/PullToRefresh.spec.tsx.snap
...ts__/components/__snapshots__/PullToRefresh.spec.tsx.snap
+2
-0
examples/Basic.tsx
examples/Basic.tsx
+1
-0
jestconfig.json
jestconfig.json
+3
-0
package.json
package.json
+3
-5
src/components/PullToRefresh.tsx
src/components/PullToRefresh.tsx
+6
-0
No files found.
.gitignore
View file @
c29c9110
.idea
.idea
dist
dist
node_modules
node_modules
yarn-error.log
__tests__/components/PullToRefresh.spec.tsx
View file @
c29c9110
...
@@ -14,6 +14,7 @@ describe("PullToRefresh spec", () => {
...
@@ -14,6 +14,7 @@ describe("PullToRefresh spec", () => {
releaseContent=
{
<
div
>
Release to refresh
</
div
>
}
releaseContent=
{
<
div
>
Release to refresh
</
div
>
}
refreshContent=
{
<
div
>
Refreshing
</
div
>
}
refreshContent=
{
<
div
>
Refreshing
</
div
>
}
pullDownThreshold=
{
200
}
pullDownThreshold=
{
200
}
backgroundColor=
"white"
>
>
<
div
>
Test
</
div
>
<
div
>
Test
</
div
>
</
PullToRefresh
>
</
PullToRefresh
>
...
...
__tests__/components/__snapshots__/PullToRefresh.spec.tsx.snap
View file @
c29c9110
...
@@ -5,6 +5,7 @@ exports[`PullToRefresh spec App shows PullToRefresh 1`] = `
...
@@ -5,6 +5,7 @@ exports[`PullToRefresh spec App shows PullToRefresh 1`] = `
style={
style={
Object {
Object {
"WebkitOverflowScrolling": "touch",
"WebkitOverflowScrolling": "touch",
"backgroundColor": "white",
"height": "auto",
"height": "auto",
"overflow": "hidden",
"overflow": "hidden",
"position": "relative",
"position": "relative",
...
@@ -31,6 +32,7 @@ exports[`PullToRefresh spec App shows PullToRefresh 1`] = `
...
@@ -31,6 +32,7 @@ exports[`PullToRefresh spec App shows PullToRefresh 1`] = `
style={
style={
Object {
Object {
"WebkitOverflowScrolling": "touch",
"WebkitOverflowScrolling": "touch",
"backgroundColor": "white",
"height": "auto",
"height": "auto",
"overflow": "hidden",
"overflow": "hidden",
"position": "relative",
"position": "relative",
...
...
examples/Basic.tsx
View file @
c29c9110
...
@@ -24,6 +24,7 @@ export class Basic extends React.Component<BasicProps, BasicState> {
...
@@ -24,6 +24,7 @@ export class Basic extends React.Component<BasicProps, BasicState> {
refreshContent=
{
<
RefreshContent
/>
}
refreshContent=
{
<
RefreshContent
/>
}
pullDownThreshold=
{
200
}
pullDownThreshold=
{
200
}
onRefresh=
{
this
.
onRefresh
}
onRefresh=
{
this
.
onRefresh
}
backgroundColor=
"white"
>
>
<
Container
>
<
Container
>
<
Label
>
PullToRefresh
</
Label
>
<
Label
>
PullToRefresh
</
Label
>
...
...
jestconfig.json
View file @
c29c9110
...
@@ -3,6 +3,9 @@
...
@@ -3,6 +3,9 @@
"^.+\\.tsx?$"
:
"ts-jest"
"^.+\\.tsx?$"
:
"ts-jest"
},
},
"testRegex"
:
"(/__tests__/.*|
\\
.(test|spec))
\\
.(ts|tsx)$"
,
"testRegex"
:
"(/__tests__/.*|
\\
.(test|spec))
\\
.(ts|tsx)$"
,
"testPathIgnorePatterns"
:
[
"dist"
],
"coverageReporters"
:
[
"coverageReporters"
:
[
"html"
,
"html"
,
"json"
,
"json"
,
...
...
package.json
View file @
c29c9110
...
@@ -6,11 +6,9 @@
...
@@ -6,11 +6,9 @@
"typings"
:
"./dist/src/index.d.ts"
,
"typings"
:
"./dist/src/index.d.ts"
,
"scripts"
:
{
"scripts"
:
{
"dev"
:
"webpack-dev-server"
,
"dev"
:
"webpack-dev-server"
,
"lint"
:
"tslint --project ."
,
"pretest"
:
"rimraf dist && tslint --project . && tsc -p ."
,
"clean"
:
"rimraf dist"
,
"test"
:
"jest --config=jestconfig.json"
,
"tsc"
:
"npm run clean && tsc -p ."
,
"prepublish"
:
"npm test"
"test"
:
"rimraf dist && npm run lint && jest --config=jestconfig.json"
,
"prepublish"
:
"npm test && npm run tsc"
},
},
"repository"
:
{
"repository"
:
{
"type"
:
"git"
,
"type"
:
"git"
,
...
...
src/components/PullToRefresh.tsx
View file @
c29c9110
...
@@ -7,6 +7,7 @@ export interface PullToRefreshProps {
...
@@ -7,6 +7,7 @@ export interface PullToRefreshProps {
refreshContent
:
JSX
.
Element
;
refreshContent
:
JSX
.
Element
;
pullDownThreshold
:
number
;
pullDownThreshold
:
number
;
onRefresh
:
()
=>
Promise
<
any
>
;
onRefresh
:
()
=>
Promise
<
any
>
;
backgroundColor
?:
string
;
}
}
export
interface
PullToRefreshState
{
export
interface
PullToRefreshState
{
...
@@ -178,6 +179,7 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef
...
@@ -178,6 +179,7 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef
}
}
public
render
()
{
public
render
()
{
const
{
backgroundColor
}
=
this
.
props
;
const
containerStyle
:
React
.
CSSProperties
=
{
const
containerStyle
:
React
.
CSSProperties
=
{
height
:
"
auto
"
,
height
:
"
auto
"
,
overflow
:
"
hidden
"
,
overflow
:
"
hidden
"
,
...
@@ -186,6 +188,10 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef
...
@@ -186,6 +188,10 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef
zIndex
:
1
,
zIndex
:
1
,
};
};
if
(
backgroundColor
)
{
containerStyle
.
backgroundColor
=
backgroundColor
;
}
return
(
return
(
<
div
style=
{
containerStyle
}
>
<
div
style=
{
containerStyle
}
>
{
this
.
renderPullDownContent
()
}
{
this
.
renderPullDownContent
()
}
...
...
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