/* eslint-disable jsx-a11y/no-autofocus */ import { useRef, useState } from 'react' import { Field } from 'formik' import { Picker } from 'emoji-mart' import { KoreanbotsEmoji } from '@utils/Constants' import useOutsideClick from '@utils/useOutsideClick' import 'emoji-mart/css/emoji-mart.css' const TextArea: React.FC = ({ name, placeholder, theme = 'auto', max, setValue, value, }) => { const ref = useRef() const [emojiPickerHidden, setEmojiPickerHidden] = useState(true) useOutsideClick(ref, () => { setEmojiPickerHidden(true) }) return (
{!emojiPickerHidden && ( // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore { setEmojiPickerHidden(true) setValue(value + ' ' + ((e as { native: string }).native || e.colons)) }} i18n={{ search: '검색', notfound: '검색 결과가 없습니다.', categories: { search: '검색 결과', recent: '최근 사용', people: '사람', nature: '자연', foods: '음식', activity: '활동', places: '장소', objects: '사물', symbols: '기호', flags: '국기', custom: '커스텀', }, }} custom={KoreanbotsEmoji} /> )}
setEmojiPickerHidden(false)} onKeyPress={() => setEmojiPickerHidden(false)} role='button' tabIndex={0} />
{max && ( {max - value.length} )}
) } interface TextAreaProps { name: string placeholder?: string theme?: 'auto' | 'dark' | 'light' max?: number value: string setValue(value: string): void } export default TextArea