when i try to remove the eventListener like in the React native documentation for AppState: https://reactnative.dev/docs/appstate, I either get an error that there is no such function remove() on undefined since AppState.addEventListener() returns void or the eventListener is just not removed.
here is my code:
useEffect(() => {
const subscription = AppState.addEventListener('change', (nextAppState: any) => {
// some stuff
});
return () => {
subscription.remove();
};
}, []);
If anyone has an idea on that matter, i would be very grateful, thank you !
I found someone on github with the same issue I believe: https://github.com/facebook/react-native/issues/33151