-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
73 lines (69 loc) · 1.62 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import React, { useState } from 'react';
import { SafeAreaView,
Text,
View,
StyleSheet,
TextInput,
Button } from 'react-native';
import QRCode from 'react-native-qrcode-svg';
export default function App() {
const [inputText, setInputText] = useState('');
const [qrValue, setQrValue] = useState('');
return (
<SafeAreaView style={{flex: 1}}>
<View style={styles.containerQr}>
<QRCode
value={qrValue ? qrValue : 'NA'}
size={250}
color="black"
backgroundColor="white"
logoSize={30}
logoMargin={2}
logoBorderRadius={15}
logoBackgroundColor="yellow"
/>
</View>
<View style={styles.container}>
<Text style={styles.text}>
Insira qualquer valor para gerar o QR Code
</Text>
<TextInput
style={styles.textInput}
onChangeText={(inputText) => setInputText(inputText)}
value={inputText}
/>
<View style={{margin:5}}>
<Button
onPress={() => setQrValue(inputText)}
title="Gerar QR Code"
/>
</View>
</View>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
containerQr: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
container: {
flex: 1,
justifyContent: 'center',
},
text: {
fontSize: 20,
textAlign: 'center',
margin: 5,
},
textInput: {
flexDirection: 'row',
height: 40,
marginTop: 20,
marginLeft: 10,
marginRight: 10,
margin: 10,
borderWidth: 1,
},
});