blob: 32290e58d357bb75ed37c6da6c93059650c2428f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
import {atom, useAtom} from 'jotai';
import {InstalledApps} from 'react-native-launcher-kit';
import {AppDetail} from 'react-native-launcher-kit/typescript/Interfaces/InstalledApps';
import {useStableCallback} from './useStableCallback';
const installedAppsAtom = atom<AppDetail[]>(InstalledApps.getSortedApps());
export const useInstalledApps = () => {
const [apps, setApps] = useAtom(installedAppsAtom);
const refreshApps = useStableCallback(() =>
setApps(InstalledApps.getSortedApps()),
);
return {
apps,
refreshApps,
};
};
|