From ed49e9b961b91ef3450596f6dc6a97bfb8ce86c3 Mon Sep 17 00:00:00 2001 From: Florian BOUILLON Date: Tue, 18 May 2021 15:01:16 +0200 Subject: [PATCH] Fixed some small bugs Signed-off-by: Florian BOUILLON --- src/dzeio/Input/index.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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 && (
    - {this.props.autocomplete.filter((item) => item.includes(this.state?.value || '')).map((item) => (
  • {item}
  • ))} + {this.props.autocomplete.filter((item) => item.includes(this.state?.value ?? this.props.value?.toString() ?? '')).map((item) => (
  • {item}
  • ))}
)} @@ -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) => {