Skip to content

I am getting a blank screenshot when I test on mobile screen #55

Description

@trandinhhiep789

Whenever I use this plugin to take a screenshot, I always get a blank screenshot.
Whenever I use this plugin to take a screenshot with mobile screen size, I always get a blank screenshot.
If I use website size or ipad size everything works fine, but when I minimize the website to phone screen size it doesn't work

"use-react-screenshot": "^3.0.0",
"html2canvas": "^1.4.1",

This is my code.

`
import { useScreenshot, createFileName } from "use-react-screenshot";
...
const imgBillPrint = useRef(null);
const [image, takeScreenShot] = useScreenshot({
type: "image/jpeg",
quality: 1.0
});

const download = (image: any, { name = "img", extension = "jpg" } = {}) => {
	const a = document.createElement("a");
	a.href = image;
	a.download = createFileName(extension, name);
	a.click();
};
const downloadScreenshot = () => takeScreenShot(imgBillPrint.current, {
	allowTaint: false,
	useCORS: true,
  }).then(download);

....

    <TabPanel>
          <Box h="100%" ref={imgBillPrint}>
                /// content want to screenshot
          </Box>


   <button style={{ marginBottom: '10px' }} onClick={downloadScreenshot}>
Take screenshot
   </button>
    <img width={'100%'} src={image} alt={'Screenshot'} />

   </TabPanel>

`

image

image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions