ordering-ui-react-native 0.21.41-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
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { OIconButton } from 'ordering-ui-react-native/themes/business/src/components/shared';
|
|
2
1
|
import React, { useState } from 'react';
|
|
3
2
|
import {
|
|
4
3
|
View,
|
|
@@ -7,6 +6,8 @@ import {
|
|
|
7
6
|
FlatList,
|
|
8
7
|
} from 'react-native';
|
|
9
8
|
|
|
9
|
+
import CheckBox from '@react-native-community/checkbox';
|
|
10
|
+
|
|
10
11
|
import {
|
|
11
12
|
InterfaceType,
|
|
12
13
|
StarDeviceDiscoveryManager,
|
|
@@ -14,6 +15,7 @@ import {
|
|
|
14
15
|
StarPrinter
|
|
15
16
|
} from 'react-native-star-io10';
|
|
16
17
|
import { useTheme } from 'styled-components';
|
|
18
|
+
import { OIconButton } from '../shared';
|
|
17
19
|
|
|
18
20
|
export const SearchStarPrinter = ({ navigation }: any) => {
|
|
19
21
|
|
|
@@ -21,7 +23,8 @@ export const SearchStarPrinter = ({ navigation }: any) => {
|
|
|
21
23
|
let _manager: StarDeviceDiscoveryManager;
|
|
22
24
|
|
|
23
25
|
const [state, setState] = useState({
|
|
24
|
-
|
|
26
|
+
bluetoothIsEnabled: true,
|
|
27
|
+
bluetoothLeIsEnabled: true,
|
|
25
28
|
printers: [],
|
|
26
29
|
})
|
|
27
30
|
|
|
@@ -34,10 +37,13 @@ export const SearchStarPrinter = ({ navigation }: any) => {
|
|
|
34
37
|
try {
|
|
35
38
|
await _manager?.stopDiscovery()
|
|
36
39
|
|
|
37
|
-
|
|
38
|
-
if (state.
|
|
40
|
+
let interfaceTypes: Array<InterfaceType> = []
|
|
41
|
+
if (state.bluetoothIsEnabled) {
|
|
39
42
|
interfaceTypes.push(InterfaceType.Bluetooth);
|
|
40
43
|
}
|
|
44
|
+
if (state.bluetoothLeIsEnabled) {
|
|
45
|
+
interfaceTypes.push(InterfaceType.BluetoothLE);
|
|
46
|
+
}
|
|
41
47
|
|
|
42
48
|
_manager = await StarDeviceDiscoveryManagerFactory.create(interfaceTypes);
|
|
43
49
|
_manager.discoveryTime = 10000;
|
|
@@ -79,6 +85,28 @@ export const SearchStarPrinter = ({ navigation }: any) => {
|
|
|
79
85
|
/>
|
|
80
86
|
<View
|
|
81
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
|
+
/>
|
|
82
110
|
<Button
|
|
83
111
|
title="Discovery"
|
|
84
112
|
onPress={_onPressDiscoveryButton}
|