diff --git a/src/dzeio/Input/index.tsx b/src/dzeio/Input/index.tsx index 567537e..32b0426 100644 --- a/src/dzeio/Input/index.tsx +++ b/src/dzeio/Input/index.tsx @@ -170,9 +170,9 @@ export default class Input extends React.Component { )} - {this.props.autocomplete && this.props.autocomplete.indexOf(this.state?.value || '') === -1 && ( + {this.props.autocomplete && this.props.autocomplete.indexOf(this.state?.value ?? this.props.value?.toString() ?? '') === -1 && ( )} @@ -201,7 +201,7 @@ export default class Input extends React.Component { this.setState({textAreaHeight: this.inputRef.current.scrollHeight}) }) - private onAutoCompleteClick = (value: string) => () => { + private onAutoCompleteClick = (value: string) => async () => { // console.log('test') const item = this.getElement() if (!item) {return} @@ -216,6 +216,9 @@ export default class Input extends React.Component { valueSetter.call(item, value) } item.dispatchEvent(new Event('input', {bubbles: true})) + if (this.props.type === 'textarea') { + await this.parentScroll() + } } private onChange = async (event?: React.FormEvent) => {