How to detect device shake?

I am struggling to figure out how to have my device detect shaking with expo. I see there’s an existing project called react-native-shake-event, but it seems to only work if I detach from expo. Is there an existing way of detecting shake events with expo?

Hi! I think this could be done fairly easily using Expo’s gyroscope API, but I’m not sure if there’s an off-the-shelf library that will just handle it for you.

You could check for a feature request on Canny and create one there if it doesn’t already exist.

1 Like

Ok I see. Was hoping for an off-the-shelf solution. I’ll use the accelerometer/gyroscope in Expo’s API to write my own. Thanks!

hey did you find any off the shelf solution? @robotron

No I never did. In the end it was pretty easy to create my own. I took a look at this stackoverflow post:

I modified one of the solutions I liked and reimplemented it using Expo’s accelerometer.

1 Like

yeah it was pretty easy . already made one :stuck_out_tongue: in 10 minutes or so .