From 5d7a538ab237a612600b02f5cdc57328541e2cdd Mon Sep 17 00:00:00 2001 From: Sam Aryasa Date: Mon, 26 Dec 2016 23:42:46 +0800 Subject: [PATCH] Use es6+ class property for default props for consistency --- src/CreditCardInput.js | 52 +++++++++++++++++++------------------- src/LiteCreditCardInput.js | 22 ++++++++-------- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/CreditCardInput.js b/src/CreditCardInput.js index 3ae03049..fac5b406 100644 --- a/src/CreditCardInput.js +++ b/src/CreditCardInput.js @@ -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 => { @@ -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, -}; diff --git a/src/LiteCreditCardInput.js b/src/LiteCreditCardInput.js index 80fdfb4c..7071d757 100644 --- a/src/LiteCreditCardInput.js +++ b/src/LiteCreditCardInput.js @@ -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 => { @@ -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", -};