dc9d80d2a8
* update convo list from message bus * don't increase unread count if you're the sender * add refetch interval back * Fix deleted message state copy * only enable if `hasSession` * Fix logged out handling * increase refetch interval to 60s * request 10s interval when message screen active * use useAppState hook for convo resume/background * Combine forces * fix useFocusEffect logic --------- Co-authored-by: Eric Bailey <git@esb.lol>
16 lines
357 B
TypeScript
16 lines
357 B
TypeScript
import {useEffect, useState} from 'react'
|
|
import {AppState} from 'react-native'
|
|
|
|
export function useAppState() {
|
|
const [state, setState] = useState(AppState.currentState)
|
|
|
|
useEffect(() => {
|
|
const sub = AppState.addEventListener('change', nextAppState => {
|
|
setState(nextAppState)
|
|
})
|
|
return () => sub.remove()
|
|
}, [])
|
|
|
|
return state
|
|
}
|