@eohjsc/react-native-smart-city 0.4.79 → 0.4.80

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@eohjsc/react-native-smart-city",
3
3
  "title": "React Native Smart Home",
4
- "version": "0.4.79",
4
+ "version": "0.4.80",
5
5
  "description": "TODO",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -18,6 +18,7 @@ const ItemQuickAction = memo(
18
18
  off_status,
19
19
  interval,
20
20
  will_auto_update_status,
21
+ on_state_values,
21
22
  } = quick_action || {};
22
23
  const [action, setAction] = useState(sensor?.action);
23
24
  // eslint-disable-next-line no-unused-vars
@@ -29,9 +30,16 @@ const ItemQuickAction = memo(
29
30
  const sendRemoteCommand = useRemoteControl();
30
31
  const [processing, setProcessing] = useState(false);
31
32
 
33
+ const getIsOnValue = useCallback(() => {
34
+ if (on_state_values && on_state_values.length > 0) {
35
+ return on_state_values.includes(currentValue);
36
+ }
37
+ return !!currentValue;
38
+ }, [currentValue, on_state_values]);
39
+
32
40
  useEffect(() => {
33
- setIsOn(currentValue);
34
- }, [currentValue]);
41
+ setIsOn(getIsOnValue());
42
+ }, [getIsOnValue]);
35
43
 
36
44
  useEffect(() => {
37
45
  if (!quick_action) {
@@ -33,14 +33,14 @@ describe('Test ItemQuickAction', () => {
33
33
  config_id: 51,
34
34
  interval: 5000,
35
35
  off_action: {
36
- icon: 'down',
36
+ icon: 'on',
37
37
  command_prefer_over_bluetooth: true,
38
38
  command_prefer_over_googlehome: false,
39
39
  command_prefer_over_internet: false,
40
40
  id: 10,
41
41
  },
42
42
  on_action: {
43
- icon: 'up',
43
+ icon: 'off',
44
44
  command_prefer_over_bluetooth: true,
45
45
  command_prefer_over_googlehome: false,
46
46
  command_prefer_over_internet: false,
@@ -258,4 +258,30 @@ describe('Test ItemQuickAction', () => {
258
258
  });
259
259
  expect(Toast.show).not.toBeCalled();
260
260
  });
261
+ it('test config value 0 on_state_values 0', async () => {
262
+ sensor.quick_action.on_state_values = [0];
263
+ const globalStates = require('../../../iot/states');
264
+ globalStates.useConfigGlobalState = () => [{ 51: { value: 0 } }, null];
265
+
266
+ await act(async () => {
267
+ tree = await create(
268
+ <ItemQuickAction sensor={sensor} wrapperStyle={style} />
269
+ );
270
+ });
271
+ const icon = tree.root.findByType(IconComponent);
272
+ expect(icon.props.icon).toEqual(sensor.quick_action.off_action.icon);
273
+ });
274
+ it('test config value 0 on_state_values 1', async () => {
275
+ sensor.quick_action.on_state_values = [1];
276
+ const globalStates = require('../../../iot/states');
277
+ globalStates.useConfigGlobalState = () => [{ 51: { value: 0 } }, null];
278
+
279
+ await act(async () => {
280
+ tree = await create(
281
+ <ItemQuickAction sensor={sensor} wrapperStyle={style} />
282
+ );
283
+ });
284
+ const icon = tree.root.findByType(IconComponent);
285
+ expect(icon.props.icon).toEqual(sensor.quick_action.on_action.icon);
286
+ });
261
287
  });
@@ -46,7 +46,7 @@ const QualityIndicatorItem = memo(
46
46
  <Text size={24} color={Colors.Gray9} style={styles.txtValue}>
47
47
  {measure && measure.length ? `${value} ${measure}` : `${value}`}
48
48
  </Text>
49
- {!!evaluate && (
49
+ {!!evaluate?.color && (
50
50
  <Text size={12} color={evaluate.color} style={styles.txtEvaluate}>
51
51
  {evaluate.text}
52
52
  </Text>
@@ -148,6 +148,7 @@ const SharingInviteMembers = ({ route }) => {
148
148
  </View>
149
149
  </TouchableWithoutFeedback>
150
150
  <ViewButtonBottom
151
+ disableKeyBoardAnimated={true}
151
152
  leftTitle={t('back')}
152
153
  onLeftClick={() => navigation.goBack()}
153
154
  rightTitle={t('done')}
@@ -64,7 +64,6 @@ export default StyleSheet.create({
64
64
  fontStyle: 'normal',
65
65
  },
66
66
  wrapViewButtonStyle: {
67
- paddingTop: 90,
68
- marginBottom: 30,
67
+ paddingTop: 70,
69
68
  },
70
69
  });