feat: init react views with container size

This commit is contained in:
mathuo 2021-03-29 20:44:03 +01:00
parent cea4dcffc0
commit 0533073e1d
4 changed files with 12 additions and 0 deletions

View File

@ -137,6 +137,9 @@ export const DockviewReact = React.forwardRef(
domRef.current?.appendChild(dockview.element);
dockview.deserializer = new ReactPanelDeserialzier(dockview);
const { clientWidth, clientHeight } = domRef.current!;
dockview.layout(clientWidth, clientHeight);
if (props.onReady) {
props.onReady({ api: new DockviewApi(dockview) });
}

View File

@ -82,6 +82,9 @@ export const GridviewReact = React.forwardRef(
domRef.current?.appendChild(gridview.element);
const { clientWidth, clientHeight } = domRef.current!;
gridview.layout(clientWidth, clientHeight);
if (props.onReady) {
props.onReady({ api: new GridviewApi(gridview) });
}

View File

@ -79,6 +79,9 @@ export const PaneviewReact = React.forwardRef(
},
});
const { clientWidth, clientHeight } = domRef.current!;
paneview.layout(clientWidth, clientHeight);
if (props.onReady) {
props.onReady({ api: new PaneviewApi(paneview) });
}

View File

@ -77,6 +77,9 @@ export const SplitviewReact = React.forwardRef(
: undefined,
});
const { clientWidth, clientHeight } = domRef.current!;
splitview.layout(clientWidth, clientHeight);
if (props.onReady) {
props.onReady({ api: new SplitviewApi(splitview) });
}