Add more Live Event refreshing (#9745)

* Refresh on foreground

* Add back interval
This commit is contained in:
Eric Bailey
2026-01-24 13:39:55 -06:00
committed by GitHub
parent 49e7a96cd9
commit 3b7806963a
3 changed files with 16 additions and 11 deletions
+8 -8
View File
@@ -12,15 +12,15 @@ export function onAppStateChange(cb: (state: AppStateStatus) => void) {
})
}
export function useOnAppStateChange(cb: (state: AppStateStatus) => void) {
useEffect(() => {
const sub = onAppStateChange(next => cb(next))
return () => sub.remove()
}, [cb])
}
export function useAppState() {
const [state, setState] = useState(AppState.currentState)
useEffect(() => {
const sub = onAppStateChange(next => {
setState(next)
})
return () => sub.remove()
}, [])
useOnAppStateChange(setState)
return state
}