@eohjsc/react-native-smart-city 0.3.16 → 0.3.17
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
|
@@ -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}>
|