Riya
Riya

Reputation: 89

onPreview not working when click to previewIcon - Antd

According to the document here it says callback function onPreview will be executed when file link or preview icon is clicked. But only the file link works for me. I can't figure out what is the problem here.

<Upload
  beforeUpload={() => false}
  listType="picture"
  maxCount={1}
  accept="video/mp4"
  onPreview={() => console.log("HELLO")}
 >
  <Button readOnly={someLogic} icon={<UploadOutlined />}>
   {t("admin_entity.add_video")}
  </Button>
</Upload>

Upvotes: 0

Views: 747

Answers (2)

Riya
Riya

Reputation: 89

I used iconRender function to solve this problem

iconRender={(originNode) => (
 <PlaySquareTwoTone onClick={() => console.log("HELLO")} />
)}

Upvotes: 0

Chuong Tran
Chuong Tran

Reputation: 360

As i checked, the issue is come from file's thumbnail.

It works with with an image ( which can generate a thumbnail in list ).

Maybe you can try to override the thumbnail with some event listener on it, just a workaround solution :)

Upvotes: 1

Related Questions