You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`typescript
import React, { useMemo, useRef } from 'react';
import { Form, InputGroup } from 'react-bootstrap';
import type { FC } from 'react';
import { useTranslation } from 'react-i18next';
`typescript
import React, { useMemo, useRef } from 'react';
import { Form, InputGroup } from 'react-bootstrap';
import type { FC } from 'react';
import { useTranslation } from 'react-i18next';
interface CustomFileInputProps {
value: string;
onChange: React.ChangeEventHandler;
isValid?: boolean;
isInvalid?: boolean;
}
const CustomFileInput: FC = ({
onChange,
value,
...rest
}) => {
const { t } = useTranslation('translation', { keyPrefix: 'editor' });
const fileName = useMemo(() => {
return value ?? t('file_upload.text');
}, [value]);
const fileRef = useRef(null);
return (
<Form.Group>
<Form.Control
type="file"
id="custom-file"
onChange={onChange}
style={{ zIndex: -1, position: 'absolute' }} // 隐藏默认控件
ref={fileRef}
{...rest}
/>
);
};
export default CustomFileInput;
<CustomFileInput
value={link.value}
onChange={onUpload}
isInvalid={currentTab === 'localImage' && link.isInvalid}
/>
{/* <Form.Control
type="file"
placeholder="123"
prefix="234"
title="title"
onChange={onUpload}
isInvalid={currentTab === 'localImage' && link.isInvalid}
/> */}
`
The text was updated successfully, but these errors were encountered: