diff --git a/app/(application)/group/index.tsx b/app/(application)/group/index.tsx index 575ce1b..f7485ff 100644 --- a/app/(application)/group/index.tsx +++ b/app/(application)/group/index.tsx @@ -15,7 +15,7 @@ import { setUpdateGroup } from "@/lib/groupSlice"; import { useAuthSession } from "@/providers/AuthProvider"; import { AntDesign, Feather, MaterialCommunityIcons } from "@expo/vector-icons"; import { useEffect, useState } from "react"; -import { RefreshControl, SafeAreaView, ScrollView, View } from "react-native"; +import { RefreshControl, View, VirtualizedList } from "react-native"; import Toast from "react-native-toast-message"; import { useDispatch, useSelector } from "react-redux"; @@ -116,9 +116,17 @@ export default function Index() { } + const getItem = (_data: unknown, index: number): Props => ({ + id: data[index].id, + name: data[index].name, + isActive: data[index].isActive, + }); + + + return ( - - + + - - } - style={[Styles.h100]} - > - - { - - loading ? - arrSkeleton.map((item, index) => { + + + { + loading ? + arrSkeleton.map((item, index) => { + return ( + + ) + }) + : + data.length > 0 ? + data.length} + getItem={getItem} + renderItem={({ item, index }: { item: Props, index: number }) => { return ( - + { + setIdChoose(item.id) + setActiveChoose(item.isActive) + setTitleChoose(item.name) + setModal(true) + }} + borderType="all" + icon={ + + + + } + title={item.name} + /> ) - }) - : - data.length > 0 ? - data.map((item, index) => { - return ( - { - setIdChoose(item.id) - setActiveChoose(item.isActive) - setTitleChoose(item.name) - setModal(true) - }} - borderType="all" - icon={ - - - - } - title={item.name} - /> - ) - }) - : - Tidak ada data - } - - + }} + keyExtractor={(item, index) => String(index)} + showsVerticalScrollIndicator={false} + refreshControl={ + + } + /> + : + Tidak ada data + } setModal(false)} title={titleChoose}> @@ -228,8 +238,7 @@ export default function Index() { + - - ) } \ No newline at end of file diff --git a/app/(application)/position/index.tsx b/app/(application)/position/index.tsx index 57aaa4a..21026d3 100644 --- a/app/(application)/position/index.tsx +++ b/app/(application)/position/index.tsx @@ -16,7 +16,7 @@ import { useAuthSession } from "@/providers/AuthProvider"; import { AntDesign, Feather, MaterialCommunityIcons } from "@expo/vector-icons"; import { useLocalSearchParams } from "expo-router"; import { useEffect, useState } from "react"; -import { RefreshControl, SafeAreaView, ScrollView, View } from "react-native"; +import { RefreshControl, View, VirtualizedList } from "react-native"; import Toast from "react-native-toast-message"; import { useDispatch, useSelector } from "react-redux"; @@ -129,9 +129,18 @@ export default function Index() { setRefreshing(false) }; + + const getItem = (_data: unknown, index: number): Props => ({ + id: data[index].id, + name: data[index].name, + idGroup: data[index].idGroup, + group: data[index].group, + isActive: data[index].isActive, + }); + return ( - - + + Filter : {nameGroup} } - - }> - - { - loading ? - arrSkeleton.map((item, index) => { - return ( - - ) - }) - : - data.length > 0 ? - data.map((item, index) => { - return ( - { handleChooseData(item.id, item.name, item.isActive, item.idGroup) }} - borderType="all" - icon={ - - - - } - title={item.name} - subtitle={item.group} - /> - ) - }) - : - Tidak ada data - } - - - + + { + loading ? + arrSkeleton.map((item, index) => { + return ( + + ) + }) + : + data.length > 0 ? + data.length} + getItem={getItem} + renderItem={({ item, index }: { item: Props, index: number }) => { + return ( + { handleChooseData(item.id, item.name, item.isActive, item.idGroup) }} + borderType="all" + icon={ + + + + } + title={item.name} + subtitle={item.group} + /> + ) + }} + keyExtractor={(item, index) => String(index)} + showsVerticalScrollIndicator={false} + refreshControl={ + + } + /> + : + Tidak ada data + } + setModal(false)} title={chooseData.name}> - - + ) } \ No newline at end of file diff --git a/components/auth/viewLogin.tsx b/components/auth/viewLogin.tsx index c98239f..0098854 100644 --- a/components/auth/viewLogin.tsx +++ b/components/auth/viewLogin.tsx @@ -44,7 +44,7 @@ export default function ViewLogin({ onValidate }: Props) { return ( - + {