VIGNESH KUMARAN
VIGNESH KUMARAN

Reputation: 63

ReferenceError: Property 'TextEncoder' doesn't exist

I'm using react native 0.72.4

I'm getting this error: Reference Error: Property 'Text Encoder' doesn't exist at multiple places in my app. I didn't use it explicitly but my npm packages like qr-code-svg uses this package.

I don't know what Text Encoder is or where it is used .. i don't know why all of it occurs suddenly.

Upvotes: 6

Views: 2410

Answers (3)

twboc
twboc

Reputation: 1607

Package text-encoding is no longer maintained. You should install a polyfill.

npm install text-encoding-polyfill

And include it at the top of your project.

// index.js
import 'text-encoding-polyfill'

Upvotes: 0

Dhairya Purohit
Dhairya Purohit

Reputation: 26

They have fixed this issue with version 6.3.2

Update to this version and everything should work fine.

Ref:

  1. https://github.com/grgia/react-native-qrcode-svg/issues/199
  2. https://github.com/grgia/react-native-qrcode-svg/pull/200

Upvotes: 1

Israel Oghenekaro
Israel Oghenekaro

Reputation: 51

this worked for me using same react native 0.72.4

install text-encoding using npm install --save text-encoding --legacy-peer-deps

then import it everywhere you have imported the qrcode like so import 'text-encoding';

sample of how your code should look like when done with the install

import QRCode from 'react-native-qrcode-svg';
import 'text-encoding';

hope this helps!

Upvotes: 5

Related Questions