我正在寻找一种方法来检测用户何时摇动他们的设备来触发我的react原生应用程序中的功能。在react-native-sensors中有一个“加速器”传感器,我可能会用到它。有没有人有构建这样的东西的经验?任何指导都将不胜感激。
https://react-native-sensors.github.io/docs/API.html
import { accelerometer } from "react-native-sensors";
const subscription = accelerometer.subscribe(({ x, y, z, timestamp }) =>
console.log({ x, y, z, timestamp })
);发布于 2018-12-22 06:03:58
有几个选项,例如,签出react-native-shake。
https://stackoverflow.com/questions/53890469
复制相似问题