@eohjsc/react-native-smart-city 0.4.55 → 0.4.56

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.55",
4
+ "version": "0.4.56",
5
5
  "description": "TODO",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -58,7 +58,7 @@ const ItemQuickAction = memo(
58
58
 
59
59
  const userId = useSCContextSelector((state) => state?.auth.account.user.id);
60
60
  const onActionPress = useCallback(async () => {
61
- if (processing) {
61
+ if (processing || !action) {
62
62
  /* istanbul ignore next */
63
63
  return;
64
64
  }
@@ -98,10 +98,6 @@ const ItemQuickAction = memo(
98
98
  on_action?.id,
99
99
  ]);
100
100
 
101
- if (!action) {
102
- return <View />;
103
- }
104
-
105
101
  return (
106
102
  <TouchableOpacity
107
103
  accessibilityLabel={`${AccessibilityLabel.ITEM_QUICK_ACTION_PRESS}-${sensor?.id}`}
@@ -7,6 +7,7 @@ import { AccessibilityLabel } from '../../../configs/Constants';
7
7
  import { factory } from 'factory-girl';
8
8
  import IconComponent from '../../IconComponent';
9
9
  import { IconOutline } from '@ant-design/icons-react-native';
10
+ import Toast from 'react-native-toast-message';
10
11
 
11
12
  class Sensor {}
12
13
 
@@ -67,13 +68,16 @@ describe('Test ItemQuickAction', () => {
67
68
  tree = await create(<ItemQuickAction sensor={newSensor} />);
68
69
  });
69
70
  const instance = tree.root;
70
- const buttonOnActionPress = instance.findAll(
71
+ const buttonOnActionPress = instance.find(
71
72
  (el) =>
72
73
  el.props.accessibilityLabel ===
73
74
  `${AccessibilityLabel.ITEM_QUICK_ACTION_PRESS}-${sensor?.id}` &&
74
75
  el.type === TouchableOpacity
75
76
  );
76
- expect(buttonOnActionPress).toHaveLength(0);
77
+ await act(async () => {
78
+ await buttonOnActionPress.props.onPress();
79
+ });
80
+ expect(Toast.show).not.toBeCalled();
77
81
  });
78
82
 
79
83
  it('click quick action icon down , isSendingCommand = true', async () => {