Files
hipmi-mobile/screens/Event/ScreenBeranda.tsx
bagasbanuna 54537d2449 feat: Complete Phase 6 Event screens migration + add PADDING_INLINE to tabs
User Phase 6 - Event Screens (16 files):
- Beranda, Status, History, Contribution (tabs screens)
  → NewWrapper → OS_Wrapper + contentPadding={PADDING_INLINE}
- create.tsx & edit.tsx → Forms with enableKeyboardHandling + contentPaddingBottom={250}
- [id]/publish.tsx, history.tsx, contribution.tsx, confirmation.tsx → Static detail screens
- [id]/[status]/detail-event.tsx → Status detail screen
- detail/[id].tsx → Detail route screen
- ScreenListOfParticipants.tsx → Participants list screen

Key Improvements:
- Added contentPadding={PADDING_INLINE} to all Event (tabs) screens to prevent tight edge margins.
- Form screens (create, edit) use enableKeyboardHandling + contentPaddingBottom={250}.
- Removed all ViewWrapper and NewWrapper instances from Event feature.

Documentation:
- Update TASK-005 with Phase 6 completion details and new progress totals.
- Added note about PADDING_INLINE usage for tab screens.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-10 13:50:59 +08:00

76 lines
2.3 KiB
TypeScript

import { TextCustom, OS_Wrapper } from "@/components";
import FloatingButton from "@/components/Button/FloatingButton";
import { MainColor } from "@/constants/color-palet";
import { PAGINATION_DEFAULT_TAKE, PADDING_INLINE } from "@/constants/constans-value";
import { createPaginationComponents } from "@/helpers/paginationHelpers";
import { usePagination } from "@/hooks/use-pagination";
import Event_BoxPublishSection from "@/screens/Event/BoxPublishSection";
import { apiEventGetAll } from "@/service/api-client/api-event";
import { dateTimeView } from "@/utils/dateTimeView";
import { router } from "expo-router";
import { RefreshControl } from "react-native";
export default function Event_ScreenBeranda() {
// Setup pagination
const pagination = usePagination({
fetchFunction: async (page) => {
return await apiEventGetAll({
category: "beranda",
page: String(page),
});
},
pageSize: PAGINATION_DEFAULT_TAKE,
dependencies: [],
onError: (error) => console.error("[ERROR] Fetch event beranda:", error),
});
// Generate komponen
const { ListEmptyComponent, ListFooterComponent } = createPaginationComponents({
loading: pagination.loading,
refreshing: pagination.refreshing,
listData: pagination.listData,
emptyMessage: "Belum ada event",
skeletonCount: PAGINATION_DEFAULT_TAKE,
skeletonHeight: 100,
});
// Render item event
const renderEventItem = ({ item }: { item: any }) => (
<Event_BoxPublishSection
key={item.id}
href={`/event/${item.id}/publish`}
data={item}
rightComponentAvatar={
<TextCustom>
{dateTimeView({ date: item?.tanggal, withoutTime: true })}
</TextCustom>
}
/>
);
return (
<OS_Wrapper
contentPadding={PADDING_INLINE}
listData={pagination.listData}
renderItem={renderEventItem}
refreshControl={
<RefreshControl
tintColor={MainColor.yellow}
colors={[MainColor.yellow]}
refreshing={pagination.refreshing}
onRefresh={pagination.onRefresh}
/>
}
onEndReached={pagination.loadMore}
ListEmptyComponent={ListEmptyComponent}
ListFooterComponent={ListFooterComponent}
hideFooter
floatingButton={
<FloatingButton onPress={() => router.push("/event/create")} />
}
/>
);
}