@eohjsc/react-native-smart-city 0.3.7 → 0.3.8
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
|
@@ -12,22 +12,22 @@ const OnOffSimpleTemplate = ({
|
|
|
12
12
|
actionGroup,
|
|
13
13
|
disabled,
|
|
14
14
|
}) => {
|
|
15
|
-
const isEnabled = !!isOn;
|
|
16
|
-
|
|
17
15
|
return (
|
|
18
16
|
<View style={styles.wrap}>
|
|
19
17
|
<View style={styles.iconAndText}>
|
|
20
18
|
<IconOutline name="poweroff" size={20} style={styles.marginRight} />
|
|
21
19
|
<Text type="H4">{actionGroup.title}</Text>
|
|
22
20
|
</View>
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
{isOn !== null && (
|
|
22
|
+
<Switch
|
|
23
|
+
trackColor={{ false: Colors.Gray4, true: Colors.Primary }}
|
|
24
|
+
thumbColor={isOn ? Colors.White : Colors.Gray6}
|
|
25
|
+
ios_backgroundColor={Colors.Gray4}
|
|
26
|
+
onValueChange={triggerAction}
|
|
27
|
+
value={!!isOn}
|
|
28
|
+
disabled={disabled}
|
|
29
|
+
/>
|
|
30
|
+
)}
|
|
31
31
|
</View>
|
|
32
32
|
);
|
|
33
33
|
};
|
|
@@ -20,7 +20,8 @@ const getComponent = (template) => {
|
|
|
20
20
|
const OnOffTemplate = memo(({ actionGroup, doAction, sensor }) => {
|
|
21
21
|
const { configuration } = actionGroup;
|
|
22
22
|
const { action_data, action_on_data, action_off_data } = configuration;
|
|
23
|
-
const [isOn, setIsOn] = useState(
|
|
23
|
+
const [isOn, setIsOn] = useState(null);
|
|
24
|
+
|
|
24
25
|
// eslint-disable-next-line no-unused-vars
|
|
25
26
|
const [configValues, _] = useConfigGlobalState('configValues');
|
|
26
27
|
|
|
@@ -105,7 +106,7 @@ const OnOffTemplate = memo(({ actionGroup, doAction, sensor }) => {
|
|
|
105
106
|
if (sensor?.device_type === DEVICE_TYPE.LG_THINQ) {
|
|
106
107
|
return;
|
|
107
108
|
}
|
|
108
|
-
if (sensor?.is_managed_by_backend) {
|
|
109
|
+
if (sensor?.is_managed_by_backend && sensor.device_type !== 'GOOGLE_HOME') {
|
|
109
110
|
watchMultiConfigs([configuration.config]);
|
|
110
111
|
}
|
|
111
112
|
}, [sensor, configuration.config]);
|