import { useLayoutEffect, useState } from "react"; import { View } from "react-native"; import stylesheet from "./stylesheet"; import { NCoreUIKitLocalize, NCoreUIKitTheme, PageContainer, TextAreaInput, SelectBox, TextInput, Button, 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 { ITextAreaInputProps } from "ncore-ui-kit"; const TYPES: Array = [ "default", "danger", "warning", "question", "success", "info" ]; const SPREAD_BEHAVIOURS: Array = [ "baseline", "stretch", "free" ]; const TYPES_DATA = TYPES.map((item) => ({ __title: item as string, __key: item as string })); const TextAreaInputPage = () => { const { radiuses, borders, spaces, colors } = NCoreUIKitTheme.useContext(); const { localize } = NCoreUIKitLocalize.useContext(); const navigation = useNavigation>(); const [ typeIndex, setTypeIndex ] = useState(0); const [ spreadIndex, setSpreadIndex ] = useState(0); const [ title, setTitle ] = useState(""); const [ isDisabled, setIsDisabled ] = useState(false); const [ isCleanEnabled, setIsCleanEnabled ] = useState(true); const [ isRequired, setIsRequired ] = useState(false); const [ isOptional, setIsOptional ] = useState(false); const [ val, setVal ] = useState(""); useLayoutEffect(() => { navigation.setOptions({ header: () => (
), headerShown: true }); }, []); return ( {localize("textAreaInput-desc")} { if (selectedItems.length > 0) { const index = TYPES.indexOf( selectedItems[0]! .__key as unknown as ITextAreaInputProps["type"], ); if (index !== -1) setTypeIndex(index); } }} initialSelectedItems={ TYPES_DATA[typeIndex] ? [TYPES_DATA[typeIndex]] : [] } title={localize("textAreaInput-changeType")} titleExtractor={(item) => item.__title} keyExtractor={(item) => item.__key} spreadBehaviour="free" data={TYPES_DATA} />