StephenChou1017 / react-big-scheduler

A scheduler and resource planning component built for React and made for modern browsers (IE10+)
https://stephenchou1017.github.io/scheduler/#/
MIT License
746 stars 415 forks source link

Selection doesnt work when Scheduler is wrapped with Tabs #214

Open udielenberg opened 3 years ago

udielenberg commented 3 years ago

Context

Im working Material-UI's Tabs, Tab. and with react-swipeable-views to create swipe effects when moving between tabs My Scheduler is taking place in multiple tabs.

This is my tree structure

<div>
  <Tabs value={currentTab}>
    <Tab label="tab 1"/> 
    <Tab label="tab 2"/>
  <Tabs>
<SwipableViews index={currentTab}>
   <Scheduler ... />
</SwipableViews>
</div>

UI

This is my Scheudler: image

Issue

1st tab works fine.

But the `Scheduler in the 2nd tab stuck, and doesnt let selecting ranges. it auto select the first slot.

image

While debugging I see this in ResourceEvents.js under stopDrag function:

var endTime = resourceEvents.headerItems[rightIndex - 1].end;

where rightIndex is equal to -24 (negative index)

I think this happens because of the SwipableViews styles which push the 2nd tab to a different x,y position on the screen.

Is there's a way to reset the computation of the Scheduler position, and play nice with other libs that messes with the DOM?