diff --git a/app/(application)/(user)/user-search/index.tsx b/app/(application)/(user)/user-search/index.tsx index 5995fb3..69f4006 100644 --- a/app/(application)/(user)/user-search/index.tsx +++ b/app/(application)/(user)/user-search/index.tsx @@ -1,9 +1,99 @@ -import { TextCustom, ViewWrapper } from "@/components"; +import { + AvatarCustom, + ClickableCustom, + Grid, + Spacing, + StackCustom, + TextCustom, + TextInputCustom, + ViewWrapper, +} from "@/components"; +import { MainColor } from "@/constants/color-palet"; +import { ICON_SIZE_SMALL } from "@/constants/constans-value"; +import { Ionicons } from "@expo/vector-icons"; +import { router } from "expo-router"; export default function UserSearch() { + function generateRandomPhoneNumber(index: number) { + let prefix; + + // Menentukan prefix berdasarkan index genap atau ganjil + if (index % 2 === 0) { + const evenPrefixes = ["6288", "6289", "6281"]; + prefix = evenPrefixes[Math.floor(Math.random() * evenPrefixes.length)]; + } else { + const oddPrefixes = ["6285", "6283"]; + prefix = oddPrefixes[Math.floor(Math.random() * oddPrefixes.length)]; + } + + // Menghitung panjang sisa nomor acak (antara 10 - 12 digit) + const remainingLength = Math.floor(Math.random() * 3) + 10; // 10, 11, atau 12 + + // Membuat sisa nomor acak + let randomNumber = ""; + for (let i = 0; i < remainingLength; i++) { + randomNumber += Math.floor(Math.random() * 10); // Digit acak antara 0-9 + } + + // Menggabungkan prefix dan sisa nomor + return prefix + randomNumber; + } return ( - - User Search - + <> + + } + placeholder="Cari Pengguna" + borderRadius={50} + /> + } + > + + {Array.from({ length: 20 }).map((e, index) => { + return ( + + + + + + Nama user {index} + + +{generateRandomPhoneNumber(index)} + + + + { + console.log("Ke Profile"); + router.push(`/profile/${index}`); + }} + > + + + + + ); + })} + + + + ); } diff --git a/components/TextInput/TextInputCustom.tsx b/components/TextInput/TextInputCustom.tsx index fe7a7fb..96fe3a2 100644 --- a/components/TextInput/TextInputCustom.tsx +++ b/components/TextInput/TextInputCustom.tsx @@ -89,9 +89,9 @@ const TextInputCustom = ({ disabled && GStyles.disabledBox, ]} > - {/* {iconLeft && ( + {iconLeft && ( {renderIcon(iconLeft)} - )} */} + )} ; } @@ -23,6 +24,7 @@ interface ViewWrapperProps { const ViewWrapper = ({ children, withBackground = false, + headerComponent, footerComponent, style, }: ViewWrapperProps) => { @@ -34,6 +36,11 @@ const ViewWrapper = ({ behavior={Platform.OS === "ios" ? "padding" : "height"} style={{ flex: 1, backgroundColor: MainColor.darkblue }} > + {/* Header Sticky */} + {headerComponent && ( + {headerComponent} + )} +