rn-shake
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

rn-shake

📱 React Native useShake hook that helps detecting shake gesture with phone accelerometer.

📦 Installation

yarn add rn-shake react-native-sensors

🚀 Usage

  • The first argument of the hook is the callback function.
  • Second argument is the configuration object - All fields optional.
  • It is strongly recommended that you adjust the threshold value with experiments to match your needs.
import {useShake} from 'rn-shake';

useShake(
  () => {
    console.log('🐍 Shook Shook');
  },
  {
    threshold: 3,
    sensorUpdateInterval: 200,
    minimalTimeBetweenTriggers: 1000,
    isTriggerAfterShakes: true,
    resetDependencies: [],
  }
);

/rn-shake/

    Package Sidebar

    Install

    npm i rn-shake

    Weekly Downloads

    4

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    16 kB

    Total Files

    15

    Last publish

    Collaborators

    • kurovskyi
    • kurovskyiii