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

Issue with react-native-qrcode-svg: Property 'TextEncoder' doesn't exist #233

Closed
noorjsdivs opened this issue Jan 15, 2025 · 4 comments
Closed

Comments

@noorjsdivs
Copy link

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.

@noorjsdivs noorjsdivs changed the title Issue with react-native-qrcode-svg: Missing Dependency on text-encoding Issue with react-native-qrcode-svg: Property 'TextEncoder' doesn't exist Jan 15, 2025
@Keoooo
Copy link

Keoooo commented Jan 15, 2025

same issue!

6.3.14

went back down to 6.3.12

@Kicu
Copy link
Member

Kicu commented Jan 15, 2025

Hello,

Please read this section of the README: https://github.com/Expensify/react-native-qrcode-svg?tab=readme-ov-file#integrating-react-native-qrcode-svg-with-react-native-versions-below-075

I hope it provides the necessary answers. TextEncoding was removed to make the package lighter on newer versions of React Native.

@noorjsdivs
Copy link
Author

Hi,
Thank you for sharing the link! I followed the instructions in the README, and everything is working perfectly fine now. Removing TextEncoding to make the package lighter on newer versions of React Native seems like a great improvement. I appreciate your help!

@stefaninicnh
Copy link

Same issue with React-Native 0.76.6 "react-native-qrcode-svg": "^6.3.14"

System:
OS: macOS 15.2
CPU: (8) arm64 Apple M1
Memory: 161.61 MB / 8.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 20.12.2
path: ~/.nvm/versions/node/v20.12.2/bin/node
Yarn:
version: 1.22.22
path: ~/Documents/Projetos/Honda/mobile-cnh/node_modules/.bin/yarn
npm:
version: 10.5.0
path: ~/.nvm/versions/node/v20.12.2/bin/npm
Watchman:
version: 2024.11.11.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.15.2
path: /Users/helen/.rvm/gems/ruby-3.3.6/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.2
- iOS 18.2
- macOS 15.2
- tvOS 18.2
- visionOS 2.2
- watchOS 11.2
Android SDK: Not Found
IDEs:
Android Studio: 2024.2 AI-242.23726.103.2422.12816248
Xcode:
version: 16.2/16C5032a
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.13
path: /Library/Java/JavaVirtualMachines/openjdk-17.jdk/Contents/Home/bin/javac
Ruby:
version: 3.3.6
path: /Users/helen/.rvm/rubies/ruby-3.3.6/bin/ruby
npmPackages:
"@react-native-community/cli":
installed: 15.1.3
wanted: 15.1.3
react:
installed: 18.3.1
wanted: 18.3.1
react-native:
installed: 0.76.6
wanted: 0.76.6
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: false
newArchEnabled: true
iOS:
hermesEnabled: true
newArchEnabled: false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants