-
Notifications
You must be signed in to change notification settings - Fork 734
SortableGridList - Order items by index #3171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
const onOrderChange = jest.fn(); | ||
const renderTree = render(<Testcase onOrderChange={onOrderChange} orderItemsByIndex/>); | ||
const driverItem = useDraggableDriver(useComponentDriver({renderTree, testID: itemsTestId('0')})); | ||
driverItem.drag(150); // Items height is 50 but dragging 100 doesn't work for some reason. 150 works and drags one row down. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to create a driver
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what the calculation for the drag is. I used 150 because it worked but I don't know If I can make a driver that will be correct for all cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can look at SortableListItem.driver.new.ts
; even if it's not perfect, it's better than nothing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the SortableListItem
we have a default height for the items so its easy to calculate. Also the widths here are calculated based on the props. I don't really think we need to invest much time in this currently tbh. We can come back to this some other time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've added tests, so it seems logical to add a driver...
We will probably never have time to refactor this...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll probably get to this if the component is used more
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you intent to measure usage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Channel bugs and questions i guess
const onOrderChange = jest.fn(); | ||
const renderTree = render(<TestCase onOrderChange={onOrderChange} orderByIndex/>); | ||
const driverItem = useDraggableDriver(useComponentDriver({renderTree, testID: itemsTestId('0')})); | ||
driverItem.drag(150); // Items height is 50 but dragging 100 doesn't work for some reason. 150 works and drags one row down. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drag(300)
also "works" - any idea why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No 🤷🏻♂️
Description
Added option for SortableGridList to reorder the items by their index (instead of by replacing locations).
Changelog
SortableGridList - New prop orderByIndex. adds support for reordering by index.
Additional info
MADS-4277