@eohjsc/react-native-smart-city 0.4.2 → 0.4.21

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.02",
4
+ "version": "0.4.21",
5
5
  "description": "TODO",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -177,7 +177,6 @@
177
177
  "react-native-image-resizer": "^1.4.5",
178
178
  "react-native-input-credit-card": "^0.5.5",
179
179
  "react-native-iphone-x-helper": "^1.2.1",
180
- "react-native-keyboard-aware-scroll-view": "^0.9.5",
181
180
  "react-native-linear-gradient": "^2.5.6",
182
181
  "react-native-localize": "^1.4.1",
183
182
  "react-native-maps": "0.27.1",
@@ -3,7 +3,6 @@ import {
3
3
  Animated,
4
4
  Platform,
5
5
  RefreshControl,
6
- SafeAreaView,
7
6
  StyleSheet,
8
7
  View,
9
8
  } from 'react-native';
@@ -50,8 +49,7 @@ const WrapHeaderScrollable = ({
50
49
  );
51
50
 
52
51
  return (
53
- // NOTE: We have problem if don't use SafeAreaView in here. Hinh will remove it later
54
- <SafeAreaView style={[styles.container, headerAniStyle]}>
52
+ <View style={[styles.container, headerAniStyle]}>
55
53
  <HeaderAni
56
54
  scrollY={animatedScrollYValue}
57
55
  contentHeight={contentHeight}
@@ -105,7 +103,7 @@ const WrapHeaderScrollable = ({
105
103
  </View>
106
104
  )}
107
105
  </Animated.ScrollView>
108
- </SafeAreaView>
106
+ </View>
109
107
  );
110
108
  };
111
109
 
@@ -101,17 +101,18 @@ const stickyHeaderHeight =
101
101
  const styles = StyleSheet.create({
102
102
  container: {
103
103
  flexDirection: 'row',
104
- height: stickyHeaderHeight,
104
+ height: stickyHeaderHeight + getStatusBarHeight(),
105
105
  alignItems: 'center',
106
106
  justifyContent: 'space-between',
107
107
  width: '100%',
108
- paddingTop: getStatusBarHeight(true),
108
+ paddingTop: 15,
109
109
  },
110
110
  btnLeft: {
111
111
  height: '100%',
112
112
  paddingHorizontal: 8,
113
113
  justifyContent: 'center',
114
114
  alignItems: 'center',
115
+ width: 40,
115
116
  },
116
117
  boxRight: {
117
118
  flexDirection: 'row',
@@ -126,10 +127,10 @@ const styles = StyleSheet.create({
126
127
  },
127
128
  btnMore: {
128
129
  height: '100%',
129
- width: 32,
130
130
  justifyContent: 'center',
131
131
  alignItems: 'center',
132
132
  marginRight: 16,
133
+ width: 40,
133
134
  },
134
135
  txtHeader: {
135
136
  fontSize: 16,
@@ -28,6 +28,7 @@ describe('Test HeaderUnit', () => {
28
28
  paddingHorizontal: 8,
29
29
  justifyContent: 'center',
30
30
  alignItems: 'center',
31
+ width: 40,
31
32
  };
32
33
  await act(async () => {
33
34
  tree = await create(
@@ -1,5 +1,6 @@
1
1
  import React, { useCallback, useMemo } from 'react';
2
2
  import { TouchableOpacity, View } from 'react-native';
3
+ import { KeyboardAwareScrollView } from '@eohjsc/react-native-keyboard-aware-scroll-view';
3
4
 
4
5
  import styles from './Styles/SelectActionStyles';
5
6
  import WrapHeaderScrollable from '../../../commons/Sharing/WrapHeaderScrollable';
@@ -8,7 +9,6 @@ import { Colors } from '../../../configs';
8
9
  import { useNavigation, useRoute } from '@react-navigation/native';
9
10
  import BottomButtonView from '../../../commons/BottomButtonView';
10
11
  import { AccessibilityLabel } from '../../../configs/Constants';
11
- import { KeyboardAwareScrollView } from '@eohjsc/react-native-keyboard-aware-scroll-view';
12
12
 
13
13
  const NewActionWrapper = ({ name, children, canNext, onNext, nextTitle }) => {
14
14
  const { navigate } = useNavigation();
@@ -34,15 +34,19 @@ const NewActionWrapper = ({ name, children, canNext, onNext, nextTitle }) => {
34
34
 
35
35
  return (
36
36
  <View style={styles.wrap}>
37
- <KeyboardAwareScrollView enableOnAndroid extraScrollHeight={100}>
38
- <WrapHeaderScrollable
39
- title={name}
40
- headerAniStyle={styles.headerAniStyle}
41
- rightComponent={rightComponent}
37
+ <WrapHeaderScrollable
38
+ title={name}
39
+ headerAniStyle={styles.headerAniStyle}
40
+ rightComponent={rightComponent}
41
+ >
42
+ <KeyboardAwareScrollView
43
+ enableOnAndroid
44
+ extraScrollHeight={100}
45
+ nestedScrollEnabled
42
46
  >
43
47
  {children}
44
- </WrapHeaderScrollable>
45
- </KeyboardAwareScrollView>
48
+ </KeyboardAwareScrollView>
49
+ </WrapHeaderScrollable>
46
50
 
47
51
  <BottomButtonView
48
52
  style={styles.bottomButtonView}
@@ -22,7 +22,11 @@ const SetupConfigCondition = () => {
22
22
 
23
23
  const [isShowModal, setIsShowModal] = useState(false);
24
24
  const [itemActiveModal, setItemActiveModal] = useState(defaultCondition);
25
- const [value, setValue] = useState(defaultCondition?.value || '');
25
+ const [value, setValue] = useState(
26
+ [undefined, null].includes(defaultCondition?.value)
27
+ ? ''
28
+ : String(defaultCondition?.value)
29
+ );
26
30
 
27
31
  const hasNoValueEvaluation = !item?.evaluate_configuration;
28
32
 
@@ -71,12 +75,12 @@ const SetupConfigCondition = () => {
71
75
  const conditionValue = itemActiveModal?.value;
72
76
 
73
77
  if (isNaN(parseFloat(conditionValue)) || !isFinite(conditionValue)) {
74
- ToastBottomHelper.error(t('value_must_be_a_number'));
78
+ ToastBottomHelper.error(t('please_enter_a_number'));
75
79
  return;
76
80
  }
77
81
 
78
- if (Math.abs(conditionValue)?.toString()?.length > 6) {
79
- ToastBottomHelper.error(t('value_must_be_6_digits_or_less'));
82
+ if (Math.abs(conditionValue)?.toString()?.length > 8) {
83
+ ToastBottomHelper.error(t('value_must_be_less_than_8_character'));
80
84
  return;
81
85
  }
82
86
 
@@ -87,6 +91,7 @@ const SetupConfigCondition = () => {
87
91
  newCondition: {
88
92
  ...itemActiveModal,
89
93
  config: item.id,
94
+ value: Number(conditionValue),
90
95
  },
91
96
  },
92
97
  });
@@ -146,7 +151,6 @@ const SetupConfigCondition = () => {
146
151
  textInputStyle={styles.value}
147
152
  wrapStyle={styles.wrapValue}
148
153
  value={value}
149
- keyboardType={'numeric'}
150
154
  onChange={onChangeValue}
151
155
  />
152
156
  </View>
@@ -115,9 +115,12 @@ describe('Test SetupConfigCondition', () => {
115
115
  };
116
116
 
117
117
  it('Test render when have input not number', async () => {
118
- await testConditionValue('abc', 'Value must be a number');
118
+ await testConditionValue('abc', 'Please enter a number');
119
119
  });
120
120
  it('Test render when have input value must be 6 digits or less', async () => {
121
- await testConditionValue('1234567', 'Value must be 6 digits or less');
121
+ await testConditionValue(
122
+ '123456789',
123
+ 'Value must be less than or equal to 8 characters'
124
+ );
122
125
  });
123
126
  });
@@ -173,6 +173,7 @@ const InfoMemberUnit = memo(({ route }) => {
173
173
  styleButtonLeftText={styles.textButton}
174
174
  onLeftClick={() => setIsShowWarning(false)}
175
175
  onRightClick={handleChangeOwner}
176
+ wrapStyle={styles.wrapButtonBottom}
176
177
  />
177
178
  </>
178
179
  );
@@ -100,4 +100,7 @@ export default StyleSheet.create({
100
100
  textButton: {
101
101
  color: Colors.Gray9,
102
102
  },
103
+ wrapButtonBottom: {
104
+ position: 'relative',
105
+ },
103
106
  });
@@ -21,6 +21,6 @@ describe('Test GatewayList', () => {
21
21
  });
22
22
  const instance = tree.root;
23
23
  const Views = instance.findAllByType(View);
24
- expect(Views).toHaveLength(12);
24
+ expect(Views).toHaveLength(13);
25
25
  });
26
26
  });
@@ -11,6 +11,6 @@ describe('Test Information', () => {
11
11
  });
12
12
  const instance = tree.root;
13
13
  const Views = instance.findAllByType(View);
14
- expect(Views).toHaveLength(13);
14
+ expect(Views).toHaveLength(14);
15
15
  });
16
16
  });
@@ -1395,7 +1395,7 @@ export default {
1395
1395
  'To provide a better user experience, [Era] will perform a system upgrade.The upgrade will take about 10 ' +
1396
1396
  'minutes.\n\n Some device control functions will be interrupted during the upgrade.[Era] would like to ask ' +
1397
1397
  'for your understanding for this inconvenience.\n\nBest regards.',
1398
- value_must_be_a_number: 'Value must be a number',
1398
+ please_enter_a_number: 'Please enter a number',
1399
1399
  reach_max_stations_per_unit:
1400
1400
  'Sub-unit is incomplete. Please visit app.e-ra.io to complete your operation.',
1401
1401
  not_support_plug_and_play: 'Not support plug and play',
@@ -1423,5 +1423,6 @@ export default {
1423
1423
  'Smart script for Multi Unit is incomplete. Please visit app.e-ra.io to complete your operation.',
1424
1424
  you_can_only_add_more: 'You can only add more {number}',
1425
1425
  actions: 'actions',
1426
- value_must_be_6_digits_or_less: 'Value must be 6 digits or less',
1426
+ value_must_be_less_than_8_character:
1427
+ 'Value must be less than or equal to 8 characters',
1427
1428
  };
@@ -1405,7 +1405,7 @@ export default {
1405
1405
  '[Era] kính mong quý khách hàng thông cảm cho sự bất tiện này.\n\nTrân trọng ',
1406
1406
  value_must_be_greater_than_min: 'Giá trị phải lớn hơn {min}',
1407
1407
  value_must_be_less_than_max: 'Giá trị phải nhỏ hơn {max}',
1408
- value_must_be_a_number: 'Giá trị phải một số',
1408
+ please_enter_a_number: 'Vui lòng nhập một số',
1409
1409
  reach_max_stations_per_unit:
1410
1410
  'Sub-unit chưa hoàn tất. Hãy truy cập app.e-ra.io để hoàn thiện thao tác của bạn.',
1411
1411
  not_support_plug_and_play: 'Không hỗ trợ kết nối tự động',
@@ -1433,5 +1433,6 @@ export default {
1433
1433
  'Kịch bản thông minh cho nhiều địa điểm chưa hoàn tất. Hãy truy cập app.e-ra.io để hoàn thiện thao tác của bạn.',
1434
1434
  you_can_only_add_more: 'Bạn chỉ có thể thêm {number}',
1435
1435
  actions: 'hành động',
1436
- value_must_be_6_digits_or_less: 'Giá trị phải nhỏ hơn 6 chữ số',
1436
+ value_must_be_less_than_8_character: 'Giá trị phải ít hơn hoặc bằng 8 kí tự',
1437
+ name_your_automation: 'Đặt tên cho kịch bản của bạn',
1437
1438
  };