5.1.0 release
With this new release, I have removed removeListener
as addListener
method now returns an EmitterSubscription
, allows you to create and use multiple RNShake instances. Example with useEffect
hook:
import React from 'react'
export const MyComponent = () => {
React.useEffect(() => {
const subscription = RNShake.addListener(() => {
// Your code here...
})
return () => {
// Your code here...
subscription.remove()
}
}, [])
}