Skip to content
Snippets Groups Projects
Commit ecaab513 authored by Alexander Rose's avatar Alexander Rose
Browse files

support update of props.initiallyCollapsed in CollapsableControls

parent 2a4d4571
No related branches found
No related tags found
No related merge requests found
/** /**
* Copyright (c) 2018-2019 mol* contributors, licensed under MIT, See LICENSE file for more info. * Copyright (c) 2018-2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
* *
* @author David Sehnal <david.sehnal@gmail.com> * @author David Sehnal <david.sehnal@gmail.com>
* @author Alexander Rose <alexander.rose@weirdbyte.de> * @author Alexander Rose <alexander.rose@weirdbyte.de>
...@@ -83,6 +83,12 @@ export abstract class CollapsableControls<P = {}, S = {}, SS = {}> extends Plugi ...@@ -83,6 +83,12 @@ export abstract class CollapsableControls<P = {}, S = {}, SS = {}> extends Plugi
this.setState({ isCollapsed: !this.state.isCollapsed } as (S & CollapsableState)) this.setState({ isCollapsed: !this.state.isCollapsed } as (S & CollapsableState))
} }
componentDidUpdate(prevProps: P & CollapsableProps) {
if(this.props.initiallyCollapsed !== undefined && prevProps.initiallyCollapsed !== this.props.initiallyCollapsed) {
this.setState({ isCollapsed: this.props.initiallyCollapsed as any });
}
}
protected abstract defaultState(): (S & CollapsableState) protected abstract defaultState(): (S & CollapsableState)
protected abstract renderControls(): JSX.Element | null protected abstract renderControls(): JSX.Element | null
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment