[react-input-autosize] Only accept callback style refs (#35555)

This commit is contained in:
Zhang Yi Jiang 2019-05-24 13:53:55 -07:00 committed by Ryan Cavanaugh
parent b749ebfe18
commit ebf0e7e257
2 changed files with 3 additions and 3 deletions

View File

@ -9,7 +9,7 @@ import * as React from 'react';
export interface AutosizeInputProps extends React.InputHTMLAttributes<HTMLInputElement>, React.ClassAttributes<HTMLInputElement> {
inputClassName?: string;
inputRef?: React.Ref<HTMLInputElement>;
inputRef?: (instance: HTMLInputElement | null) => void;
inputStyle?: React.CSSProperties;
minWidth?: string | number;
onAutosize?: (inputWidth: string | number) => void;

View File

@ -2,10 +2,10 @@ import * as React from 'react';
import AutosizeInput, { AutosizeInputProps } from 'react-input-autosize';
class Test extends React.Component<AutosizeInputProps> {
input: HTMLInputElement;
input: HTMLInputElement | null = null;
auto: AutosizeInput;
inputRef = (ref: HTMLInputElement) => {
inputRef = (ref: HTMLInputElement | null) => {
this.input = ref;
}