Skip to content

Commit add21c0

Browse files
committed
feat(Container): support onActivate callback
1 parent fef0ff7 commit add21c0

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/Container/index.tsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323

2424
interface Props extends React.HTMLAttributes<HTMLDivElement> {
2525
vertical?: boolean;
26+
onActivate?: () => void;
2627
beforeApplyResizer?: (resizer: Resizer) => void;
2728
afterResizing?: () => void;
2829
}
@@ -122,11 +123,19 @@ class Container extends React.PureComponent<Props> {
122123
}
123124

124125
private monitorBarStatusChanges({ type }: BarActionScanResult) {
125-
if (
126-
type === BarActionType.DEACTIVATE &&
127-
typeof this.props.afterResizing === 'function'
128-
) {
129-
this.props.afterResizing();
126+
switch (type) {
127+
case BarActionType.ACTIVATE:
128+
if (typeof this.props.onActivate === 'function') {
129+
this.props.onActivate();
130+
}
131+
return;
132+
case BarActionType.DEACTIVATE:
133+
if (typeof this.props.afterResizing === 'function') {
134+
this.props.afterResizing();
135+
}
136+
return;
137+
default:
138+
return;
130139
}
131140
}
132141

0 commit comments

Comments
 (0)