Write binding for compound component

Hi every one. I want to write binding for “react-modal-sheet” but I don’t know how to write binding for the types that this component exports.


This answer may not be complete, but should help get you started.

// import { Splitter, SplitterPanel } from 'primereact/splitter';
// https://primereact.org/splitter/#api.Splitter.SplitterResizeEndEvent
type on_resize_end = ({ "sizes":array<int> }) => ()
@module("primereact/splitter") @react.component external make: (
    ~style:{"height": string, "width": string},
    // ~stateKey:string,
    // ~stateStorage:string,
    // ~onResizeEnd:on_resize_end,
) => React.element = "Splitter"

You don’t need to write the types for everything (as you can see I’m commenting out parts that I wanted to stop having to provide values for, since they are optional on the JS side).

And then using the component:

<Splitter style={{ "height": "700px", "width": "1400px" }} layout="horizontal">
   ...children components
</ Splitt>