【发布时间】:2021-05-25 15:53:38
【问题描述】:
this one 等文档中的拖动示例非常快,并且非常准确地映射到我的手指位置。我已经尝试一对一地复制示例,但要赶上我的手指位置有明显的滞后。
Here is a code sandbox example 在真实设备上测试时有明显的滞后。
信息:
- React Use Gesture 版本:(我尝试了各种版本的组合都没有影响,但这是代码框中的配置)
"react": "17.0.2",
"react-dom": "17.0.2",
"react-scripts": "4.0.0",
"react-spring": "9.1.2",
"react-use-gesture": "9.1.3"
- 设备:iPhone 12 pro max
- 操作系统:[例如iOS14.5.1]
- 浏览器铬
function PullRelease() {
const [{ x }, api] = useSpring(() => ({ x: 0 }));
const bind = useDrag(({ movement: [mx], down }) =>
api.start({ x: down ? mx : 0 })
);
return (
<animated.div {...bind()} style={{ padding: 40, background: "gold", x }}>
Hello World
</animated.div>
);
}
【问题讨论】:
标签: javascript reactjs draggable react-spring react-use-gesture