Skip to content

Commit

Permalink
Add onRecordedprops to AudioRecorderUploader
Browse files Browse the repository at this point in the history
  • Loading branch information
ir4y committed Feb 17, 2025
1 parent 507c94c commit 1f8ed36
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,22 @@ import { isSuccess } from '@beda.software/remote-data';
import { S } from './styles';
import { UploadFileControl } from '../UploadFileControl';

export function AudioRecorderUploader(props: QuestionItemProps) {
const { questionItem } = props;
interface AudioRecorderUploaderExtraProps{
onRecorded?: (file: RcFile) => void;
}

export function AudioRecorderUploader(props: QuestionItemProps & AudioRecorderUploaderExtraProps) {
const { questionItem, onRecorded } = props;
const [showScriber, setShowScriber] = useState(false);

const { formItem, customRequest, onChange, fileList, onRemove } = useUploader(props);
const hasFiles = fileList.length > 0;

const onScribeChange = useCallback(
async (file: RcFile) => {
if(onRecorded){
onRecorded(file);
}
setShowScriber(false);

const fileClone = new File([file], file.name, {
Expand Down Expand Up @@ -49,7 +56,7 @@ export function AudioRecorderUploader(props: QuestionItemProps) {
});
}
},
[fileList],
[fileList, onRecorded],
);

const renderContent = () => {
Expand Down

0 comments on commit 1f8ed36

Please sign in to comment.