Skip to content

Commit 7789079

Browse files
author
Marco Cesarato
committed
feat: add placeholder and placeholderTextColor props
1 parent c1412cf commit 7789079

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,8 @@ class InputSpinner extends Component {
225225
} else {
226226
value = String(this.parseNum(value));
227227
}
228-
return value.replace(
228+
let hasPlaceholder = value === "0" && !this.isStringEmpty(this.props.placeholder);
229+
return hasPlaceholder ? "" : value.replace(
229230
".",
230231
!this.isStringEmpty(this.props.decimalSeparator)
231232
? this.props.decimalSeparator
@@ -811,6 +812,8 @@ class InputSpinner extends Component {
811812
ref={(input) => (this.textInput = input)}
812813
style={this._getInputTextStyle()}
813814
value={this.getValue()}
815+
placeholder={this.props.placeholder}
816+
placeholderTextColor={this.props.placeholderTextColor}
814817
selectionColor={this.props.selectionColor}
815818
selectTextOnFocus={this.props.selectTextOnFocus}
816819
returnKeyType={this.props.returnKeyType}
@@ -865,6 +868,8 @@ InputSpinner.propTypes = {
865868
editable: PropTypes.bool,
866869
autofocus: PropTypes.bool,
867870
selectTextOnFocus: PropTypes.bool,
871+
placeholder: PropTypes.string,
872+
placeholderTextColor: PropTypes.string,
868873
selectionColor: PropTypes.string,
869874
returnKeyLabel: PropTypes.string,
870875
returnKeyType: PropTypes.string,

0 commit comments

Comments
 (0)