react-select#MenuListComponentProps TypeScript Examples

The following examples show how to use react-select#MenuListComponentProps. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: popup-list.tsx    From utopia with MIT License 6 votes vote down vote up
MenuList = (props: MenuListComponentProps<SelectOption>) => {
  const ref = React.useRef<HTMLDivElement>(null)
  const refCurrent = ref.current
  const propsValue = props.getValue()
  React.useEffect(() => {
    if (refCurrent != null) {
      const index = getIndexOfValue(propsValue, [])
      refCurrent.scrollTo({
        top: calculateMenuScrollPosition(index, refCurrent.clientHeight),
      })
    }
  }, [refCurrent, propsValue])

  return <components.MenuList {...props} innerRef={ref} />
}
Example #2
Source File: scrollbar.tsx    From django-react-typescript with MIT License 6 votes vote down vote up
renderScrollbar = (
  props: React.PropsWithChildren<
    MenuListComponentProps<{
      value: string;
      label: string;
    }>
  >
) => {
  return (
    <SimpleBar autoHide={false} style={{ maxHeight: 200 }}>
      {props.children}
    </SimpleBar>
  );
}