import { useLayoutEffect, useState } from "react"; import { View } from "react-native"; import stylesheet from "./stylesheet"; import { NCoreUIKitLocalize, NCoreUIKitTheme, PageContainer, AvatarGroup, CodeViewer, SelectBox, Header, Switch, Text } from "ncore-ui-kit"; import { useNavigation } from "@react-navigation/native"; import type RootStackParamList from "../../../navigation/type"; import type { NativeStackNavigationProp } from "@react-navigation/native-stack"; import type { IAvatarGroupProps } from "ncore-ui-kit"; const AVATAR_GROUP_SIZES: Array = [ "small", "medium", "large", "xLarge", "xSmall" ]; const AVATAR_GROUP_SIZES_DATA = AVATAR_GROUP_SIZES.map((item) => ({ __title: item as string, __key: item as string })); const MOCK_AVATARS = [ { imageUrl: "https://ncore.nibgat.space/assets/images/ncorelogo.png", title: "Ncore System" }, { title: "Jane Smith" }, { title: "Mike Ross" }, { title: "John Doe" } ]; const AvatarGroupPage = () => { const { radiuses, borders, spaces, colors } = NCoreUIKitTheme.useContext(); const { localize } = NCoreUIKitLocalize.useContext(); const navigation = useNavigation>(); const [ sizeIndex, setSizeIndex ] = useState(3); const [ isDisabled, setIsDisabled ] = useState(false); const [ isLoading, setIsLoading ] = useState(false); useLayoutEffect(() => { navigation.setOptions({ header: () =>
, headerShown: true }); }, []); return {localize("avatarGroup-desc")} {localize("usage")} "} language="tsx" /> { if (selectedItems.length > 0) { const index = AVATAR_GROUP_SIZES.indexOf( selectedItems[0]! .__key as IAvatarGroupProps["size"], ); if (index !== -1) setSizeIndex(index); } }} initialSelectedItems={ AVATAR_GROUP_SIZES_DATA[sizeIndex] ? [ AVATAR_GROUP_SIZES_DATA[sizeIndex]! ] : [] } title={localize("avatarGroup-changeSize")} titleExtractor={(item) => item.__title} keyExtractor={(item) => item.__key} data={AVATAR_GROUP_SIZES_DATA} spreadBehaviour="free" /> { setIsLoading(!isLoading); }} title={localize("avatarGroup-toggleLoading")} spreadBehaviour="free" isActive={isLoading} /> { setIsDisabled(!isDisabled); }} spreadBehaviour="free" isActive={isDisabled} /> ; }; export default AvatarGroupPage;