Doko-Demo-Doa / react-native-shake

React Native shake event detector
MIT License
261 stars 64 forks source link

Q - Usage in functional components #33

Closed andy-clapham closed 2 years ago

andy-clapham commented 3 years ago

Hi - Very handy library, thanks! I'm using the pattern:

 useEffect(() => {
        const subscription = RNShake.addListener(onUndo);
        return () => subscription.remove();
    });

is this a valid way to do it, or should I be using removeListener() ... or both?

Doko-Demo-Doa commented 2 years ago

This is up now with 5.1.0, you are now able to use it as the code you want above. Thanks for using!

andy-clapham commented 2 years ago

Cheers!