Update the ListWidget on list container render.

To recalculate the desired size of the scroll-bar thumb.

arduino/arduino-pro-ide#101

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
Akos Kitta 2019-11-13 13:55:27 +01:00
parent fdda4a72d0
commit 7e6343e60e
2 changed files with 12 additions and 0 deletions

View File

@ -26,6 +26,12 @@ export class FilterableListContainer<T extends ArduinoComponent> extends React.C
this.props.filterTextChangeEvent(this.handleFilterTextChange.bind(this));
}
componentDidUpdate(): void {
// See: arduino/arduino-pro-ide#101
// Resets the top of the perfect scroll-bar's thumb.
this.props.container.updateScrollBar();
}
render(): React.ReactNode {
this.props.container.update(); // This will recalculate the desired dimension of the scroll-bar thumb. (See: arduino/arduino-pro-ide#101)
return <div className={'filterable-list-container'}>

View File

@ -76,6 +76,12 @@ export abstract class ListWidget<T extends ArduinoComponent> extends ReactWidget
this.deferredContainer.promise.then(() => this.filterTextChangeEmitter.fire(filterText));
}
updateScrollBar(): void {
if (this.scrollBar) {
this.scrollBar.update();
}
}
}
export namespace ListWidget {