awesomejerry / react-native-qrcode-svg

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

Download QR Code #165

Open ankitipistis opened 1 year ago

ankitipistis commented 1 year ago

I am grateful for this library as I have generated QR Code. But I need to download it too , so according to the documentation I used react-native-fs but it's showing me some errors which is not resolving. May be this is happening because my project is in expo. Can anyone please help me with the codes. note:- there is an expo-file-system too which can be used instead of react-native-fs here is my QrGenerator.js file , I have a great hope from you guys please help me in this. QrGenerator.txt

here I am Pasting my code from QrGenerator.js

import React, { useState } from 'react'; import { Box, Heading, Center, Button, NativeBaseProvider, Text, Input, FormControl, Stack } from "native-base"; import QRCode from 'react-native-qrcode-svg';

// import { StyleSheet, View, Dimensions } from 'react-native';

export default function QrGenerator({ navigation }) {

const [input, setInput] = useState("name");

const handleChange = (text) => {
    setInput(text);
}

return (
    <NativeBaseProvider>
        <Center mt="20">

            <Heading color="#0891b2">VCard Generator</Heading>

            <Box marginTop="5">
                <QRCode value={input + "\n"} size={170} /> {/* Here is the QRCode from react-native-qrcode-svg */}
            </Box>
        </Center>

        <Box mt="5" width="90%" margin="auto" >

            <Text fontSize="md">Fill below parameters to generate your QR Code</Text>

            <FormControl>
                <Stack>
                    <FormControl.Label >Text</FormControl.Label>
                    <Input placeholder='Enter Text' onChangeText={text => handleChange(text)} />
                </Stack>
            </FormControl>

            <Button mt="5">Download QR</Button>
        </Box>
    </NativeBaseProvider>
)

}

LouisMuriuki commented 1 year ago

did you find a way?