Skip to content

Commit

Permalink
Use es6+ class property for default props for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
sbycrosz committed Dec 26, 2016
1 parent b6351ed commit 5d7a538
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 37 deletions.
52 changes: 26 additions & 26 deletions src/CreditCardInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,32 @@ export default class CreditCardInput extends Component {
allowScroll: PropTypes.bool,
};

static defaultProps = {
cardViewSize: {},
labels: {
name: "CARDHOLDER'S NAME",
number: "CARD NUMBER",
expiry: "EXPIRY",
cvc: "CVC/CCV",
postalCode: "POSTAL CODE",
},
placeholders: {
name: "Full Name",
number: "1234 5678 1234 5678",
expiry: "MM/YY",
cvc: "CVC",
postalCode: "34567",
},
inputContainerStyle: {
borderBottomWidth: 1,
borderBottomColor: "black",
},
validColor: "",
invalidColor: "red",
placeholderColor: "gray",
allowScroll: false,
};

componentDidMount = () => this._focus(this.props.focused);

componentWillReceiveProps = newProps => {
Expand Down Expand Up @@ -150,29 +176,3 @@ export default class CreditCardInput extends Component {
);
}
}

CreditCardInput.defaultProps = {
cardViewSize: {},
labels: {
name: "CARDHOLDER'S NAME",
number: "CARD NUMBER",
expiry: "EXPIRY",
cvc: "CVC/CCV",
postalCode: "POSTAL CODE",
},
placeholders: {
name: "Full Name",
number: "1234 5678 1234 5678",
expiry: "MM/YY",
cvc: "CVC",
postalCode: "34567",
},
inputContainerStyle: {
borderBottomWidth: 1,
borderBottomColor: "black",
},
validColor: "",
invalidColor: "red",
placeholderColor: "gray",
allowScroll: false,
};
22 changes: 11 additions & 11 deletions src/LiteCreditCardInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@ export default class LiteCreditCardInput extends Component {
placeholderColor: PropTypes.string,
};

static defaultProps = {
placeholders: {
number: "1234 5678 1234 5678",
expiry: "MM/YY",
cvc: "CVC",
},
validColor: "",
invalidColor: "red",
placeholderColor: "gray",
};

componentDidMount = () => this._focus(this.props.focused);

componentWillReceiveProps = newProps => {
Expand Down Expand Up @@ -160,14 +171,3 @@ export default class LiteCreditCardInput extends Component {
);
}
}

LiteCreditCardInput.defaultProps = {
placeholders: {
number: "1234 5678 1234 5678",
expiry: "MM/YY",
cvc: "CVC",
},
validColor: "",
invalidColor: "red",
placeholderColor: "gray",
};

0 comments on commit 5d7a538

Please sign in to comment.