diff --git a/js/src/modals/SMSVerification/GatherData/gatherData.js b/js/src/modals/SMSVerification/GatherData/gatherData.js index fa24e04e5..f4036a3bc 100644 --- a/js/src/modals/SMSVerification/GatherData/gatherData.js +++ b/js/src/modals/SMSVerification/GatherData/gatherData.js @@ -15,6 +15,7 @@ // along with Parity. If not, see . import React, { Component, PropTypes } from 'react'; +import nullable from '../../../util/nullable-proptype'; import BigNumber from 'bignumber.js'; import { Checkbox } from 'material-ui'; import InfoIcon from 'material-ui/svg-icons/action/info-outline'; @@ -27,8 +28,6 @@ import { Form, Input } from '../../../ui'; import terms from '../terms-of-service'; import styles from './gatherData.css'; -const nullable = (type) => PropTypes.oneOfType([ PropTypes.oneOf([ null ]), type ]); - export default class GatherData extends Component { static propTypes = { fee: React.PropTypes.instanceOf(BigNumber), diff --git a/js/src/modals/SMSVerification/SendConfirmation/sendConfirmation.js b/js/src/modals/SMSVerification/SendConfirmation/sendConfirmation.js index b6d4f3dca..a3c8e3e18 100644 --- a/js/src/modals/SMSVerification/SendConfirmation/sendConfirmation.js +++ b/js/src/modals/SMSVerification/SendConfirmation/sendConfirmation.js @@ -15,6 +15,7 @@ // along with Parity. If not, see . import React, { Component, PropTypes } from 'react'; +import nullable from '../../../util/nullable-proptype'; import TxHash from '../../../ui/TxHash'; import { @@ -23,9 +24,6 @@ import { import styles from './sendConfirmation.css'; -// TODO: move this to a better place -const nullable = (type) => PropTypes.oneOfType([ PropTypes.oneOf([ null ]), type ]); - export default class SendConfirmation extends Component { static propTypes = { step: PropTypes.any.isRequired, diff --git a/js/src/modals/SMSVerification/SendRequest/sendRequest.js b/js/src/modals/SMSVerification/SendRequest/sendRequest.js index 31190f628..6f9a6077f 100644 --- a/js/src/modals/SMSVerification/SendRequest/sendRequest.js +++ b/js/src/modals/SMSVerification/SendRequest/sendRequest.js @@ -15,6 +15,7 @@ // along with Parity. If not, see . import React, { Component, PropTypes } from 'react'; +import nullable from '../../../util/nullable-proptype'; import TxHash from '../../../ui/TxHash'; import { @@ -23,9 +24,6 @@ import { import styles from './sendRequest.css'; -// TODO: move this to a better place -const nullable = (type) => PropTypes.oneOfType([ PropTypes.oneOf([ null ]), type ]); - export default class SendRequest extends Component { static propTypes = { step: PropTypes.any.isRequired, diff --git a/js/src/util/nullable-proptype.js b/js/src/util/nullable-proptype.js new file mode 100644 index 000000000..331be6c18 --- /dev/null +++ b/js/src/util/nullable-proptype.js @@ -0,0 +1,21 @@ +// Copyright 2015, 2016 Ethcore (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import { PropTypes } from 'react'; + +export default function (type) { + return PropTypes.oneOfType([ PropTypes.oneOf([ null ]), type ]); +} diff --git a/js/src/views/Signer/components/SignRequest/SignRequest.js b/js/src/views/Signer/components/SignRequest/SignRequest.js index 395bc2c7f..719ddeec9 100644 --- a/js/src/views/Signer/components/SignRequest/SignRequest.js +++ b/js/src/views/Signer/components/SignRequest/SignRequest.js @@ -15,6 +15,7 @@ // along with Parity. If not, see . import React, { Component, PropTypes } from 'react'; +import nullable from '../../../../util/nullable-proptype'; import Account from '../Account'; import TransactionPendingForm from '../TransactionPendingForm'; @@ -22,8 +23,6 @@ import TxHashLink from '../TxHashLink'; import styles from './SignRequest.css'; -const nullable = (type) => React.PropTypes.oneOfType([ React.PropTypes.oneOf([ null ]), type ]); - export default class SignRequest extends Component { static contextTypes = { api: PropTypes.object diff --git a/js/src/views/Signer/components/TransactionFinished/TransactionFinished.js b/js/src/views/Signer/components/TransactionFinished/TransactionFinished.js index 08ed1f7ed..00d6a057f 100644 --- a/js/src/views/Signer/components/TransactionFinished/TransactionFinished.js +++ b/js/src/views/Signer/components/TransactionFinished/TransactionFinished.js @@ -15,6 +15,7 @@ // along with Parity. If not, see . import React, { Component, PropTypes } from 'react'; +import nullable from '../../../../util/nullable-proptype'; import CircularProgress from 'material-ui/CircularProgress'; @@ -29,8 +30,6 @@ import styles from './TransactionFinished.css'; import * as tUtil from '../util/transaction'; import { capitalize } from '../util/util'; -const nullable = (type) => React.PropTypes.oneOfType([ React.PropTypes.oneOf([ null ]), type ]); - export default class TransactionFinished extends Component { static contextTypes = { api: PropTypes.object.isRequired