47
rated 0 times
[
48]
[
1]
/ answers: 1 / hits: 16984
/ 5 Years ago, tue, october 8, 2019, 12:00:00
I'm using DeviceEventEmitter
to handle events of a favorite method, to which is subscribed in the constructor:
DeviceEventEmitter.addListener(FavoriteClick, async (e) =>
{
// do something
})
This event listener stays active whenever the components unmounts (permenantly). What do I have to call to unsub? I've tried storing the event as a variable and calling listener.removeCurrentListener()
in the componentWillUnmount()
like the (limited) documentation states, if I understand that correctly, but removeCurrentListener()
is not a method.
More From » react-native