devbookhq / splitter

React component for building split views like in VS Code
https://usedevbook.com
MIT License
435 stars 29 forks source link

No working Inside react bootstrap tab #22

Closed jeevasusej closed 1 year ago

jeevasusej commented 1 year ago

If I implemented this splitter inside react bootstrap tab, on tab change, I am getting the following issue.

Cannot set initial sizes - parent has undefined size

jeevasusej commented 1 year ago

I am not sure. The following code helped me to solve the issue.

function initialSetup() {
  if (!state.isReady) return;
  if (childRefs.current && !(childRefs.current[0] as any).offsetParent)
    return;

Reference - https://stackoverflow.com/questions/19669786/check-if-element-is-visible-in-dom

mlejva commented 1 year ago

I don't know what's "react bootstrap tab". Can you provide an example on Replit/CodeSandbox/etc so I could reproduce the issue?

mlejva commented 1 year ago

Closing for inactivity

myklt commented 1 year ago

Hi - it is actually pretty easy to reproduce the issue just by setting the parent component display: none. You can try it here https://codesandbox.io/s/devbookhq-spliiter-example-forked-7dkwy0?file=/src/App.tsx . Should I open a new issue or you could reopen this one to fix?