Open LindaJuffermans opened 1 year ago
Same here
In my case it was because i was using react-split-pan
instead of split-pane-react
...
Maybe you need to add sashRender paras like this: https://codesandbox.io/s/split-pane-themes-xmsqtt And u can use the default like this: https://github.com/yyllff/split-pane-react/issues/12#issuecomment-1357527567
I guess it's a bug in the definition of the children
property of ISashContentProps
Instead of declaring it as type JSX.Element[]
it should also support other types e.g. a single element.
Using React with Typescript, children
is normally defined as being of type ReactNode
see e.g. https://blog.logrocket.com/react-children-prop-typescript/
FYI I too get the error in the OP if I try to compile this code using TypeScript.
The code in question is in (and copied from) the themes demo e.g.:
That demo is a .jsx file not a .tsx file.
I worked-around this problem by using the normal typescript instead of trying to use a theme, and instead adding some CSS to get something looking like the "line" style.
sashRender={(_, active) => <SashContent active={active} type="vscode"></SashContent>}
and
.split-sash-content.split-sash-content-vscode {
background-color: rgb(200,200,200);
width: 2px;
}
.split-sash-content.split-sash-content-vscode.split-sash-content-active {
width: 100%;
}
I'm trying to use this in a Next w/Typescript project:
Typescript complains about the span element:
Do I need to add anything to allow the element or is this a bug in split-pane-react? On the interface, I see children is defined as JSX.Element[]