Replies: 1 comment
|
Here's a video of what I mean Screen.Recording.2026-06-25.at.12.00.06.AM.mov |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
What I'm building
A sortable list whose data is a flat array interleaving section-header rows and item rows (think portfolio "segments", each holding "constituents"). I'm on the sortable API —
useSortableList+SortableContainer+SortableItem(equivalentlyDraxList), v1.1.0. On drop I map the reordered flat order back to sections by walking it: each header opens a group, each item joins the current group.Minimal shape that mirrors mine:
Order is top→bottom; each section header owns the items until the next header.
seg:energyhas no items beneath it.Only items are draggable (via a drag handle); section headers stay put. The first section is marked
fixedas a barrier so an item can't be dragged above it.Question 1 — dropping into an empty section
An empty section (e.g.
seg:energyabove) is a single header row with no item slot beneath it. What's the recommended way to let a user drop an item into an empty section, so the reorder places it immediately after that header (→ it becomes that section's first item)?With
onDragPositionChange, hovering the empty header resolvestoIndexto the header's own slot, which is ambiguous — it ends up landing the item in the previous section. Is there a supported pattern for "drop into an empty group"?Because the empty section is a single header row, hovering it makes
onDragPositionChangereport slot A (the header's own index), so the item lands back in Tech instead of Energy.Question 2 — live "which section is the drag over" feedback
While dragging, I'd like to drive UI for the section the item would land in (highlight it / fade a placeholder) — ideally on the UI thread via a
SharedValue, without re-rendering the list.Which signal is intended for this in a sortable list?
onDragPositionChange(maptoIndex→ section), oronReceiveDragEnter/onReceiveDragExiton the section rows, oronMonitorDragOver(+monitorOffsetRatio)?When I tried per-header
onReceiveDragEnter/Exit, I got glitches whenever the receive state changed a header's layout/height mid-drag (drops then snap back) — I assume because slot boundaries are measured from the original layout. So I'm unsure of the intended approach.Environment: react-native-drax 1.1.0 (sortable API), React Native + Reanimated.
Thanks!
All reactions