如何在React Native中使用Expo Go创建具有拖放功能的交互式列表?

huangapple go评论81阅读模式
英文:

How can I create an interactive list with drag-and-drop functionality in React Native with Expo Go?

问题

我正在寻求在我的React Native应用中实现一个列表,允许用户通过拖动上下移动项目来有效地改变列表的顺序。我尝试了几个npm包,但似乎都不起作用,或者不适用于最新的版本。有人可以建议一种在React Native中使用Expo Go创建可拖动列表的方法吗?我尝试了不同的方法,但还没有找到解决方法。任何帮助将不胜感激。谢谢!

英文:

I'm looking to implement a list in my React Native app that allows users to rearrange items by dragging them up and down, effectively changing the order of the list. I've tried several npm packages, but none seem to work or are outdated for the latest versions. Can anyone suggest a way to create a draggable list in React Native with Expo Go? I've tried different approaches, but haven't been able to figure it out. Any help would be appreciated. Thanks!

答案1

得分: 1

你可以尝试使用 react-native-draglist:https://github.com/fivecar/react-native-draglist

这个包是react-native-draggable-flatlist的基本版本,除了reactreact-native之外没有任何依赖项。具体来说,它特意构建为避免使用react-native-reanimated及其悬挂/崩溃问题。

它在以下方面存在限制:

  • 它的动画不太流畅(尽管它使用了本地驱动程序)
  • 它只处理垂直列表(尽管在PR中添加水平列表不难)
英文:

You can try react-native-draglist : https://github.com/fivecar/react-native-draglist

This package is a basic version of react-native-draggable-flatlist without dependencies on anything except react and react-native. Specifically, it is deliberately built to avoid react-native-reanimated and its hanging/crashing issues.

It is limited in the following ways:

  • It does not animate as smoothly (though it does useNativeDriver)
  • It only handles vertical lists (though adding horizontal in a PR won't be hard)

huangapple
  • 本文由 发表于 2023年4月13日 16:40:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/76003392.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定