Cull unused files (#11029)

This commit is contained in:
Samuel Newman
2026-06-30 19:41:35 +03:00
committed by GitHub
parent bb20f234f3
commit ade5d2b783
17 changed files with 8 additions and 1495 deletions
-28
View File
@@ -1,28 +0,0 @@
import {useEffect, useState} from 'react'
import {useNavigation} from '@react-navigation/native'
import {getTabState, TabState} from '#/lib/routes/helpers'
export function useTabFocusEffect(
tabName: string,
cb: (isInside: boolean) => void,
) {
const [isInside, setIsInside] = useState(false)
// get root navigator state
let nav = useNavigation()
while (nav.getParent()) {
nav = nav.getParent()
}
const state = nav.getState()
useEffect(() => {
// check if inside
let v = getTabState(state, tabName) !== TabState.Outside
if (v !== isInside) {
// fire
setIsInside(v)
cb(v)
}
}, [state, isInside, setIsInside, tabName, cb])
}
-32
View File
@@ -1,32 +0,0 @@
import {useCallback, useEffect, useRef} from 'react'
/**
* Helper hook to run persistent timers on views
*/
export function useTimer(time: number, handler: () => void) {
const timer = useRef<undefined | NodeJS.Timeout>(undefined)
// function to restart the timer
const reset = useCallback(() => {
if (timer.current) {
clearTimeout(timer.current)
}
timer.current = setTimeout(handler, time)
}, [time, timer, handler])
// function to cancel the timer
const cancel = useCallback(() => {
if (timer.current) {
clearTimeout(timer.current)
timer.current = undefined
}
}, [timer])
// start the timer immediately
useEffect(() => {
reset()
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
return [reset, cancel]
}