How to detect the direction when I move it (left, right, up and down)?
I installed react-native sensor npm install react-native-sensors --save.
**import { accelerometer } from "react-native-sensors";
const subscription = accelerometer.subscribe(({ x, y, z, timestamp }) =>
console.log({ x, y, z, timestamp })
);**
I tested with the above code it works smoothly.
But, how can I detect the directions?
How can I detect the direction when I move it (left, right, up and down)?