反应-原生-活化-dnd-web
跨平台兼容软件包 react-native-reanimated-dnd。 。 。 .
- 原产地进口通过上游包装.
- 网络导入决心到此软件包的 React Introduct Web 指针事件适配器 .
- Expo SDK 57 与 Expo 默认 Babel 配置合作;不需要明确的再动或工作板插件.
安装
对于Expo SDK 57,安装包和由Expo支持的动画堆:
bunx expo install react-native-gesture-handler react-native-reanimated react-native-worklets
bun add @ankhorage/react-native-reanimated-dnd-web
经验证的SDK 57矩阵是"博览会" 57.0.15,"反应19.2.3","反应原住民"0.86.2,"反应", 反应原生网络0.21.2,手掌机2.32.0,再动4.5.1和Worklets0.10.1. 不在 Expo 57 Babel 配置中添加一个明确的再激活或 Worklets 变换插件 。 这个 软件包不需要 Worklets 捆绑模式.
使用量
import { Draggable, Droppable, DropProvider } from '@ankhorage/react-native-reanimated-dnd-web';
export function DragAndDrop() {
return (
<DropProvider>
<Droppable onDrop={(item) => console.log(item)}>
<Draggable data={{ id: 'item-1' }}>{/* React Native content */}</Draggable>
</Droppable>
</DropProvider>
);
}
选择缓冲器 dist/index.native.js 反应原生和 dist/index.web.js 用于网络。 见
WEB_SUPPORT.md 行为证据和故意的网络疏漏.
兼容合同
原生依赖链需要回放"原生"0.80+,"手柄"2.28+,"再生" 4.2+,以及工作室0.7+. 平台对等方在此包装边框仍然可选, 所以只使用网络 消费者可以在不导入本地动画运行时间的情况下使用自有适配器.