From 32e260c8a4c7738005cd7201adaa746e750d2f92 Mon Sep 17 00:00:00 2001 From: amel Date: Mon, 28 Apr 2025 10:40:42 +0800 Subject: [PATCH] upd: home Deskripsi: - update carousel home No Issues --- components/home/carouselHome.tsx | 22 +++++++++++----------- constants/Styles.ts | 1 - 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/components/home/carouselHome.tsx b/components/home/carouselHome.tsx index f3d3351..a61bad0 100644 --- a/components/home/carouselHome.tsx +++ b/components/home/carouselHome.tsx @@ -2,8 +2,8 @@ import Styles from "@/constants/Styles"; import { apiGetBanner } from "@/lib/api"; import { setEntities } from "@/lib/bannerSlice"; import { useAuthSession } from "@/providers/AuthProvider"; -import React from "react"; -import { Dimensions, Text, View } from "react-native"; +import React, { useEffect } from "react"; +import { Dimensions, Image, View } from "react-native"; import { useSharedValue } from "react-native-reanimated"; import Carousel, { ICarouselInstance } from "react-native-reanimated-carousel"; import { useDispatch, useSelector } from "react-redux"; @@ -12,16 +12,19 @@ export default function CaraouselHome() { const { decryptToken, token } = useAuthSession() const ref = React.useRef(null); const width = Dimensions.get("window").width; - const data = [...new Array(6).keys()]; const progress = useSharedValue(0); const dispatch = useDispatch() const entities = useSelector((state: any) => state.banner) async function handleBannerView() { const hasil = await decryptToken(String(token?.current)) - apiGetBanner({ user: hasil }).then((data) => dispatch(setEntities(data.data))); + apiGetBanner({ user: hasil }).then((data) => dispatch(setEntities(data.data))) } + useEffect(() => { + handleBannerView() + }, [dispatch]); + return ( ( - // - - BANNER DARMASABA - + )} /> diff --git a/constants/Styles.ts b/constants/Styles.ts index 37b29b3..212b806 100644 --- a/constants/Styles.ts +++ b/constants/Styles.ts @@ -251,7 +251,6 @@ const Styles = StyleSheet.create({ }, caraoselContent: { flex: 1, - borderWidth: 1, justifyContent: "center", marginHorizontal: 15, borderRadius: 15,