diff --git a/lib/shared/lifecycle-utils.js b/lib/shared/lifecycle-utils.js index 955b42352..583947bfe 100644 --- a/lib/shared/lifecycle-utils.js +++ b/lib/shared/lifecycle-utils.js @@ -1,7 +1,13 @@ import { useSelector } from 'react-redux'; +// Note: This hook mimics the prior state.foreground property +// and considers `inactive` on iOS as equivalent to `active` function useIsAppForegrounded() { return useSelector((state) => state.lifecycleState !== 'background'); } -export { useIsAppForegrounded }; +function useIsAppBackgroundedOrInactive() { + return useSelector((state) => state.lifecycleState !== 'active'); +} + +export { useIsAppForegrounded, useIsAppBackgroundedOrInactive };