import type { FieldProps } from 'formik'; import React, { useState } from 'react'; import { Dimensions, View, ViewStyle } from 'react-native'; import { HelperText, Menu } from 'react-native-paper'; import { useHasError } from './helpers'; import TextInputFaker from '../TextInputFaker'; import { Ionicons } from '@expo/vector-icons'; import { useColors } from '../Provider'; interface Props extends FieldProps { label: string; options: { value: unknown; label: string; }[]; style: ViewStyle; } const FormikSelect = (props: Props) => { const [isVisible, setIsVisible] = useState(false); const { field, form, options } = props; const hasError = useHasError(form, field.name); const { getColor } = useColors(); function closeMenu() { setIsVisible(false); } const handleChange = (value: any) => { setIsVisible(false); form.setFieldValue(field.name, value); }; function getLabelByValue(value: any) { return props.options.find((x) => x.value === value)?.label || ''; } return (
); }; export default FormikSelect;