Skip to content

Commit

Permalink
Merge pull request #8145 from Tushu17/remove-max-length
Browse files Browse the repository at this point in the history
remove character counter
  • Loading branch information
mountiny authored Mar 16, 2022
2 parents 7919e24 + eaeba0e commit c30e95f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 25 deletions.
3 changes: 1 addition & 2 deletions src/components/InlineErrorText.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [],
};

Expand Down
27 changes: 4 additions & 23 deletions src/components/TextInput/BaseTextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -287,27 +286,9 @@ class BaseTextInput extends Component {
</View>
</TouchableWithoutFeedback>
</View>
{(!_.isEmpty(inputHelpText) || !_.isNull(this.props.maxLength)) && (
<View
style={[
styles.mt1,
styles.flexRow,
styles.justifyContentBetween,
styles.ph3,
]}
>
{!_.isEmpty(inputHelpText) && (
<Text style={[formHelpStyles]}>{inputHelpText}</Text>
)}
{!_.isNull(this.props.maxLength) && (
<Text style={[formHelpStyles, styles.flex1, styles.textAlignRight]}>
{this.state.value.length}
/
{this.props.maxLength}
</Text>
)}
</View>
)}
<InlineErrorText styles={[styles.ph3]}>
{this.props.errorText}
</InlineErrorText>
</View>
{/*
Text input component doesn't support auto grow by default.
Expand Down

0 comments on commit c30e95f

Please sign in to comment.