Skip to content

Commit

Permalink
Update ref types
Browse files Browse the repository at this point in the history
  • Loading branch information
ecraig12345 committed Sep 16, 2020
1 parent fb61485 commit a7691e3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/react-next/etc/react-next.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export const ColorPickerGridCell: React.FunctionComponent<IColorPickerGridCellPr
export const ColorPickerGridCellBase: React.FunctionComponent<IColorPickerGridCellProps>;

// @public (undocumented)
export const ComboBox: React.ForwardRefExoticComponent<IComboBoxProps & React.RefAttributes<HTMLDivElement>>;
export const ComboBox: React.FunctionComponent<IComboBoxProps>;

// @public
export const ContextualMenu: React.FunctionComponent<IContextualMenuProps>;
Expand Down Expand Up @@ -678,7 +678,7 @@ export interface IComboBoxOptionStyles extends IButtonStyles {
}

// @public (undocumented)
export interface IComboBoxProps extends ISelectableDroppableTextProps<IComboBox, IComboBox> {
export interface IComboBoxProps extends ISelectableDroppableTextProps<IComboBox, IComboBox>, React.RefAttributes<HTMLDivElement> {
allowFreeform?: boolean;
ariaDescribedBy?: string;
autoComplete?: 'on' | 'off';
Expand Down
6 changes: 3 additions & 3 deletions packages/react-next/src/components/ComboBox/ComboBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ function useOptionsState({ options, defaultSelectedKey, selectedKey }: IComboBox
] as const;
}

export const ComboBox = React.forwardRef(
export const ComboBox: React.FunctionComponent<IComboBoxProps> = React.forwardRef<HTMLDivElement, IComboBoxProps>(
(propsWithoutDefaults: IComboBoxProps, forwardedRef: React.Ref<HTMLDivElement>) => {
const props = getPropsWithDefaults(DEFAULT_PROPS, propsWithoutDefaults);
const { ref, ...props } = getPropsWithDefaults(DEFAULT_PROPS, propsWithoutDefaults);
const rootRef = React.useRef<HTMLDivElement>(null);

const mergedRootRef = useMergedRefs(rootRef, forwardedRef);
Expand Down Expand Up @@ -190,7 +190,7 @@ export const ComboBox = React.forwardRef(
);
ComboBox.displayName = COMPONENT_NAME;

interface IComboBoxInternalProps extends IComboBoxProps {
interface IComboBoxInternalProps extends Omit<IComboBoxProps, 'ref'> {
hoisted: {
mergedRootRef: React.Ref<HTMLDivElement>;
rootRef: React.RefObject<HTMLDivElement>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ export interface IComboBoxOption extends ISelectableOption {
/**
* {@docCategory ComboBox}
*/
export interface IComboBoxProps extends ISelectableDroppableTextProps<IComboBox, IComboBox> {
export interface IComboBoxProps
extends ISelectableDroppableTextProps<IComboBox, IComboBox>,
React.RefAttributes<HTMLDivElement> {
/**
* Optional callback to access the IComboBox interface. Use this instead of ref for accessing
* the public methods and properties of the component.
Expand Down

0 comments on commit a7691e3

Please sign in to comment.