Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: You need to specify a canvas element in React Native #2

Closed
A7medSabry opened this issue Dec 7, 2021 · 3 comments
Closed

Error: You need to specify a canvas element in React Native #2

A7medSabry opened this issue Dec 7, 2021 · 3 comments

Comments

@A7medSabry
Copy link

Hi
When trying to use
const imageData = await invoice.render();
it's return Error: You need to specify a canvas element

@ihadabs
Copy link
Member

ihadabs commented Dec 7, 2021

Hi @A7medSabry,

Where are you running the code? Browser or server?
Please also provide full code snippet.

@A7medSabry
Copy link
Author

A7medSabry commented Dec 7, 2021

Code run in debug mode on mobile app with metro bundler
React Naitve
Code
Screen Shot 2021-12-07 at 2 09 33 PM
:

Code Stop in Line 130 @ihadabs Error: You need to specify a canvas element

@ihadabs
Copy link
Member

ihadabs commented Dec 11, 2021

Hey there @A7medSabry,

The render method uses the toDataURL from node-qrcode.
If its throwing an error then you could open an issure in the package repo 🙌.

Not sure about React Native but you could still render the invoice.toBase64() using other available packages.

@ihadabs ihadabs closed this as completed Dec 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants