|
@@ -10,6 +10,7 @@ import {Linking} from "expo";
|
10
|
10
|
import AlertDialog from "../../components/Dialogs/AlertDialog";
|
11
|
11
|
import i18n from 'i18n-js';
|
12
|
12
|
import CustomTabBar from "../../components/Tabbar/CustomTabBar";
|
|
13
|
+import LoadingConfirmDialog from "../../components/Dialogs/LoadingConfirmDialog";
|
13
|
14
|
|
14
|
15
|
type Props = {};
|
15
|
16
|
type State = {
|
|
@@ -18,6 +19,7 @@ type State = {
|
18
|
19
|
dialogVisible: boolean,
|
19
|
20
|
dialogTitle: string,
|
20
|
21
|
dialogMessage: string,
|
|
22
|
+ loading: boolean,
|
21
|
23
|
};
|
22
|
24
|
|
23
|
25
|
class ScannerScreen extends React.Component<Props, State> {
|
|
@@ -28,6 +30,7 @@ class ScannerScreen extends React.Component<Props, State> {
|
28
|
30
|
dialogVisible: false,
|
29
|
31
|
dialogTitle: "",
|
30
|
32
|
dialogMessage: "",
|
|
33
|
+ loading: false,
|
31
|
34
|
};
|
32
|
35
|
|
33
|
36
|
constructor() {
|
|
@@ -46,7 +49,7 @@ class ScannerScreen extends React.Component<Props, State> {
|
46
|
49
|
if (!URLHandler.isUrlValid(data))
|
47
|
50
|
this.showErrorDialog();
|
48
|
51
|
else {
|
49
|
|
- this.setState({scanned: true});
|
|
52
|
+ this.showOpeningDialog();
|
50
|
53
|
Linking.openURL(data);
|
51
|
54
|
}
|
52
|
55
|
};
|
|
@@ -108,6 +111,13 @@ class ScannerScreen extends React.Component<Props, State> {
|
108
|
111
|
});
|
109
|
112
|
};
|
110
|
113
|
|
|
114
|
+ showOpeningDialog = () => {
|
|
115
|
+ this.setState({
|
|
116
|
+ loading: true,
|
|
117
|
+ scanned: true,
|
|
118
|
+ });
|
|
119
|
+ };
|
|
120
|
+
|
111
|
121
|
showErrorDialog() {
|
112
|
122
|
this.setState({
|
113
|
123
|
dialogVisible: true,
|
|
@@ -166,6 +176,11 @@ class ScannerScreen extends React.Component<Props, State> {
|
166
|
176
|
title={this.state.dialogTitle}
|
167
|
177
|
message={this.state.dialogMessage}
|
168
|
178
|
/>
|
|
179
|
+ <LoadingConfirmDialog
|
|
180
|
+ visible={this.state.loading}
|
|
181
|
+ titleLoading={i18n.t("general.loading")}
|
|
182
|
+ startLoading={true}
|
|
183
|
+ />
|
169
|
184
|
</View>
|
170
|
185
|
);
|
171
|
186
|
}
|