You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: I could make a PR for this if this package is still being maintained and is open to PRs, but seeing as the directory structure only includes a dist folder, I assume this package only includes the JS-compiled package.
I was looking to wrap the RN AppState in my own custom hook and came across this package. While there's some functionality I still wish to add myself, I noticed that it looked like the hook has appState as a dependency, which creates a lot of excess listener creations and cleanups.
By modifying the handleAppStateChange function to:
and make the dependency list: [onChange, onForeground, onBackground] so that changes to the appState do not trigger the creation of a new AppState listener after the previous listener is cleaned up.
This change isn't strictly necessary, since the hook's appState and callback function calls remain unaffected by the number of times the change listeners are added/removed, but it was just something I noticed while testing the two methods.
The text was updated successfully, but these errors were encountered:
Note: I could make a PR for this if this package is still being maintained and is open to PRs, but seeing as the directory structure only includes a
dist
folder, I assume this package only includes the JS-compiled package.I was looking to wrap the RN AppState in my own custom hook and came across this package. While there's some functionality I still wish to add myself, I noticed that it looked like the hook has
appState
as a dependency, which creates a lot of excess listener creations and cleanups.By modifying the
handleAppStateChange
function to:and make the dependency list:
[onChange, onForeground, onBackground]
so that changes to theappState
do not trigger the creation of a new AppState listener after the previous listener is cleaned up.This change isn't strictly necessary, since the hook's
appState
and callback function calls remain unaffected by the number of times the change listeners are added/removed, but it was just something I noticed while testing the two methods.The text was updated successfully, but these errors were encountered: