react-draggable-tab
react-draggable-tab copied to clipboard
onDrag override?
In the documentation it is mentioned that
All other props like onXX handler set to Tab will be passed to rendered element except onClick You can use any onXX for Supported events for tab element.
I wanted a way to override onDrag
to make the tabs undraggable and noticed that I was getting no response to that event. Is it supported? Is there another way you'd suggest to disable dragging?
Drag event is handled on wrapper component so there are no drag event on displaying li
element.
https://github.com/georgeOsdDev/react-draggable-tab/blob/master/src/components/Tabs.js#L482
And this is main feature of this component.
If you want to disable dragging tab position change,
You can overwrite Tabs
as your component like below.
https://gist.github.com/georgeOsdDev/f86a0e81c59a97f8579eb85365a2b4ca
Follow up question - Is there any way to disable dragging for a single tab?
I notice the disableDrag property on <Tabs>
, but it does not meet my use case.
I only want the first tab to be anchored, and all others draggable. Any ideas on how I can make that happen?
Thanks for any help.
@thisisbrianm
For now, disableDrag
is prop of Tabs
,
We can enable change that as prop of Tab
. I'm welcome your PR.
https://github.com/georgeOsdDev/react-draggable-tab/pull/81 https://github.com/georgeOsdDev/react-draggable-tab/blob/master/src/components/Tabs.js#L481