Expensify / react-native-qrcode-svg

A QR Code generator for React Native based on react-native-svg and node-qrcode.
MIT License
1.07k stars 217 forks source link

Qrcode generete not working #138

Open ednilsoncs opened 3 years ago

ednilsoncs commented 3 years ago

I added the following code:

import React from 'react';
import {View, Text} from 'react-native';
import QrCode from 'react-native-qrcode-svg';

const Home: React.FC = () => (
  <View>
    <QrCode value="te" />
    <Text>Novo Qr Code</Text>
  </View>
);

export default Home;

he returned the following error to me:

TypeError: _qrcode.default.create is not a function. (In '_qrcode.default.create(value, {
      errorCorrectionLevel: errorCorrectionLevel
    })', '_qrcode.default.create' is undefined)

Version: "react-native": "0.64.0", "react-native-qrcode-svg": "^6.1.0", "react-native-svg": "^12.1.1-0",

BulletButcher88 commented 2 years ago

I am also getting this error. Did you find a fix?

neon010 commented 2 years ago

I am also getting same issue, Did you find way to fix this issue?

damieng57 commented 2 years ago

Same here, Does someone have a workaround? Version: "react-native": "0.64.2", "react-native-qrcode-svg": "^6.1.2", "react-native-svg": "^12.1.1",

amberatibm commented 1 year ago

When trying

import { StatusBar } from 'expo-status-bar';
import { StyleSheet, Text, View } from 'react-native';

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

export default function App() {
  return (
    <View style={styles.container}>
      <QRCode value='hello world!'/>
      <StatusBar style="auto" />
    </View>
  );
}

I am getting this error as well TypeError: _qrcode.default.create is not a function. (In '_qrcode.default.create(value, { errorCorrectionLevel: errorCorrectionLevel })', '_qrcode.default.create' is undefined)

package.json info:

"react-native": "0.70.5", "react-native-qrcode-svg": "^6.1.2", "react-native-svg": "^13.6.0"

alexander01202 commented 1 year ago

Hello? Has anyone solved this yet?

alexander01202 commented 1 year ago

Just solved this!

This is as a result of your dependencies in your package.json

Ensure you have the correct dependencies(react-native-svg) installed suitable for react-native-qrcode-svg.

This is the dependency worked for me:

{
  "name": "qrcode",
  "version": "1.0.0",
  "scripts": {
    "start": "expo start --dev-client",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "expo": "~47.0.12",
    "expo-status-bar": "~1.4.2",
    "react": "18.1.0",
    "react-native": "0.70.5",
    "react-native-qrcode-svg": "^6.2.0",
    "react-native-svg": "13.4.0",
    "expo-splash-screen": "~0.17.5",
    "expo-dev-client": "~2.0.1",
    "expo-barcode-scanner": "~12.1.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9"
  },
  "private": true
}

To install correct dependency, use npx expo install your package

BraveEvidence commented 1 year ago

This should help you https://www.youtube.com/watch?v=SfWKPIVoS8w&list=PLQhQEGkwKZUrempLnmxjt7ZCZJu1W3p2i&index=4