-
Notifications
You must be signed in to change notification settings - Fork 564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to remove listener(component) when activity is destroyed(component is unmounted) #79
Comments
Deeper debugging shows that module is not unregistering the emitter. So component is leaking, but native (android) module doesn't |
Yep, if you configure event listeners in component that can be unmounted, make sure you unsubscribe from events in If you insists on registering listener in component that can get unmounted, you can unregister listeners like this: Solution 1
Solution 2remove all listeners with:
*also check sample app in next branch https://github.com/mauron85/react-native-background-geolocation-example/blob/next/src/common/scenes/MainScene.js#L135 Prefered solution (redux + LocationManager)LocationManager.js (code not tested!)
in your index.*.js
Now you can start and stop LocationManager from any component via You can listen to |
I think this is can be considered as resolved |
Now I get no-op warning, that it can update only mounted component, every time when I get new location. It should be memory leak of older component. Because, it happening after re-entering to the app.
How to remove references to this component in method componentWillUnmount?
The text was updated successfully, but these errors were encountered: