@eohjsc/react-native-smart-city 0.3.16 → 0.3.19
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
|
@@ -22,8 +22,8 @@ const NumberUpDownActionTemplate = ({ actionGroup, doAction, sensor }) => {
|
|
|
22
22
|
|
|
23
23
|
// eslint-disable-next-line no-unused-vars
|
|
24
24
|
const [configValues, setConfigValues] = useConfigGlobalState('configValues');
|
|
25
|
-
const [value, setValue] = useState();
|
|
26
25
|
const valueDefault = 28;
|
|
26
|
+
const [value, setValue] = useState(valueDefault);
|
|
27
27
|
|
|
28
28
|
useEffect(() => {
|
|
29
29
|
if (sensor?.device_type === DEVICE_TYPE.LG_THINQ) {
|
|
@@ -40,15 +40,12 @@ const NumberUpDownActionTemplate = ({ actionGroup, doAction, sensor }) => {
|
|
|
40
40
|
|
|
41
41
|
useEffect(() => {
|
|
42
42
|
if (!config) {
|
|
43
|
-
setValue(valueDefault);
|
|
44
43
|
return;
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
const configValue = configValues[config];
|
|
48
47
|
if (configValue !== null && configValue !== undefined) {
|
|
49
48
|
setValue(configValue);
|
|
50
|
-
} else {
|
|
51
|
-
setValue(valueDefault);
|
|
52
49
|
}
|
|
53
50
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
54
51
|
}, [JSON.stringify(configValues)]);
|
|
@@ -14,6 +14,35 @@ import Connecting from '../Connecting';
|
|
|
14
14
|
import { useSCContextSelector } from '../../context';
|
|
15
15
|
import { ToastBottomHelper } from '../../utils/Utils';
|
|
16
16
|
|
|
17
|
+
const ConnectingSuccess = ({
|
|
18
|
+
unit,
|
|
19
|
+
sensor,
|
|
20
|
+
station,
|
|
21
|
+
unit_name,
|
|
22
|
+
newName,
|
|
23
|
+
setNewName,
|
|
24
|
+
}) => {
|
|
25
|
+
const t = useTranslations();
|
|
26
|
+
return (
|
|
27
|
+
<View style={styles.ConnectingSuccess}>
|
|
28
|
+
<ImageSuccessfully />
|
|
29
|
+
<Text bold style={styles.connectingText}>
|
|
30
|
+
{t('successfully_connected')}
|
|
31
|
+
</Text>
|
|
32
|
+
<Text size={14} style={styles.textHome}>
|
|
33
|
+
{`${unit?.name || unit_name} ${
|
|
34
|
+
station?.name !== undefined ? '- ' + station?.name : ''
|
|
35
|
+
}`}
|
|
36
|
+
</Text>
|
|
37
|
+
<DeviceItem
|
|
38
|
+
icon={sensor?.icon_kit}
|
|
39
|
+
name={newName}
|
|
40
|
+
setNewName={setNewName}
|
|
41
|
+
/>
|
|
42
|
+
</View>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
17
46
|
const ConnectingProcess = ({ route }) => {
|
|
18
47
|
const { navigate, goBack } = useNavigation();
|
|
19
48
|
const t = useTranslations();
|
|
@@ -34,7 +63,7 @@ const ConnectingProcess = ({ route }) => {
|
|
|
34
63
|
const user = useSCContextSelector((state) => state?.auth?.account?.user);
|
|
35
64
|
const [newName, setNewName] = useState('');
|
|
36
65
|
|
|
37
|
-
const
|
|
66
|
+
const connectingDevice = useCallback(async () => {
|
|
38
67
|
setIsLoading(true);
|
|
39
68
|
switch (devicePrefixName) {
|
|
40
69
|
case 'SENSOR': {
|
|
@@ -106,27 +135,6 @@ const ConnectingProcess = ({ route }) => {
|
|
|
106
135
|
unit_id,
|
|
107
136
|
]);
|
|
108
137
|
|
|
109
|
-
const ConnectingSuccess = useCallback(() => {
|
|
110
|
-
return (
|
|
111
|
-
<View style={styles.ConnectingSuccess}>
|
|
112
|
-
<ImageSuccessfully />
|
|
113
|
-
<Text bold style={styles.connectingText}>
|
|
114
|
-
{t('successfully_connected')}
|
|
115
|
-
</Text>
|
|
116
|
-
<Text size={14} style={styles.textHome}>
|
|
117
|
-
{`${unit?.name || unit_name} ${
|
|
118
|
-
station?.name !== undefined ? '- ' + station?.name : ''
|
|
119
|
-
}`}
|
|
120
|
-
</Text>
|
|
121
|
-
<DeviceItem
|
|
122
|
-
icon={sensor?.icon_kit}
|
|
123
|
-
name={newName}
|
|
124
|
-
setNewName={setNewName}
|
|
125
|
-
/>
|
|
126
|
-
</View>
|
|
127
|
-
);
|
|
128
|
-
}, [newName, sensor?.icon_kit, station?.name, t, unit?.name, unit_name]);
|
|
129
|
-
|
|
130
138
|
const handleDone = useCallback(async () => {
|
|
131
139
|
let result, message;
|
|
132
140
|
switch (devicePrefixName) {
|
|
@@ -178,8 +186,8 @@ const ConnectingProcess = ({ route }) => {
|
|
|
178
186
|
]);
|
|
179
187
|
|
|
180
188
|
useEffect(() => {
|
|
181
|
-
|
|
182
|
-
}, [
|
|
189
|
+
connectingDevice();
|
|
190
|
+
}, [connectingDevice]);
|
|
183
191
|
|
|
184
192
|
return (
|
|
185
193
|
<SafeAreaView style={styles.wrap}>
|
|
@@ -188,7 +196,16 @@ const ConnectingProcess = ({ route }) => {
|
|
|
188
196
|
{t('connect_device')}
|
|
189
197
|
</Text>
|
|
190
198
|
{!!isLoading && <Connecting isLoading={isLoading} />}
|
|
191
|
-
{!isLoading &&
|
|
199
|
+
{!isLoading && (
|
|
200
|
+
<ConnectingSuccess
|
|
201
|
+
unit={unit}
|
|
202
|
+
sensor={sensor}
|
|
203
|
+
station={station}
|
|
204
|
+
unit_name={unit_name}
|
|
205
|
+
newName={newName}
|
|
206
|
+
setNewName={setNewName}
|
|
207
|
+
/>
|
|
208
|
+
)}
|
|
192
209
|
</View>
|
|
193
210
|
{!isLoading && (
|
|
194
211
|
<TouchableOpacity style={styles.buttonDone} onPress={handleDone}>
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
|
-
import { Colors } from '../../configs';
|
|
2
|
+
import { Colors, Constants } from '../../configs';
|
|
3
|
+
|
|
4
|
+
const marginItem = 12;
|
|
5
|
+
const marginHorizontal = 16;
|
|
6
|
+
const widthItem = (Constants.width - marginHorizontal * 2 - marginItem) / 2;
|
|
7
|
+
const heightItem = (widthItem / 166) * 126;
|
|
3
8
|
|
|
4
9
|
export default StyleSheet.create({
|
|
5
10
|
container: {
|
|
@@ -71,6 +76,10 @@ export default StyleSheet.create({
|
|
|
71
76
|
margin: 0,
|
|
72
77
|
padding: 0,
|
|
73
78
|
},
|
|
79
|
+
wrapItemStyle: {
|
|
80
|
+
height: heightItem,
|
|
81
|
+
marginVertical: 0,
|
|
82
|
+
},
|
|
74
83
|
camera: {
|
|
75
84
|
width: 1,
|
|
76
85
|
height: 1,
|