I am getting a blank screenshot when I test on mobile screen
Opened this issue · 1 comments
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>
`
@trandinhhiep789 second parameter is not accepted. @vre2h hasn't maintained this project lately so PR: #36 is still waiting there to be merged.