From d294c20a206bbbcf95a3e061c701cc66da36940a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pedro=20Ernesto=20Perdon=C3=A1=20Rech?=
Date: Thu, 23 May 2019 14:10:03 -0300
Subject: [PATCH] add placeholder
---
README.md | 1 +
src/index.js | 7 +++++--
test/index.spec.js | 1 +
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index fb6e96b..133dda4 100644
--- a/README.md
+++ b/README.md
@@ -134,5 +134,6 @@ selectAllOnFocus | false | Selects all text on focus or does not
prefix | '' | Currency prefix
suffix | '' | Currency suffix
autoFocus | false | Autofocus
+placeHolder | '' | Placeholder text
***Note:** Enabling any mask-related features such as prefix, suffix or separators with an inputType="number" or "tel" could trigger errors. Most of those characters would be invalid in such input types.
diff --git a/src/index.js b/src/index.js
index fa27abf..8ad60ae 100644
--- a/src/index.js
+++ b/src/index.js
@@ -263,6 +263,7 @@ class CurrencyInput extends Component {
onChange={this.handleChange}
onFocus={this.handleFocus}
onMouseUp={this.handleFocus}
+ placeholder={this.propsplaceHolder}
{...this.state.customProps}
/>
)
@@ -287,7 +288,8 @@ CurrencyInput.propTypes = {
allowEmpty: PropTypes.bool,
prefix: PropTypes.string,
suffix: PropTypes.string,
- selectAllOnFocus: PropTypes.bool
+ selectAllOnFocus: PropTypes.bool,
+ placeHolder: PropTypes.string
};
@@ -303,7 +305,8 @@ CurrencyInput.defaultProps = {
allowNegative: false,
prefix: '',
suffix: '',
- selectAllOnFocus: false
+ selectAllOnFocus: false,
+ placeHolder: '',
};
diff --git a/test/index.spec.js b/test/index.spec.js
index cbe41f0..c6ce100 100644
--- a/test/index.spec.js
+++ b/test/index.spec.js
@@ -53,6 +53,7 @@ describe('react-currency-input', function(){
value="123456789"
inputType="tel"
id="currencyInput"
+ placeHolder='placeHolderText'
autoFocus={true} />
);