Commit c29c9110 authored by Carlos's avatar Carlos

PullToRefresh: set backgroundColor as optional

parent f881710a
.idea
dist
node_modules
yarn-error.log
......@@ -14,6 +14,7 @@ describe("PullToRefresh spec", () => {
releaseContent={<div>Release to refresh</div>}
refreshContent={<div>Refreshing</div>}
pullDownThreshold={200}
backgroundColor="white"
>
<div>Test</div>
</PullToRefresh>
......
......@@ -5,6 +5,7 @@ exports[`PullToRefresh spec App shows PullToRefresh 1`] = `
style={
Object {
"WebkitOverflowScrolling": "touch",
"backgroundColor": "white",
"height": "auto",
"overflow": "hidden",
"position": "relative",
......@@ -31,6 +32,7 @@ exports[`PullToRefresh spec App shows PullToRefresh 1`] = `
style={
Object {
"WebkitOverflowScrolling": "touch",
"backgroundColor": "white",
"height": "auto",
"overflow": "hidden",
"position": "relative",
......
......@@ -24,6 +24,7 @@ export class Basic extends React.Component<BasicProps, BasicState> {
refreshContent={<RefreshContent />}
pullDownThreshold={200}
onRefresh={this.onRefresh}
backgroundColor="white"
>
<Container>
<Label>PullToRefresh</Label>
......
......@@ -3,6 +3,9 @@
"^.+\\.tsx?$": "ts-jest"
},
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx)$",
"testPathIgnorePatterns": [
"dist"
],
"coverageReporters": [
"html",
"json",
......
......@@ -6,11 +6,9 @@
"typings": "./dist/src/index.d.ts",
"scripts": {
"dev": "webpack-dev-server",
"lint": "tslint --project .",
"clean": "rimraf dist",
"tsc": "npm run clean && tsc -p .",
"test": "rimraf dist && npm run lint && jest --config=jestconfig.json",
"prepublish": "npm test && npm run tsc"
"pretest": "rimraf dist && tslint --project . && tsc -p .",
"test": "jest --config=jestconfig.json",
"prepublish": "npm test"
},
"repository": {
"type": "git",
......
......@@ -7,6 +7,7 @@ export interface PullToRefreshProps {
refreshContent: JSX.Element;
pullDownThreshold: number;
onRefresh: () => Promise<any>;
backgroundColor?: string;
}
export interface PullToRefreshState {
......@@ -178,6 +179,7 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef
}
public render() {
const {backgroundColor} = this.props;
const containerStyle: React.CSSProperties = {
height: "auto",
overflow: "hidden",
......@@ -186,6 +188,10 @@ export class PullToRefresh extends React.Component<PullToRefreshProps, PullToRef
zIndex: 1,
};
if (backgroundColor) {
containerStyle.backgroundColor = backgroundColor;
}
return (
<div style={containerStyle}>
{this.renderPullDownContent()}
......
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