soldair / node-qrcode

qr code generator
MIT License
7.55k stars 630 forks source link

In qrcode 1.5.4,react native hermes don't support TextEncoder().encode(data). #369

Open Hao-yiwen opened 3 months ago

Hao-yiwen commented 3 months ago
function ByteData (data) {
  this.mode = Mode.BYTE
  if (typeof (data) === 'string') {
    this.data = new TextEncoder().encode(data)
  } else {
    this.data = new Uint8Array(data)
  }
}

This js code can't work in react-native hermes engine.data = encodeUtf8(data) work great.

Hao-yiwen commented 3 months ago

This is my fix pull request. https://github.com/soldair/node-qrcode/pull/371

freiserg commented 3 months ago

Hermes supports TextEncoder since RN0.74 https://github.com/facebook/hermes/issues/948#issuecomment-2027124113

Hao-yiwen commented 3 months ago

Yes, but RN0.74 boost in April 22, 2024.So many react native app will get error when use node-qrcode.