-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
79 lines (70 loc) · 1.78 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
74
75
76
77
78
79
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow strict-local
*/
import * as React from 'react';
import {Text, View, StyleSheet, Dimensions, SafeAreaView} from 'react-native';
import {TabView, SceneMap} from 'react-native-tab-view';
import {Header} from 'react-native-elements';
import CreateBarcode from './components/create-barcode/create-barcode';
import ScanBarcode from './components/scan-barcode/scan-barcode';
const FirstRoute = () => (
// <View style={[styles.scene, {backgroundColor: 'white'}]} />
<CreateBarcode />
);
const SecondRoute = () => (
<ScanBarcode/>
);
const initialLayout = {width: Dimensions.get('window').width};
export default function App() {
const [index, setIndex] = React.useState(0);
const [routes] = React.useState([
{key: 'create', title: 'Create'},
{key: 'scan', title: 'Scan'},
]);
const renderScene = SceneMap({
create: FirstRoute,
scan: SecondRoute,
});
return (
<SafeAreaView style={styles.container}>
<Header
centerComponent={{text: 'BARCODE SCANNER', style: {color: '#fff'}}}
/>
<TabView
navigationState={{index, routes}}
renderScene={renderScene}
onIndexChange={setIndex}
initialLayout={initialLayout}
/>
{/* <View style={styles.footer}>
<Text style={styles.footerText}>{index === 0 ? 'GENERATE BARCODE' : 'SCAN BARCODE'}</Text>
</View> */}
</SafeAreaView>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
scene: {
flex: 1,
},
footer: {
position: 'absolute',
left: 0,
right: 0,
bottom: 0,
height: 60,
backgroundColor: '#2196f3',
paddingTop:15,
},
footerText: {
color: '#fff',
textAlign: 'center',
fontSize: 16
}
});