对本机博览会QRcode GENERATOR做出反应

时间:2020-04-15 12:08:23

标签: react-native expo qr-code

我想在React Native Expo中构建我的应用QRCODE GENERATOR。

我使用QR码-模块react-native-qrcode的0.2.7版,并且有这个error

2 个答案:

答案 0 :(得分:1)

react-native-qrcode已不再维护。

您可以使用react-native-qrcode-svg软件包

docs for GCHandle.Alloc

yarn add react-native-qrcode-svg

OR

npm install --save react-native-qrcode-svg

答案 1 :(得分:0)

import React, { Component } from 'react';
import { StyleSheet, View, TextInput, TouchableOpacity, Text,} from 'react-native';
import QRCode from 'react-native-qrcode';
class App extends Component {
constructor() {
super();
this.state = {
  inputValue: '',

  valueForQRCode: '',

    };
}

  getTextInputValue = () => {
this.setState({ valueForQRCode: this.state.inputValue });
};

 render() {
return (
  <View style={styles.MainContainer}>

    <TextInput
      style={styles.TextInputStyle}
      onChangeText={text => this.setState({ inputValue: text })}
      underlineColorAndroid="transparent"
      placeholder="Enter text to Generate QR Code"
    />
    <TouchableOpacity
      onPress={this.getTextInputValue}
      activeOpacity={0.7}
      style={styles.button}>
      <Text style={styles.TextStyle}> Generate QR Code </Text>
    </TouchableOpacity>
  </View>
);
}
}
     export default App;