react-draggable-tab icon indicating copy to clipboard operation
react-draggable-tab copied to clipboard

onDrag override?

Open davey-h opened this issue 8 years ago • 3 comments

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?

davey-h avatar Jun 06 '16 20:06 davey-h

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

georgeOsdDev avatar Jun 07 '16 10:06 georgeOsdDev

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 avatar Nov 17 '16 21:11 thisisbrianm

@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

georgeOsdDev avatar Nov 18 '16 02:11 georgeOsdDev