Structure to drag Items between Lists and Items into other Items
See original GitHub issueFirst off, thanks for creating this, it’s the best I’ve been able to find!
I’m using a DraxList to render a list of DraxViews. When I set the ‘dragPayload’ property of the DraxView to be dragged, it causes the drag style of the component to change. The DraxView looks correct when I leave out the property. Any ideas why this would be?
Pushes View with buttons down to next row when dragging:
const renderItem = (item) => {
return (
<DraxView style={styles.alphaItem} **dragPayload={item.id}**>
<View>
<Text category="s1">{item.name}</Text>
<Text category="c2" appearence="hint">
{item.description}
</Text>
</View>
<View style={styles.buttons}>
<Button size="small" status="success" appearance="ghost" accessoryLeft={RefreshIcon} />
<Button size="small" status="primary" appearance="ghost" accessoryLeft={ExpandIcon} />
</View>
</DraxView>
);
};
Renders correctly when dragging without dragPayload property:
const renderItem = (item) => {
return (
<DraxView style={styles.alphaItem}>
<View>
<Text category="s1">{item.name}</Text>
<Text category="c2" appearence="hint">
{item.description}
</Text>
</View>
<View style={styles.buttons}>
<Button size="small" status="success" appearance="ghost" accessoryLeft={RefreshIcon} />
<Button size="small" status="primary" appearance="ghost" accessoryLeft={ExpandIcon} />
</View>
</DraxView>
);
};
};
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:6 (3 by maintainers)
Top Results From Across the Web
SharePoint Online: Moving items between lists - TechNet
On selecting the list, all list items will be displayed on the right. Select the items we want to move from the selected...
Read more >Dragging list rows between sections | Apple Developer Forums
I am making an iPhone-first app which has a 2 level data structure. I want the user to be able to drag List...
Read more >Building Complex Nested Drag and Drop User Interfaces With ...
Our goal is to build a feature where users can drag an item from a sidebar and drop it into the main layout....
Read more >Make a Sortable List With Draggable Items Using JavaScript
We can get the index of both dragging and draggedOver , which we can use to shift the items around. This is done...
Read more >Designing a reorderable list component - Darin Senneff
Users can press-and-hold on an element, which they can then "drag" around the interface, then finally "drop" it into a new location by...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sorry, @rahulreghunath, that feature does not yet exist, as I mentioned here: https://github.com/nuclearpasta/react-native-drax/issues/75#issuecomment-776051879 and in #71
Thank you for the kind words. I’ll start this reply with my standard apology for the state of maintenance of this library right now. Personal circumstances have not afforded me the time to do any deep work on Drax for a while, and I am not fresh on the code. I have a Drax logic documentation project in progress but presently on hold. The goal with that is to make it easier for myself and others to maintain the library without accidentally breaking or changing functionality. I do however keep an eye on the issues and try to answer things off the top of my head if I am able.
All that said, briefly looking into the above, I wonder where/how you are using this
renderItem
function. As I recall looking at the code,DraxList
creates its ownrenderItem
for its underlyingFlatList
, which it needs to do because it creates its own payloads for managing the list reordering functionality.DraxList
does however honorrenderItemContent
andrenderHoverItemContent
properties for modifying the rendering of the items as they are dragged.If you want to have a list of
DraxViews
with custom payloads that can be dragged into other receivers, you probably need to use aDraxScrollView
and roll your own list, but you would lose the list reordering functionality. Right now, at least off the top of my head, I don’t think theDraxList
offers a way to support custom payloads. This seems like it would be tangentially related to #71 and that I’d want to roll both of those features into enhancement work, but I cannot predict when I’ll have the time to go that deep.