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

View File

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