-
Notifications
You must be signed in to change notification settings - Fork 225
Description
I encountered an issue when using the react-native-qrcode-svg package, where it appears to depend on the text-encoding package, but not working as it supposed to be. This causes an error during runtime, as the required module cannot be resolved.
Steps to Reproduce:
Install react-native-qrcode-svg using yarn add react-native-qrcode-svg ("react-native-qrcode-svg": "^6.3.14",)
Import and use the package in a React Native project.
Run the app on Android, and you will encounter the following error:
Error: Property 'TextEncoder' doesn't exist
Expected Behavior:
The package should either:
Include the text-encoding dependency as part of its installation.
Remove the reliance on text-encoding if it is no longer necessary.
Actual Behavior:
The package attempts to import text-encoding, leading to the above error, which prevents the app from functioning properly.
Temporary Workaround:
As a temporary fix, I manually installed the text-encoding package in my project:
yarn add text-encoding
and using import 'text-encoding' at top on whenever I am using the QRCode
This resolved the error, but it's not ideal for long-term use.
Environment Details:
React Native version: 0.72.4
react-native-qrcode-svg version: ^6.3.14
Platform: Android
Node.js version: 22.9.0
Yarn version: 1.22.1
Suggestions:
Update the documentation to reflect the need to install text-encoding as a peer dependency if it's intended.
If the dependency on text-encoding is outdated or unnecessary, consider removing it from the codebase.
Thank you for your work on this package! Let me know if you need additional details to troubleshoot this issue.