@eohjsc/react-native-smart-city 0.3.12 → 0.3.13
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 +1 -1
- package/src/commons/Action/ItemQuickAction.js +1 -1
- package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +2 -0
- package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +1 -1
- package/src/commons/ActionGroup/__test__/index.test.js +1 -1
- package/src/commons/Device/ItemDevice.js +2 -2
- package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +5 -1
- package/src/screens/UnitSummary/components/RunningDevices/index.js +3 -1
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@ import { useRemoteControl } from '../../hooks/IoT';
|
|
|
7
7
|
import { useConfigGlobalState } from '../../iot/states';
|
|
8
8
|
import IconComponent from '../IconComponent';
|
|
9
9
|
|
|
10
|
-
const ItemQuickAction = memo(({ sensor, wrapperStyle, setStatus
|
|
10
|
+
const ItemQuickAction = memo(({ sensor, wrapperStyle, setStatus }) => {
|
|
11
11
|
const [isSendingCommand, setIsSendingCommand] = useState(false);
|
|
12
12
|
const [action, setAction] = useState(sensor.action);
|
|
13
13
|
// eslint-disable-next-line no-unused-vars
|
|
@@ -47,6 +47,8 @@ const NumberUpDownActionTemplate = ({ actionGroup, doAction, sensor }) => {
|
|
|
47
47
|
const configValue = configValues[config];
|
|
48
48
|
if (configValue !== null && configValue !== undefined) {
|
|
49
49
|
setValue(configValue);
|
|
50
|
+
} else {
|
|
51
|
+
setValue(valueDefault);
|
|
50
52
|
}
|
|
51
53
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
54
|
}, [JSON.stringify(configValues)]);
|
|
@@ -326,7 +326,7 @@ describe('Test NumberUpDownActionTemplate', () => {
|
|
|
326
326
|
});
|
|
327
327
|
const instance = wrapper.root;
|
|
328
328
|
const text = instance.findAllByType(ActivityIndicator);
|
|
329
|
-
expect(text).toHaveLength(
|
|
329
|
+
expect(text).toHaveLength(0);
|
|
330
330
|
});
|
|
331
331
|
test('action up sensor device type is GOOGLE_HOME', async () => {
|
|
332
332
|
const mockDoAction = jest.fn();
|
|
@@ -363,7 +363,7 @@ describe('Test ActionGroup', () => {
|
|
|
363
363
|
});
|
|
364
364
|
const instance = wrapper.root;
|
|
365
365
|
const activity = instance.findAllByType(ActivityIndicator);
|
|
366
|
-
expect(activity.length).toEqual(
|
|
366
|
+
expect(activity.length).toEqual(0);
|
|
367
367
|
});
|
|
368
368
|
|
|
369
369
|
test('render ActionGroup StatesGridActionTemplate', async () => {
|
|
@@ -82,7 +82,7 @@ const ItemDevice = memo(
|
|
|
82
82
|
const textConnected = isConnected
|
|
83
83
|
? t('connected')
|
|
84
84
|
: isConnecting
|
|
85
|
-
? ''
|
|
85
|
+
? t('connecting')
|
|
86
86
|
: t('disconnected');
|
|
87
87
|
|
|
88
88
|
return (
|
|
@@ -98,7 +98,7 @@ const ItemDevice = memo(
|
|
|
98
98
|
<TouchableOpacity onPress={goToSensorDisplay}>
|
|
99
99
|
<IconComponent icon={sensor.icon} iconKit={sensor.icon_kit} />
|
|
100
100
|
</TouchableOpacity>
|
|
101
|
-
<ItemQuickAction sensor={sensor} unit={unit} />
|
|
101
|
+
{!isConnecting && <ItemQuickAction sensor={sensor} unit={unit} />}
|
|
102
102
|
</View>
|
|
103
103
|
<TouchableOpacity onPress={goToSensorDisplay}>
|
|
104
104
|
<Text
|
|
@@ -19,16 +19,20 @@ const NumberUpDownActionTemplate = memo(({ data, onSelectAction }) => {
|
|
|
19
19
|
const { configuration, template, title } = data;
|
|
20
20
|
const { config, text_format, min_value, max_value, action } = configuration;
|
|
21
21
|
const [configValues] = useConfigGlobalState('configValues');
|
|
22
|
-
const [value, setValue] = useState(
|
|
22
|
+
const [value, setValue] = useState();
|
|
23
23
|
const [actionName, setActionName] = useState(null);
|
|
24
|
+
const valueDefault = 28;
|
|
24
25
|
|
|
25
26
|
useEffect(() => {
|
|
26
27
|
if (!config) {
|
|
28
|
+
setValue(valueDefault);
|
|
27
29
|
return;
|
|
28
30
|
}
|
|
29
31
|
const configValue = configValues[config];
|
|
30
32
|
if (configValue !== null && configValue !== undefined) {
|
|
31
33
|
setValue(configValue);
|
|
34
|
+
} else {
|
|
35
|
+
setValue(valueDefault);
|
|
32
36
|
}
|
|
33
37
|
}, [configValues, config]);
|
|
34
38
|
|
|
@@ -19,7 +19,9 @@ const RunningDevices = memo(({ unit, summaryDetail }) => {
|
|
|
19
19
|
await connectGoogleHome(unit.remote_control_options.googlehome))();
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
23
|
+
}, [unit]);
|
|
24
|
+
|
|
23
25
|
return (
|
|
24
26
|
<View style={styles.container}>
|
|
25
27
|
{!!devices &&
|