blob: 110e3feb28fd822ef155811cfb6d7539fc42e509 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
import React, {useEffect, useState} from 'react';
import Swiper from 'react-native-swiper';
import {AppList} from './screens/AppList';
import {Home} from './screens/Home';
import {useInstalledApps} from './hooks/useInstalledApps';
import {useFavorites} from './hooks/useFavorites';
export const View: React.FC = React.memo(() => {
const {refreshApps} = useInstalledApps();
const {refreshFavorites} = useFavorites();
const [screenIndex, setScreenIndex] = useState(0);
useEffect(() => {
refreshApps();
refreshFavorites();
}, [screenIndex, refreshApps, refreshFavorites]);
return (
<Swiper
horizontal
autoplay={false}
loop={false}
dot={<></>}
activeDot={<></>}
onIndexChanged={setScreenIndex}>
<Home active={screenIndex === 0} />
<AppList active={screenIndex === 1} />
</Swiper>
);
});
|