Closed sujitykulkarni closed 4 years ago
Canvas.Wrapper passes a ref
to your custom component, which you should forward to the DOM component inside your CustomCanvas component:
export const CustomCanvas = React.forwardRef(
(props: ICanvasOuterDefaultProps, ref: React.Ref<HTMLDivElement>) => (
<div
ref={ref}
style={{
background: "red"
}}
/>
)
)
This ref is used in Canvas.Wrapper to determine the size and position of the canvas.
I created a custom outer canvas in a separate component file. (And I am not using
styled-component
package)and passing it as a
CanvasOuter
property ofComponents
prop of theFlowChart
in another component file like thiswhich does not load the FlowChart throws this error
Working: https://codesandbox.io/s/react-flow-chart-poc-2bcze
What could be gone wrong?