ordering-ui-react-native 0.21.40-test → 0.21.42-test
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -6,19 +6,25 @@ import {
|
|
|
6
6
|
FlatList,
|
|
7
7
|
} from 'react-native';
|
|
8
8
|
|
|
9
|
+
import CheckBox from '@react-native-community/checkbox';
|
|
10
|
+
|
|
9
11
|
import {
|
|
10
12
|
InterfaceType,
|
|
11
13
|
StarDeviceDiscoveryManager,
|
|
12
14
|
StarDeviceDiscoveryManagerFactory,
|
|
13
15
|
StarPrinter
|
|
14
16
|
} from 'react-native-star-io10';
|
|
17
|
+
import { useTheme } from 'styled-components';
|
|
18
|
+
import { OIconButton } from '../shared';
|
|
15
19
|
|
|
16
|
-
export const SearchStarPrinter = () => {
|
|
20
|
+
export const SearchStarPrinter = ({ navigation }: any) => {
|
|
17
21
|
|
|
22
|
+
const theme = useTheme();
|
|
18
23
|
let _manager: StarDeviceDiscoveryManager;
|
|
19
24
|
|
|
20
25
|
const [state, setState] = useState({
|
|
21
|
-
|
|
26
|
+
bluetoothIsEnabled: true,
|
|
27
|
+
bluetoothLeIsEnabled: true,
|
|
22
28
|
printers: [],
|
|
23
29
|
})
|
|
24
30
|
|
|
@@ -31,10 +37,13 @@ export const SearchStarPrinter = () => {
|
|
|
31
37
|
try {
|
|
32
38
|
await _manager?.stopDiscovery()
|
|
33
39
|
|
|
34
|
-
|
|
35
|
-
if (state.
|
|
40
|
+
let interfaceTypes: Array<InterfaceType> = []
|
|
41
|
+
if (state.bluetoothIsEnabled) {
|
|
36
42
|
interfaceTypes.push(InterfaceType.Bluetooth);
|
|
37
43
|
}
|
|
44
|
+
if (state.bluetoothLeIsEnabled) {
|
|
45
|
+
interfaceTypes.push(InterfaceType.BluetoothLE);
|
|
46
|
+
}
|
|
38
47
|
|
|
39
48
|
_manager = await StarDeviceDiscoveryManagerFactory.create(interfaceTypes);
|
|
40
49
|
_manager.discoveryTime = 10000;
|
|
@@ -61,10 +70,43 @@ export const SearchStarPrinter = () => {
|
|
|
61
70
|
}
|
|
62
71
|
}
|
|
63
72
|
|
|
73
|
+
const handleArrowBack: any = () => {
|
|
74
|
+
navigation?.canGoBack() && navigation.goBack();
|
|
75
|
+
};
|
|
76
|
+
|
|
64
77
|
return (
|
|
65
78
|
<View style={{ margin: 50 }}>
|
|
79
|
+
<OIconButton
|
|
80
|
+
icon={theme.images.general.arrow_left}
|
|
81
|
+
iconStyle={{ width: 20, height: 20 }}
|
|
82
|
+
borderColor={theme.colors.clear}
|
|
83
|
+
style={{ maxWidth: 40, justifyContent: 'flex-end' }}
|
|
84
|
+
onClick={() => handleArrowBack()}
|
|
85
|
+
/>
|
|
66
86
|
<View
|
|
67
87
|
style={{ width: 100, marginTop: 30 }}>
|
|
88
|
+
<Text style={{ marginLeft: 20 }}>Bluetooth</Text>
|
|
89
|
+
</View>
|
|
90
|
+
|
|
91
|
+
<View style={{ flexDirection: 'row' }}>
|
|
92
|
+
<CheckBox
|
|
93
|
+
style={{ marginLeft: 20 }}
|
|
94
|
+
value={state.bluetoothLeIsEnabled}
|
|
95
|
+
onValueChange={(newValue) => {
|
|
96
|
+
setState({ bluetoothLeIsEnabled: newValue });
|
|
97
|
+
}}
|
|
98
|
+
/>
|
|
99
|
+
<Text style={{ marginLeft: 20 }}>Bluetooth LE</Text>
|
|
100
|
+
</View>
|
|
101
|
+
|
|
102
|
+
<View style={{ flexDirection: 'row' }}>
|
|
103
|
+
<CheckBox
|
|
104
|
+
style={{ marginLeft: 20 }}
|
|
105
|
+
value={state.usbIsEnabled}
|
|
106
|
+
onValueChange={(newValue) => {
|
|
107
|
+
setState({ usbIsEnabled: newValue });
|
|
108
|
+
}}
|
|
109
|
+
/>
|
|
68
110
|
<Button
|
|
69
111
|
title="Discovery"
|
|
70
112
|
onPress={_onPressDiscoveryButton}
|
|
@@ -137,12 +137,12 @@ export const HandleStarPrinter = ({ navigation }: any) => {
|
|
|
137
137
|
setPrintState({ identifier: value });
|
|
138
138
|
}}
|
|
139
139
|
/>
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
140
|
+
</View>
|
|
141
|
+
<View style={{ width: 100, marginTop: 20 }}>
|
|
142
|
+
<Button
|
|
143
|
+
title="Search Printer"
|
|
144
|
+
onPress={onSearchPrint}
|
|
145
|
+
/>
|
|
146
146
|
</View>
|
|
147
147
|
<View style={{ width: 100, marginTop: 20 }}>
|
|
148
148
|
<Button
|