frontend-collective / frontend-collective/react-sortable-tree

Drag not working in mobile browser

Open
#847 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5k
Forks
914
PR merge metrics
No merged PRs in 30d

Description

I am using the sortableTree for a project to manage the order of layers on a map. It works great in browsers with mouse interactions, however on a mobile phone in a chrome browser it fails to work. I can get the node to be picked up and the placeHolder is set in it's place but it will not drag at all or move. Basically it just disappears and doesn't return unless I touch the original location that now has the placeHolder. I am attaching a gif to show you the exact issue. The code is quite simple and like i said works perfectly in browsers with mouse interaction.
![drag_example](https://user-images.githubusercontent.com/1868821/102509260-f447c080-404b-11eb-8272-ef1e41eb0585.gif)

```
this.setState({ treeData })}
onMoveNode={this.orderLayers}
rowHeight={90}
/>
```
```
orderLayers = (s) => {
let layer_order = s.treeData.map((l, i) => {
return l.title.props.children[0].props.name;
});

this.state.mapRef.getLayers().forEach((customLyr) => {
customLyr.setZIndex(layer_order.indexOf(customLyr.get("id")));
});
};
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.