forked from
jollywhoppers.com/witchsky.app
Bluesky app fork with some witchin' additions 馃挮
1import {useCallback, useRef} from 'react'
2import {useFocusEffect} from '@react-navigation/native'
3
4export function useRefreshOnFocus<T>(refetch: () => Promise<T>) {
5 const firstTimeRef = useRef(true)
6
7 useFocusEffect(
8 useCallback(() => {
9 if (firstTimeRef.current) {
10 firstTimeRef.current = false
11 return
12 }
13
14 refetch()
15 }, [refetch]),
16 )
17}