React-beautiful-dnd: Limit dragging in x-axis or y-axis

Created on 26 Nov 2018  路  8Comments  路  Source: atlassian/react-beautiful-dnd

I'm trying to limit the dragging in x-axis,

I got this idea,

const getItemStyle = (isDragging, { transform, ...draggableStyle }) => {
  const styles = {
    boxShadow: isDragging ? '0 0 10px rgba(0, 0, 0, 0.11111)' : 'none',
    ...draggableStyle,
  };
  if (!transform) {
    return styles;
  }
  return ({
    ...styles,
    transform: `translate(0, ${transform.substring(transform.indexOf(',') + 1, transform.indexOf(')'))})`,
  });
};

But it has lots of performance issues, Does Anybody has idea?
Do you have a feature to do this, like a props or something?

Thanks for this great library.

wontfix 鈽狅笍

Most helpful comment

@alexreardon Way to force your thinking onto everyone and really limit the usability of this library

All 8 comments

Application 5: no drag axis locking

For now, the library does not support drag axis locking (aka drag rails). This is where the user is restricted to only dragging along one axis. The current thinking is this breaks the physical metaphor we are going for and sends a message to the user that they are interacting with a piece of software rather than moving physical objects around. It is possible to ensure that a user can only drop in a single list by using props type and isDropDisabled. You can also do some visual treatment to the list onDragStart to show the user that this is the only place they can interact with.

You are welcome to add this on top of the library as you are. However, there might be some rough edges.

I will close this as won't fix. However, other people are welcome to chat about this one 馃憤

Yes i want to know react dnd support dragging only in x-axis.
As my whole application is breaking while dragging through.

i am too need for support this

you can do something like above example, it's working correctly for me, however I think it has performance issue on long lists. @Haqverdi

you can do something like above example, it's working correctly for me, however I think it has performance issue on long lists. @Haqverdi

thanks, i will try

@alirezavalizade Any ideas on what might resolve (or at least reduce) the performance issues?

@alexreardon Way to force your thinking onto everyone and really limit the usability of this library

Was this page helpful?
0 / 5 - 0 ratings

Related issues

khurram-wasim picture khurram-wasim  路  3Comments

OmriAharon picture OmriAharon  路  3Comments

alexreardon picture alexreardon  路  3Comments

heymartinadams picture heymartinadams  路  3Comments

FutureKode picture FutureKode  路  3Comments