Something went wrong. Try again.
Mirror — see github.com/blacksky-algorithms/blacksky.community
Something went wrong. Try again.
123456789101112131415161718192021222324252627import {useCallback, useMemo, useState} from 'react'import * as DynamicAppIcon from '@bsky.app/expo-dynamic-app-icon'import {useFocusEffect} from '@react-navigation/native'
import {useAppIconSets} from '#/screens/Settings/AppIconSettings/useAppIconSets'
export function useCurrentAppIcon() { const appIconSets = useAppIconSets() const [currentAppIcon, setCurrentAppIcon] = useState(() => DynamicAppIcon.getAppIcon(), )
// refresh current icon when screen is focused useFocusEffect( useCallback(() => { setCurrentAppIcon(DynamicAppIcon.getAppIcon()) }, []), )
return useMemo(() => { return ( appIconSets.defaults.find(i => i.id === currentAppIcon) ?? appIconSets.defaults[0] ) }, [appIconSets, currentAppIcon])}