OS_Wrapper System: - Simplify API: Remove PageWrapper, merge keyboard props into OS_Wrapper - Add auto-scroll when keyboard appears (Android only) - Add tap-to-dismiss keyboard for both Static and List modes - Fix contentPaddingBottom default to 250px (prevent keyboard overlap) - Change default contentPadding to 0 (per-screen control) - Remove Platform.OS checks from IOSWrapper and AndroidWrapper Constants: - Add PADDING_INLINE constant (16px) for consistent inline padding - Add OS_PADDING_TOP constants for tab layouts Job Screens Migration (9 files): - Apply PADDING_INLINE to all Job screens: - ScreenBeranda, ScreenBeranda2 - ScreenArchive, ScreenArchive2 - MainViewStatus, MainViewStatus2 - ScreenJobCreate, ScreenJobEdit - Job detail screen Keyboard Handling: - Simplified useKeyboardForm hook - Auto-scroll by keyboard height when keyboard appears - Track scroll position for accurate scroll targets - TouchableWithoutFeedback wraps all content for tap-to-dismiss Documentation: - Update TASK-005 with Phase 1 completion status - Update Quick Reference with unified API examples Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
77 lines
2.3 KiB
TypeScript
77 lines
2.3 KiB
TypeScript
/* eslint-disable react-hooks/exhaustive-deps */
|
|
import { BaseBox, OS_Wrapper, TextCustom } from "@/components";
|
|
import { MainColor } from "@/constants/color-palet";
|
|
import { createPaginationComponents } from "@/helpers/paginationHelpers";
|
|
import { useAuth } from "@/hooks/use-auth";
|
|
import { usePagination } from "@/hooks/use-pagination";
|
|
import { apiJobGetAll } from "@/service/api-client/api-job";
|
|
import { useFocusEffect } from "expo-router";
|
|
import _ from "lodash";
|
|
import { useState } from "react";
|
|
import { RefreshControl } from "react-native";
|
|
import { PAGINATION_DEFAULT_TAKE, PADDING_INLINE } from "@/constants/constans-value";
|
|
|
|
export default function Job_ScreenArchive2() {
|
|
const { user } = useAuth();
|
|
|
|
// Setup pagination
|
|
const pagination = usePagination({
|
|
fetchFunction: async (page) => {
|
|
if (!user?.id) return { data: [] };
|
|
|
|
return await apiJobGetAll({
|
|
category: "archive",
|
|
authorId: user?.id,
|
|
page: String(page),
|
|
});
|
|
},
|
|
pageSize: PAGINATION_DEFAULT_TAKE,
|
|
dependencies: [user?.id],
|
|
onError: (error) => console.error("[ERROR] Fetch job archive:", error),
|
|
});
|
|
|
|
// Generate komponen
|
|
const { ListEmptyComponent, ListFooterComponent } = createPaginationComponents({
|
|
loading: pagination.loading,
|
|
refreshing: pagination.refreshing,
|
|
listData: pagination.listData,
|
|
emptyMessage: "Anda tidak memiliki arsip",
|
|
skeletonCount: PAGINATION_DEFAULT_TAKE,
|
|
skeletonHeight: 80,
|
|
});
|
|
|
|
// Render item job
|
|
const renderJobItem = ({ item }: { item: any }) => (
|
|
<BaseBox
|
|
key={item.id}
|
|
paddingTop={20}
|
|
paddingBottom={20}
|
|
href={`/job/${item.id}/archive`}
|
|
>
|
|
<TextCustom align="center" bold truncate size="large">
|
|
{item?.title || "-"}
|
|
</TextCustom>
|
|
</BaseBox>
|
|
);
|
|
|
|
return (
|
|
<OS_Wrapper
|
|
listData={pagination.listData}
|
|
renderItem={renderJobItem}
|
|
refreshControl={
|
|
<RefreshControl
|
|
tintColor={MainColor.yellow}
|
|
colors={[MainColor.yellow]}
|
|
refreshing={pagination.refreshing}
|
|
onRefresh={pagination.onRefresh}
|
|
/>
|
|
}
|
|
onEndReached={pagination.loadMore}
|
|
ListEmptyComponent={ListEmptyComponent}
|
|
ListFooterComponent={ListFooterComponent}
|
|
hideFooter
|
|
contentPadding={PADDING_INLINE}
|
|
/>
|
|
);
|
|
}
|