如何使用 Expo React-Native 检测抖动事件? [英] How to detect shake event with Expo React-Native?
本文介绍了如何使用 Expo React-Native 检测抖动事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I would like to know if it's possible to detect shake event with Expo ?
解决方案
You can use DeviceMotion and adding a event listener for rotationRate
.
rotationRate (object) -- Rotation rates of the device around each of its axes as an object with alpha, beta, gamma keys where alpha is around Z axis, beta for X axis and gamma for Y axis.
With this you can also look in what axis the user is rotating the phone (maybe you want different actions depending on the shake direction).
这篇关于如何使用 Expo React-Native 检测抖动事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文