mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-16 09:02:24 +03:00
fixed #252
This commit is contained in:
parent
775a15f93b
commit
b0a0cd5db5
@ -38,12 +38,14 @@ export default class TagAreaView extends Component {
|
||||
|
||||
// Component Functions
|
||||
_handleOnChange = (text, i) => {
|
||||
const { chips } = this.state;
|
||||
|
||||
this.setState({
|
||||
currentText: text.replace(/\s/g, ''),
|
||||
});
|
||||
|
||||
if (text.indexOf(' ') > 0 && text) {
|
||||
this._handleTagAdded();
|
||||
this._handleTagAdded(chips[i] ? i : null);
|
||||
}
|
||||
if (!text && i !== 0) {
|
||||
this._handleTagRemove(i);
|
||||
@ -52,6 +54,7 @@ export default class TagAreaView extends Component {
|
||||
|
||||
_handleOnBlur = (i) => {
|
||||
this._handleTagAdded(i);
|
||||
this.setState({ activeChip: null });
|
||||
};
|
||||
|
||||
_handleTagAdded = (i = null, text = null) => {
|
||||
@ -64,8 +67,8 @@ export default class TagAreaView extends Component {
|
||||
currentText: '',
|
||||
});
|
||||
} else if (_currentText && chips && chips.length === chipsCount) {
|
||||
let _chips = chips;
|
||||
_chips[chipsCount -1] = currentText;
|
||||
const _chips = chips;
|
||||
_chips[chipsCount - 1] = currentText;
|
||||
this.setState({
|
||||
chips: _chips,
|
||||
currentText: null,
|
||||
@ -115,7 +118,9 @@ export default class TagAreaView extends Component {
|
||||
handleOnChange={text => this._handleOnChange(text, i)}
|
||||
handleOnBlur={() => this._handleOnBlur(i)}
|
||||
blurOnSubmit
|
||||
value={activeChip === i ? currentText : chip}
|
||||
value={
|
||||
activeChip === i ? currentText || chip.replace(/\s/g, '') : chip.replace(/\s/g, '')
|
||||
}
|
||||
autoCapitalize="none"
|
||||
onFocus={() => this.setState({ activeChip: i })}
|
||||
{...this.props}
|
||||
|
Loading…
Reference in New Issue
Block a user