import clsx from 'clsx'; import React, { forwardRef, useImperativeHandle, useRef } from 'react'; import { RecipientOption } from './RecipientOption'; import type { DropdownListHandles, DropdownListProps, } from './RecipientsInputV2.interface'; import styles from './styles.scss'; export const DropdownList = forwardRef( ( { currentLocale, className, recipientOptions, selectedIndex, formatContactPhone, setSelectedIndex, addToRecipients, enableTitle, visibility, phoneTypeRenderer, phoneSourceNameRenderer, recipientInfoRenderer, recipientPhoneRenderer, }, ref, ) => { const listEl = useRef(null); useImperativeHandle(ref, () => ({ scrollUp() { if (listEl.current) { // @ts-expect-error TS(2339): Property 'scrollTop' does not exist on type 'never... Remove this comment to see the full error message listEl.current.scrollTop = Math.floor( // @ts-expect-error TS(2339): Property 'scrollTop' does not exist on type 'never... Remove this comment to see the full error message Math.max(listEl.current.scrollTop - 53, 0), ); } }, scrollDown() { if (listEl.current) { // @ts-expect-error TS(2339): Property 'scrollTop' does not exist on type 'never... Remove this comment to see the full error message listEl.current.scrollTop = Math.floor( Math.min( // @ts-expect-error TS(2339): Property 'scrollTop' does not exist on type 'never... Remove this comment to see the full error message listEl.current.scrollTop + 53, // @ts-expect-error TS(2339): Property 'scrollHeight' does not exist on type 'ne... Remove this comment to see the full error message listEl.current.scrollHeight, ), ); } }, setScrollPosition(scrollTop) { if (listEl.current) { // @ts-expect-error TS(2339): Property 'scrollTop' does not exist on type 'never... Remove this comment to see the full error message listEl.current.scrollTop = Math.floor(scrollTop); } }, })); if (!visibility || recipientOptions.length === 0) { return null; } return ( ); }, ); DropdownList.displayName = 'DropdownList';