Skip to content

Commit

Permalink
Revert "fix(ZNTA-2313): enforce maxLength on Textarea component"
Browse files Browse the repository at this point in the history
This reverts commit 7d5cabf.
  • Loading branch information
efloden committed Feb 25, 2018
1 parent 7d5cabf commit ffc85ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
Expand Up @@ -80,7 +80,8 @@ class RejectionsForm extends Component {
isCommentRequired: checked
}))
}
onTextChange = text => {
onTextChange = e => {
const text = e.target.value
this.setState(_prevState => ({
description: text
}))
Expand Down Expand Up @@ -146,7 +147,7 @@ class RejectionsForm extends Component {
<FormGroup className='u-flexGrow1' controlId='formInlineCriteria'>
<ControlLabel>Criteria</ControlLabel><br />
<TextInput multiline editable={isAdminMode || commentRequired}
type='text' numberOfLines={2} onChangeText={this.onTextChange}
type='text' numberOfLines={2} onChange={this.onTextChange}
placeholder={criteriaPlaceholder} maxLength={255}
value={this.state.description} />
</FormGroup>
Expand Down
10 changes: 3 additions & 7 deletions server/zanata-frontend/src/app/components/TextInput/index.js
Expand Up @@ -112,13 +112,9 @@ class TextInput extends Component {
}

_onChange = (e) => {
const {onChange, onChangeText, maxLength} = this.props
const textValue = e.target.value
const limitText = (textValue.length > maxLength)
? textValue.slice(0, maxLength)
: textValue
if (onChangeText) onChangeText(limitText)
if (onChange && (textValue.length > maxLength)) onChange(e)
const {onChange, onChangeText} = this.props
if (onChangeText) onChangeText(e.target.value)
if (onChange) onChange(e)
}

_onFocus = (e) => {
Expand Down

0 comments on commit ffc85ae

Please sign in to comment.