upd : home page

Deskripsi:
- load refresh pada halaman home

No Issues
This commit is contained in:
2025-09-09 11:49:13 +08:00
parent a15724756e
commit 060f96e7b2
8 changed files with 89 additions and 37 deletions

View File

@@ -15,7 +15,7 @@ type Props = {
jumlah: number
}
export default function DivisionHome() {
export default function DivisionHome({ refreshing }: { refreshing: boolean }) {
const { decryptToken, token } = useAuthSession()
const ref = React.useRef<ICarouselInstance>(null)
const width = Dimensions.get("window").width
@@ -23,9 +23,9 @@ export default function DivisionHome() {
const [loading, setLoading] = useState(true)
const arrSkeleton = Array.from({ length: 2 }, (_, index) => index)
async function handleData() {
async function handleData(loading: boolean) {
try {
setLoading(true)
setLoading(loading)
const hasil = await decryptToken(String(token?.current))
const response = await apiGetDataHome({ cat: "division", user: hasil })
setData(response.data)
@@ -37,14 +37,19 @@ export default function DivisionHome() {
}
useEffect(() => {
handleData()
if (refreshing)
handleData(false)
}, [refreshing]);
useEffect(() => {
handleData(true)
}, []);
return (
<View style={[Styles.mb15]}>
<Text style={[Styles.textDefaultSemiBold, Styles.mv10]}>Divisi Teraktif</Text>
<Text style={[Styles.textDefaultSemiBold, Styles.mb10]}>Divisi Teraktif</Text>
{
loading ?
arrSkeleton.map((item, index) => (