我想在React Native Expo中构建我的应用程序QRCODE Generator。我使用QR码-模块react-native-qrcode版本0.2.7,我有这个error。
xoshrz7s1#
react-native-qrcode不再维护。可以使用react-native-qrcode-svg包https://www.npmjs.com/package/react-native-qrcode-svg
react-native-qrcode
react-native-qrcode-svg
yarn add react-native-qrcode-svg
或
npm install --save react-native-qrcode-svg
u3r8eeie2#
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;
icomxhvb3#
你可以试试我开源的这个库:react-native-barcode-creator,它生成本机QR码,Code128,阿兹特克和PDF417条形码,适用于iOS和Android
3条答案
按热度按时间xoshrz7s1#
react-native-qrcode
不再维护。可以使用
react-native-qrcode-svg
包https://www.npmjs.com/package/react-native-qrcode-svg
或
u3r8eeie2#
icomxhvb3#
你可以试试我开源的这个库:react-native-barcode-creator,它生成本机QR码,Code128,阿兹特克和PDF417条形码,适用于iOS和Android