- Migrate 24 investment screens to OS_Wrapper (tabs, list, detail, forms, transaction flow)
- Add contentPadding={PADDING_INLINE} to 9 list/tabs screens for consistent spacing
- Add enableKeyboardHandling to 6 form screens
- Fix investment tabs layout height to use OS_IOS_HEIGHT/OS_ANDROID_HEIGHT constants
- Update TASK-005 with known issue: upload image returns 500 error in dev env
- Note: Investment feature not fully complete - upload issue needs investigation tomorrow
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
70 lines
2.1 KiB
TypeScript
70 lines
2.1 KiB
TypeScript
import {
|
|
FloatingButton,
|
|
OS_Wrapper,
|
|
TextCustom,
|
|
} from "@/components";
|
|
import { PADDING_INLINE } from "@/constants/constans-value";
|
|
import { PAGINATION_DEFAULT_TAKE } from "@/constants/constans-value";
|
|
import { createPaginationComponents } from "@/helpers/paginationHelpers";
|
|
import { usePagination } from "@/hooks/use-pagination";
|
|
import Investment_BoxBerandaSection from "@/screens/Invesment/BoxBerandaSection";
|
|
import { apiInvestmentGetAll } from "@/service/api-client/api-investment";
|
|
import { router } from "expo-router";
|
|
import _ from "lodash";
|
|
import { RefreshControl } from "react-native";
|
|
|
|
export default function Investment_ScreenBursa() {
|
|
// Setup pagination
|
|
const pagination = usePagination({
|
|
fetchFunction: async (page) => {
|
|
return await apiInvestmentGetAll({
|
|
category: "bursa",
|
|
page: String(page),
|
|
});
|
|
},
|
|
pageSize: PAGINATION_DEFAULT_TAKE,
|
|
dependencies: [],
|
|
onError: (error) => console.error("[ERROR] Fetch investment bursa:", error),
|
|
});
|
|
|
|
// Generate komponen
|
|
const { ListEmptyComponent, ListFooterComponent } = createPaginationComponents({
|
|
loading: pagination.loading,
|
|
refreshing: pagination.refreshing,
|
|
listData: pagination.listData,
|
|
emptyMessage: "Belum ada investasi",
|
|
skeletonCount: PAGINATION_DEFAULT_TAKE,
|
|
skeletonHeight: 100,
|
|
});
|
|
|
|
// Render item investment
|
|
const renderInvestmentItem = ({ item }: { item: any }) => (
|
|
<Investment_BoxBerandaSection
|
|
key={item.id}
|
|
id={item.id}
|
|
data={item}
|
|
/>
|
|
);
|
|
|
|
return (
|
|
<OS_Wrapper
|
|
contentPadding={PADDING_INLINE}
|
|
listData={pagination.listData}
|
|
renderItem={renderInvestmentItem}
|
|
refreshControl={
|
|
<RefreshControl
|
|
refreshing={pagination.refreshing}
|
|
onRefresh={pagination.onRefresh}
|
|
/>
|
|
}
|
|
onEndReached={pagination.loadMore}
|
|
ListEmptyComponent={ListEmptyComponent}
|
|
ListFooterComponent={ListFooterComponent}
|
|
hideFooter
|
|
floatingButton={
|
|
<FloatingButton onPress={() => router.push("/investment/create")} />
|
|
}
|
|
/>
|
|
);
|
|
}
|