-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.tsx
55 lines (50 loc) · 1.7 KB
/
App.tsx
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
/** @format */
import React, {Component} from 'react';
import {Text, View, TouchableOpacity} from 'react-native';
import CameraScreenModel from './src/screen/CameraScreenModel';
import BarcodeScreenModel from './src/screen/BarcodeScreenModel';
import CameraModel from './src/components/CameraModel';
import appStyles from './src/styles/AppStyles';
type State = {
model?: CameraModel | CameraScreenModel | BarcodeScreenModel;
};
export default class App extends Component {
state: State;
constructor(props: {} | Readonly<{}>) {
super(props);
this.state = {
model: undefined,
};
}
render() {
if (this.state.model) {
const Model = this.state.model;
return <Model />;
}
return (
<View style={{flex: 1}}>
<View style={appStyles.headerContainer}>
<Text style={{fontSize: 60}}>🎈</Text>
<Text style={appStyles.headerText}>React Native Camera Kit</Text>
</View>
<View style={appStyles.appContainer}>
<TouchableOpacity
style={appStyles.button}
onPress={() => this.setState({model: CameraModel})}>
<Text style={appStyles.buttonText}>Camera</Text>
</TouchableOpacity>
<TouchableOpacity
style={appStyles.button}
onPress={() => this.setState({model: CameraScreenModel})}>
<Text style={appStyles.buttonText}>Camera Screen</Text>
</TouchableOpacity>
<TouchableOpacity
style={appStyles.button}
onPress={() => this.setState({model: BarcodeScreenModel})}>
<Text style={appStyles.buttonText}>Barcode Scanner</Text>
</TouchableOpacity>
</View>
</View>
);
}
}