Skip to content

Commit d24fcc8

Browse files
committed
Fix: refのコードを修正
1 parent 519ccb9 commit d24fcc8

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/app/json_formatter/JsonFormatter.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const JsonFormatter: FC = () => {
2929
header={<PanelHeader title="入力文字" right={<ClearButton name="input" />} />}
3030
>
3131
<Controller
32-
render={({ field }) => <Editor extensions={[ex.json]} {...field} />}
32+
render={({ field }) => <Editor {...field} extensions={[ex.json]} />}
3333
name="input"
3434
control={methods.control}
3535
/>
@@ -39,11 +39,11 @@ export const JsonFormatter: FC = () => {
3939
<Controller
4040
render={({ field }) => (
4141
<InputNumber
42+
{...field}
4243
style={{ width: 250 }}
4344
min={0}
4445
max={10}
4546
defaultValue={DEFAULT_VALUES.indentSpace}
46-
{...field}
4747
/>
4848
)}
4949
name="indentSpace"

src/components/common/Form/Input.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import styled from '@emotion/styled';
22
import { Input as AntInput } from 'antd';
33
import type { InputProps } from 'antd';
4-
import React, { FC } from 'react';
4+
import React, { forwardRef } from 'react';
55

66
type Props = InputProps & {
77
noResize?: string;
88
};
99

10-
export const Input: FC<Props> = ({ noResize = 'vertical', ...field }) => {
11-
return <StyleInput resize={noResize} {...field} />;
12-
};
10+
export const Input = forwardRef<any, Props>(({ noResize = 'vertical', ...field }, ref) => {
11+
return <StyleInput resize={noResize} ref={ref} {...field} />;
12+
});
1313

1414
const StyleInput = styled(AntInput)<{ resize: string }>`
1515
resize: ${({ resize }) => resize} !important;
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { InputNumber as AntInputNumber } from 'antd';
22
import type { InputNumberProps } from 'antd';
3-
import React, { FC } from 'react';
3+
import React, { forwardRef } from 'react';
44

5-
export const InputNumber: FC<InputNumberProps> = (props) => {
5+
export const InputNumber = forwardRef<HTMLInputElement, InputNumberProps>((props, ref) => {
66
return <AntInputNumber {...props} />;
7-
};
7+
});

0 commit comments

Comments
 (0)