chore: 修复inputRef类型错误 (#5806)

This commit is contained in:
meerkat 2022-11-24 21:28:30 +08:00 committed by GitHub
parent 8b45ab165f
commit 5e3c59cb1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -59,7 +59,7 @@ export interface TextAreaProps extends ThemeProps, LocaleProps {
name?: string;
disabled?: boolean;
forwardRef?: {current: HTMLInputElement | null};
forwardRef?: {current: HTMLTextAreaElement | null};
}
export interface TextAreaState {
@ -79,9 +79,9 @@ export class Textarea extends React.Component<TextAreaProps, TextAreaState> {
focused: false
};
input?: HTMLInputElement;
inputRef = (ref: HTMLInputElement) => {
this.input = findDOMNode(ref) as HTMLInputElement;
input?: HTMLTextAreaElement;
inputRef = (ref: HTMLTextAreaElement) => {
this.input = findDOMNode(ref) as HTMLTextAreaElement;
if (this.props.forwardRef) {
this.props.forwardRef.current = this.input;
}

View File

@ -274,13 +274,14 @@ test('Renderer:input-table with combo column', async () => {
await wait(300);
expect(onSubmit).toBeCalledTimes(2);
expect(onSubmit.mock.calls[1][0]).toEqual({
table: [
{
q2: '1',
q1: {
score: 99,
comment: 'this is comment msg!'
comment: 'this is comment msg!',
score: 99
}
}
]