From 81694ec2427d31c9a4ebd189b4c60bd574f7089d Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Thu, 22 Nov 2018 15:01:45 +0100 Subject: [PATCH] autoSelect props in Input component --- src/components/inputs/Input/index.js | 3 +++ src/views/Wallet/views/Account/Receive/index.js | 1 + 2 files changed, 4 insertions(+) diff --git a/src/components/inputs/Input/index.js b/src/components/inputs/Input/index.js index 4262efb6..cf296bf2 100644 --- a/src/components/inputs/Input/index.js +++ b/src/components/inputs/Input/index.js @@ -185,6 +185,7 @@ class Input extends PureComponent { value={this.props.value} readOnly={this.props.readOnly} onChange={this.props.onChange} + onClick={this.props.autoSelect ? event => event.target.select() : null} borderColor={this.getColor(this.props.state)} disabled={this.props.isDisabled} name={this.props.name} @@ -220,6 +221,7 @@ Input.propTypes = { spellCheck: PropTypes.string, value: PropTypes.string, readOnly: PropTypes.bool, + autoSelect: PropTypes.bool, onChange: PropTypes.func, state: PropTypes.string, bottomText: PropTypes.string, @@ -233,6 +235,7 @@ Input.propTypes = { Input.defaultProps = { type: 'text', + autoSelect: false, }; export default Input; diff --git a/src/views/Wallet/views/Account/Receive/index.js b/src/views/Wallet/views/Account/Receive/index.js index 8befe6f1..755fcb43 100644 --- a/src/views/Wallet/views/Account/Receive/index.js +++ b/src/views/Wallet/views/Account/Receive/index.js @@ -121,6 +121,7 @@ const AccountReceive = (props: Props) => {