replace example code with are minified camera screen/record button

This commit is contained in:
Loewy
2024-01-31 20:48:31 -08:00
parent fb42545890
commit 1f035ce557
17 changed files with 215 additions and 1327 deletions

View File

@@ -0,0 +1,16 @@
import { useState, useEffect } from 'react'
import { AppState, AppStateStatus } from 'react-native'
export const useIsForeground = (): boolean => {
const [isForeground, setIsForeground] = useState(true)
useEffect(() => {
const onChange = (state: AppStateStatus): void => {
setIsForeground(state === 'active')
}
const listener = AppState.addEventListener('change', onChange)
return () => listener.remove()
}, [setIsForeground])
return isForeground
}