From 2cd34afcdb6a9c64e6d705e74dc7c692937738e3 Mon Sep 17 00:00:00 2001 From: Tushu17 Date: Tue, 15 Mar 2022 02:52:26 +0530 Subject: [PATCH 1/4] remove character counter --- src/components/TextInput/BaseTextInput.js | 27 +++++------------------ 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/src/components/TextInput/BaseTextInput.js b/src/components/TextInput/BaseTextInput.js index 87dae0aff7da..56f123bfbba0 100644 --- a/src/components/TextInput/BaseTextInput.js +++ b/src/components/TextInput/BaseTextInput.js @@ -11,6 +11,7 @@ import themeColors from '../../styles/themes/default'; import styles from '../../styles/styles'; import Icon from '../Icon'; import * as Expensicons from '../Icon/Expensicons'; +import InlineErrorText from '../InlineErrorText' import Text from '../Text'; import * as styleConst from './styleConst'; import * as StyleUtils from '../../styles/StyleUtils'; @@ -187,8 +188,6 @@ class BaseTextInput extends Component { // eslint-disable-next-line react/forbid-foreign-prop-types const inputProps = _.omit(this.props, _.keys(baseTextInputPropTypes.propTypes)); const hasLabel = Boolean(this.props.label.length); - const inputHelpText = this.props.errorText || this.props.hint; - const formHelpStyles = this.props.errorText ? styles.formError : styles.formHelp; const placeholder = (this.props.prefixCharacter || this.state.isFocused || !hasLabel || (hasLabel && this.props.forceActiveLabel)) ? this.props.placeholder : null; const textInputContainerStyles = _.reduce([ styles.textInputContainer, @@ -287,26 +286,10 @@ class BaseTextInput extends Component { - {(!_.isEmpty(inputHelpText) || !_.isNull(this.props.maxLength)) && ( - - {!_.isEmpty(inputHelpText) && ( - {inputHelpText} - )} - {!_.isNull(this.props.maxLength) && ( - - {this.state.value.length} - / - {this.props.maxLength} - - )} - + {!_.isEmpty(this.props.errorText) && ( + + {this.props.errorText} + )} {/* From 1574792962e35b50bb6976421ee7f2121372562d Mon Sep 17 00:00:00 2001 From: Tushu17 Date: Tue, 15 Mar 2022 03:17:01 +0530 Subject: [PATCH 2/4] add semicolon --- src/components/TextInput/BaseTextInput.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/TextInput/BaseTextInput.js b/src/components/TextInput/BaseTextInput.js index 56f123bfbba0..0b7ac667b6c3 100644 --- a/src/components/TextInput/BaseTextInput.js +++ b/src/components/TextInput/BaseTextInput.js @@ -11,7 +11,7 @@ import themeColors from '../../styles/themes/default'; import styles from '../../styles/styles'; import Icon from '../Icon'; import * as Expensicons from '../Icon/Expensicons'; -import InlineErrorText from '../InlineErrorText' +import InlineErrorText from '../InlineErrorText'; import Text from '../Text'; import * as styleConst from './styleConst'; import * as StyleUtils from '../../styles/StyleUtils'; From 4113d7d5c269e198e470968a15c849ac320c3e11 Mon Sep 17 00:00:00 2001 From: Tushu17 Date: Tue, 15 Mar 2022 21:51:15 +0530 Subject: [PATCH 3/4] remove condition --- src/components/TextInput/BaseTextInput.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/TextInput/BaseTextInput.js b/src/components/TextInput/BaseTextInput.js index 0b7ac667b6c3..9e2693f2d333 100644 --- a/src/components/TextInput/BaseTextInput.js +++ b/src/components/TextInput/BaseTextInput.js @@ -286,11 +286,9 @@ class BaseTextInput extends Component { - {!_.isEmpty(this.props.errorText) && ( - - {this.props.errorText} - - )} + + {this.props.errorText} + {/* Text input component doesn't support auto grow by default. From eaeba0e51f23d4490c34deedaaafa517b3a259b6 Mon Sep 17 00:00:00 2001 From: Tushu17 Date: Wed, 16 Mar 2022 21:28:35 +0530 Subject: [PATCH 4/4] remove default prop --- src/components/InlineErrorText.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/InlineErrorText.js b/src/components/InlineErrorText.js index d77a5c4aacee..8f6f705329f4 100644 --- a/src/components/InlineErrorText.js +++ b/src/components/InlineErrorText.js @@ -6,14 +6,13 @@ import Text from './Text'; const propTypes = { /** Text to display */ - children: PropTypes.string, + children: PropTypes.string.isRequired, /** Styling for inline error text */ styles: PropTypes.arrayOf(PropTypes.object), }; const defaultProps = { - children: 'Error', styles: [], };