Bluesky app fork with some witchin' additions 馃挮
at main 27 lines 834 B view raw
1import {useCallback, useMemo, useState} from 'react' 2import * as DynamicAppIcon from '@mozzius/expo-dynamic-app-icon' 3import {useFocusEffect} from '@react-navigation/native' 4 5import {useAppIconSets} from '#/screens/Settings/AppIconSettings/useAppIconSets' 6 7export function useCurrentAppIcon() { 8 const appIconSets = useAppIconSets() 9 const [currentAppIcon, setCurrentAppIcon] = useState(() => 10 DynamicAppIcon.getAppIcon(), 11 ) 12 13 // refresh current icon when screen is focused 14 useFocusEffect( 15 useCallback(() => { 16 setCurrentAppIcon(DynamicAppIcon.getAppIcon()) 17 }, []), 18 ) 19 20 return useMemo(() => { 21 return ( 22 appIconSets.defaults.find(i => i.id === currentAppIcon) ?? 23 //appIconSets.core.find(i => i.id === currentAppIcon) ?? 24 appIconSets.defaults[0] 25 ) 26 }, [appIconSets, currentAppIcon]) 27}