Phase 3 - Portfolio Screens (6 files):
- [id]/index.tsx: ViewWrapper → OS_Wrapper (detail dengan pull-to-refresh)
- [id]/edit.tsx: NewWrapper → OS_Wrapper (form + keyboard handling)
- [id]/edit-logo.tsx: ViewWrapper → OS_Wrapper (upload logo)
- [id]/edit-social-media.tsx: ViewWrapper → OS_Wrapper (form + keyboard handling)
- ViewListPortofolio.tsx: NewWrapper → OS_Wrapper (pagination list)
- ScreenPortofolioCreate.tsx: NewWrapper → OS_Wrapper (form + keyboard handling)
Phase 4 - Maps Screens (2 files):
- ScreenMapsCreate.tsx: NewWrapper → OS_Wrapper (form + keyboard handling)
- ScreenMapsEdit.tsx: ViewWrapper → OS_Wrapper (form + keyboard handling)
Bug Fixes:
- Perbaiki auto-scroll keyboard yang membuat input paling atas 'terlempar' keluar layar
- Gunakan UIManager.measure untuk mendapatkan posisi absolut input (pageY) secara akurat
- Logika conditional scroll:
* Jika input terlihat (di atas keyboard) → TIDAK SCROLL
* Jika input tertutup keyboard → Scroll secukupnya
- Helper cloneChildrenWithFocusHandler sekarang aktif menyuntikan onFocus handler ke semua TextInput/TextArea/PhoneInput/Select
- Hapus KeyboardAvoidingView dari AndroidWrapper static mode (tidak diperlukan lagi)
Pattern yang diterapkan:
- List screens: contentPaddingBottom=100 (default)
- Form screens: contentPaddingBottom={250} + enableKeyboardHandling
- NO PADDING_INLINE (sesuai preferensi user - mencegah box menyempit)
Dokumentasi:
- Update TASK-005 dengan status lengkap Phase 1-4 (27 files migrated)
- Tambahkan urutan phase baru: Event (Phase 5), Voting (Phase 6), Forum (Phase 7), Donation (Phase 8)
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
75 lines
2.4 KiB
TypeScript
75 lines
2.4 KiB
TypeScript
import { OS_Wrapper, TextCustom } from "@/components";
|
|
import CustomSkeleton from "@/components/_ShareComponent/SkeletonCustom";
|
|
import { MainColor } from "@/constants/color-palet";
|
|
import { usePagination } from "@/hooks/use-pagination";
|
|
import { createPaginationComponents } from "@/helpers/paginationHelpers";
|
|
import { apiGetPortofolio } from "@/service/api-client/api-portofolio";
|
|
import { useFocusEffect, useLocalSearchParams } from "expo-router";
|
|
import { useCallback } from "react";
|
|
import { RefreshControl } from "react-native";
|
|
import Portofolio_BoxView from "./BoxPortofolioView";
|
|
import NoDataText from "@/components/_ShareComponent/NoDataText";
|
|
import { PAGINATION_DEFAULT_TAKE } from "@/constants/constans-value";
|
|
|
|
export default function ViewListPortofolio() {
|
|
const { id } = useLocalSearchParams();
|
|
|
|
// Initialize pagination for portfolio items
|
|
const pagination = usePagination({
|
|
fetchFunction: async (page) => {
|
|
return await apiGetPortofolio({
|
|
id: id as string,
|
|
page: String(page) // API expects string
|
|
});
|
|
// return response.data;
|
|
},
|
|
pageSize: PAGINATION_DEFAULT_TAKE,
|
|
dependencies: [id],
|
|
});
|
|
|
|
useFocusEffect(
|
|
useCallback(() => {
|
|
// Reset and load first page when id changes
|
|
pagination.reset();
|
|
pagination.onRefresh();
|
|
}, [id]),
|
|
);
|
|
|
|
// Render individual portfolio item
|
|
const renderItem = ({ item }: { item: any }) => (
|
|
<Portofolio_BoxView key={item.id} data={item} />
|
|
);
|
|
|
|
// Generate pagination components using helper
|
|
const { ListEmptyComponent, ListFooterComponent } = createPaginationComponents({
|
|
loading: pagination.loading,
|
|
refreshing: pagination.refreshing,
|
|
listData: pagination.listData,
|
|
isInitialLoad: pagination.isInitialLoad,
|
|
emptyMessage: "Tidak ada portofolio",
|
|
skeletonCount: 3,
|
|
skeletonHeight: 100,
|
|
});
|
|
|
|
return (
|
|
<OS_Wrapper
|
|
listData={pagination.listData}
|
|
renderItem={renderItem}
|
|
refreshControl={
|
|
<RefreshControl
|
|
// IOS
|
|
tintColor={MainColor.yellow}
|
|
// Android
|
|
colors={[MainColor.yellow]}
|
|
progressBackgroundColor={MainColor.yellow}
|
|
refreshing={pagination.refreshing}
|
|
onRefresh={pagination.onRefresh}
|
|
/>
|
|
}
|
|
onEndReached={pagination.loadMore}
|
|
ListEmptyComponent={ListEmptyComponent}
|
|
ListFooterComponent={ListFooterComponent}
|
|
/>
|
|
);
|
|
}
|