@eohjsc/react-native-smart-city 0.3.45 → 0.3.47
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 +3 -2
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/index.js +3 -3
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/ItemPasscode.js +3 -3
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/index.js +3 -3
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/index.js +5 -5
- package/src/commons/Auth/AccountItem.js +7 -1
- package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +1 -1
- package/src/commons/Dashboard/MyUnit/index.js +1 -1
- package/src/commons/Sharing/RowMember.js +15 -3
- package/src/commons/Sharing/WrapHeaderScrollable.js +4 -4
- package/src/configs/AccessibilityLabel.js +8 -0
- package/src/screens/AQIGuide/index.js +6 -11
- package/src/screens/AddNewDevice/index.js +7 -23
- package/src/screens/AddNewGateway/AddNewGatewayStyles.js +3 -6
- package/src/screens/AddNewGateway/ConnectingWifiGuide.js +1 -0
- package/src/screens/AddNewGateway/SelectDeviceType.js +1 -1
- package/src/screens/AddNewGateway/ShareWifiPassword.js +1 -0
- package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +2 -2
- package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +2 -2
- package/src/screens/AddNewGateway/index.js +4 -4
- package/src/screens/AddNewOneTap/AddNewOneTapStyles.js +2 -8
- package/src/screens/AddNewOneTap/index.js +3 -9
- package/src/screens/Drawer/Drawer.test.js +51 -8
- package/src/screens/Drawer/index.js +7 -6
- package/src/screens/Explore/__test__/Explore.test.js +3 -3
- package/src/screens/Explore/index.js +4 -4
- package/src/screens/Sharing/Components/CheckBoxCustom.js +7 -2
- package/src/screens/Sharing/Components/TitleCheckBox.js +1 -0
- package/src/screens/Sharing/InfoMemberUnit.js +3 -0
- package/src/screens/Sharing/SelectPermission.js +4 -19
- package/src/screens/Sharing/SelectUser.js +9 -5
- package/src/screens/Sharing/Styles/SelectPermissionStyles.js +4 -8
- package/src/screens/SmartAccount/Connecting/index.js +3 -3
- package/src/screens/SmartAccount/Connecting/style.js +1 -1
- package/src/screens/SmartAccount/ListDevice/__test__/ListDevice.test.js +1 -3
- package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +1 -4
- package/src/screens/SmartAccount/SuccessfullyConnected/index.js +3 -3
- package/src/screens/SmartAccount/SuccessfullyConnected/styles.js +1 -1
- package/src/screens/SubUnit/AddSubUnit.js +4 -10
- package/src/screens/SubUnit/AddSubUnitStyles.js +2 -2
- package/src/screens/SyncLGDevice/AddLGDevice.js +4 -4
- package/src/screens/SyncLGDevice/AddLGDeviceStyles.js +2 -0
- package/src/screens/Template/__test__/GatewayList.test.js +1 -1
- package/src/screens/Template/__test__/Information.test.js +1 -1
- package/src/screens/UVIndexGuide/index.js +5 -9
- package/src/screens/Unit/MyAllUnit/index.js +5 -3
- package/src/screens/Unit/components/MyAllUnit/__test__/MyAllUnit.test.js +3 -3
- package/src/screens/Unit/components/MyAllUnit/index.js +5 -3
- package/src/screens/Unit/components/MyUnitDevice/index.js +1 -1
- package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +39 -0
- package/src/screens/WaterQualityGuide/index.js +10 -4
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.3.
|
|
4
|
+
"version": "0.3.47",
|
|
5
5
|
"description": "TODO",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"files": [
|
|
@@ -65,7 +65,8 @@
|
|
|
65
65
|
"licenseFilename": "LICENSE",
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"react": "*",
|
|
68
|
-
"react-native": "*"
|
|
68
|
+
"react-native": "*",
|
|
69
|
+
"@react-native-community/clipboard": "*"
|
|
69
70
|
},
|
|
70
71
|
"devDependencies": {
|
|
71
72
|
"@babel/core": "^7.12.9",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { memo, useCallback, useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { View } from 'react-native';
|
|
3
3
|
import Slider from 'react-native-slider';
|
|
4
4
|
import Text from '../../../Text';
|
|
5
5
|
import { HeaderCustom } from '../../../Header';
|
|
@@ -16,7 +16,7 @@ const AutoLock = memo(() => {
|
|
|
16
16
|
setIsEnabled((previousState) => !previousState);
|
|
17
17
|
}, []);
|
|
18
18
|
return (
|
|
19
|
-
<
|
|
19
|
+
<View style={styles.container}>
|
|
20
20
|
<HeaderCustom title={t('auto_lock')} isShowSeparator />
|
|
21
21
|
<View style={styles.wrap}>
|
|
22
22
|
<Text style={styles.textAutoLock}>{t('auto_lock')}</Text>
|
|
@@ -50,7 +50,7 @@ const AutoLock = memo(() => {
|
|
|
50
50
|
</View>
|
|
51
51
|
<Text style={styles.textReLock}>{t('re_lock_will_lock')}</Text>
|
|
52
52
|
</View>
|
|
53
|
-
</
|
|
53
|
+
</View>
|
|
54
54
|
);
|
|
55
55
|
});
|
|
56
56
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { memo } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { View, TouchableOpacity } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import Text from '../../../Text';
|
|
5
5
|
import { HeaderCustom } from '../../../Header';
|
|
@@ -22,7 +22,7 @@ const ItemPasscode = memo(({ route }) => {
|
|
|
22
22
|
const { item = {} } = route?.params || {};
|
|
23
23
|
|
|
24
24
|
return (
|
|
25
|
-
<
|
|
25
|
+
<View style={styles.container}>
|
|
26
26
|
<HeaderCustom isShowSeparator title={item.code} />
|
|
27
27
|
<ButtonWrapper textHeadline={t('code')} item={item.code} />
|
|
28
28
|
<ButtonWrapper textHeadline={t('user')} item={item.name} />
|
|
@@ -41,7 +41,7 @@ const ItemPasscode = memo(({ route }) => {
|
|
|
41
41
|
{t('delete_passcode')}
|
|
42
42
|
</Text>
|
|
43
43
|
</TouchableOpacity>
|
|
44
|
-
</
|
|
44
|
+
</View>
|
|
45
45
|
);
|
|
46
46
|
});
|
|
47
47
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { memo, useCallback, useMemo } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { TextInput, View, TouchableOpacity } from 'react-native';
|
|
3
3
|
import { IconOutline } from '@ant-design/icons-react-native';
|
|
4
4
|
import { useNavigation } from '@react-navigation/native';
|
|
5
5
|
|
|
@@ -34,7 +34,7 @@ const PasscodeList = memo(() => {
|
|
|
34
34
|
[navigation]
|
|
35
35
|
);
|
|
36
36
|
return (
|
|
37
|
-
<
|
|
37
|
+
<View style={styles.container}>
|
|
38
38
|
<HeaderCustom title={t('passcode_list')} />
|
|
39
39
|
<View style={styles.wrap}>
|
|
40
40
|
<View style={styles.searchBox}>
|
|
@@ -61,7 +61,7 @@ const PasscodeList = memo(() => {
|
|
|
61
61
|
</TouchableOpacity>
|
|
62
62
|
))}
|
|
63
63
|
</View>
|
|
64
|
-
</
|
|
64
|
+
</View>
|
|
65
65
|
);
|
|
66
66
|
});
|
|
67
67
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, { memo, useCallback, useMemo, useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import { View, ScrollView } from 'react-native';
|
|
3
|
+
import moment from 'moment';
|
|
4
4
|
|
|
5
|
+
import { useTranslations } from '../../../../hooks/Common/useTranslations';
|
|
5
6
|
import Text from '../../../Text';
|
|
6
7
|
import { HeaderCustom } from '../../../Header';
|
|
7
8
|
import { useBoolean } from '../../../../hooks/Common';
|
|
@@ -13,7 +14,6 @@ import BottomButtonView from '../../../BottomButtonView';
|
|
|
13
14
|
import { ACCESS_SCHEDULE } from '../../../../screens/GuestInfo/constant';
|
|
14
15
|
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
15
16
|
import ButtonWrapper from './ButtonWrapper';
|
|
16
|
-
import moment from 'moment';
|
|
17
17
|
import styles from './SetupGeneratePasscodeStyles';
|
|
18
18
|
|
|
19
19
|
const SetupGeneratePasscode = memo(() => {
|
|
@@ -170,7 +170,7 @@ const SetupGeneratePasscode = memo(() => {
|
|
|
170
170
|
}, [isSelectCircle]);
|
|
171
171
|
|
|
172
172
|
return (
|
|
173
|
-
<
|
|
173
|
+
<View style={styles.container}>
|
|
174
174
|
<HeaderCustom
|
|
175
175
|
title={t('setup_generate_passcode')}
|
|
176
176
|
titleStyle={styles.title}
|
|
@@ -247,7 +247,7 @@ const SetupGeneratePasscode = memo(() => {
|
|
|
247
247
|
onHide={releaseLockShowing}
|
|
248
248
|
/>
|
|
249
249
|
<BottomButtonView style={styles.viewBottomFixed} mainTitle={t('done')} />
|
|
250
|
-
</
|
|
250
|
+
</View>
|
|
251
251
|
);
|
|
252
252
|
});
|
|
253
253
|
|
|
@@ -4,6 +4,7 @@ import { View, StyleSheet, Text } from 'react-native';
|
|
|
4
4
|
import { Colors } from '../../configs';
|
|
5
5
|
import { shortEmailName } from '../../utils/Utils';
|
|
6
6
|
import Avatar from '../../../assets/images/avatar.svg';
|
|
7
|
+
import AccessibilityLabel from '../../configs/AccessibilityLabel';
|
|
7
8
|
|
|
8
9
|
const AccountItem = ({ account }) => {
|
|
9
10
|
return (
|
|
@@ -20,7 +21,12 @@ const AccountItem = ({ account }) => {
|
|
|
20
21
|
)}
|
|
21
22
|
|
|
22
23
|
{account?.phone_number && (
|
|
23
|
-
<Text
|
|
24
|
+
<Text
|
|
25
|
+
style={{ color: Colors.Gray8 }}
|
|
26
|
+
accessibilityLabel={AccessibilityLabel.TEXT_PHONE_NUMBER_ITEM}
|
|
27
|
+
>
|
|
28
|
+
{account?.phone_number}
|
|
29
|
+
</Text>
|
|
24
30
|
)}
|
|
25
31
|
</View>
|
|
26
32
|
</View>
|
|
@@ -78,7 +78,7 @@ describe('Test MyUnit', () => {
|
|
|
78
78
|
const goToDetail = instance.findAll(
|
|
79
79
|
(item) =>
|
|
80
80
|
item.props.accessibilityLabel ===
|
|
81
|
-
AccessibilityLabel.MY_UNIT_GO_TO_DETAIL
|
|
81
|
+
`${AccessibilityLabel.MY_UNIT_GO_TO_DETAIL}-${item?.id}`
|
|
82
82
|
);
|
|
83
83
|
const textNoUnit = instance.findAll(
|
|
84
84
|
(item) =>
|
|
@@ -107,7 +107,7 @@ const MyUnit = () => {
|
|
|
107
107
|
onPress={() => goToDetail(item)}
|
|
108
108
|
style={styles.btnItem}
|
|
109
109
|
activeOpacity={0.75}
|
|
110
|
-
accessibilityLabel={AccessibilityLabel.MY_UNIT_GO_TO_DETAIL}
|
|
110
|
+
accessibilityLabel={`${AccessibilityLabel.MY_UNIT_GO_TO_DETAIL}-${index}`}
|
|
111
111
|
>
|
|
112
112
|
<View style={styles.overlay} />
|
|
113
113
|
<Image
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { memo, useMemo } from 'react';
|
|
2
2
|
import { StyleSheet, View, TouchableOpacity, Image } from 'react-native';
|
|
3
|
+
import { useNavigation } from '@react-navigation/native';
|
|
3
4
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
4
5
|
import { Colors } from '../../configs';
|
|
5
6
|
import Text from '../../commons/Text';
|
|
6
7
|
import { shortEmailName } from '../../utils/Utils';
|
|
7
8
|
import { CircleView } from '../CircleView';
|
|
8
|
-
import
|
|
9
|
+
import AccessibilityLabel from '../../configs/AccessibilityLabel';
|
|
9
10
|
import Routes from '../../utils/Route';
|
|
10
11
|
|
|
11
12
|
const arrColor = [
|
|
@@ -65,7 +66,11 @@ const RowMember = memo(
|
|
|
65
66
|
};
|
|
66
67
|
return (
|
|
67
68
|
<View style={styles.rowContainer}>
|
|
68
|
-
<TouchableOpacity
|
|
69
|
+
<TouchableOpacity
|
|
70
|
+
onPress={onPressInfo}
|
|
71
|
+
disabled={type === 'disable'}
|
|
72
|
+
accessibilityLabel={`${AccessibilityLabel.SELECT_MEMBER_UNIT}-${member?.id}`}
|
|
73
|
+
>
|
|
69
74
|
<View style={styles.Border}>
|
|
70
75
|
{!!leftIcon && (
|
|
71
76
|
<View style={styles.paddingLeft16}>
|
|
@@ -86,7 +91,14 @@ const RowMember = memo(
|
|
|
86
91
|
{member?.name || shortEmailName(member?.email) || ''}
|
|
87
92
|
</Text>
|
|
88
93
|
{member?.phone_number && (
|
|
89
|
-
<Text
|
|
94
|
+
<Text
|
|
95
|
+
style={styles.status}
|
|
96
|
+
accessibilityLabel={
|
|
97
|
+
AccessibilityLabel.TEXT_PHONE_NUMBER_UNIT_MEMBER
|
|
98
|
+
}
|
|
99
|
+
>
|
|
100
|
+
{member?.phone_number}
|
|
101
|
+
</Text>
|
|
90
102
|
)}
|
|
91
103
|
</View>
|
|
92
104
|
{!!rightComponent && (
|
|
@@ -4,11 +4,10 @@ import {
|
|
|
4
4
|
StyleSheet,
|
|
5
5
|
Animated,
|
|
6
6
|
View,
|
|
7
|
-
SafeAreaView,
|
|
8
7
|
Platform,
|
|
9
8
|
} from 'react-native';
|
|
10
9
|
import { ActivityIndicator } from '@ant-design/react-native';
|
|
11
|
-
import { isIphoneX } from 'react-native-iphone-x-helper';
|
|
10
|
+
import { getStatusBarHeight, isIphoneX } from 'react-native-iphone-x-helper';
|
|
12
11
|
|
|
13
12
|
import { Colors, Theme } from '../../configs';
|
|
14
13
|
import HeaderAni, { heightHeader } from '../../commons/HeaderAni';
|
|
@@ -50,7 +49,7 @@ const WrapHeaderScrollable = ({
|
|
|
50
49
|
);
|
|
51
50
|
|
|
52
51
|
return (
|
|
53
|
-
<
|
|
52
|
+
<View style={[styles.container, headerAniStyle]}>
|
|
54
53
|
<HeaderAni
|
|
55
54
|
scrollY={animatedScrollYValue}
|
|
56
55
|
contentHeight={contentHeight}
|
|
@@ -104,7 +103,7 @@ const WrapHeaderScrollable = ({
|
|
|
104
103
|
</View>
|
|
105
104
|
)}
|
|
106
105
|
</Animated.ScrollView>
|
|
107
|
-
</
|
|
106
|
+
</View>
|
|
108
107
|
);
|
|
109
108
|
};
|
|
110
109
|
|
|
@@ -113,6 +112,7 @@ export default memo(WrapHeaderScrollable);
|
|
|
113
112
|
const styles = StyleSheet.create({
|
|
114
113
|
container: {
|
|
115
114
|
flex: 1,
|
|
115
|
+
paddingTop: getStatusBarHeight() + 10,
|
|
116
116
|
},
|
|
117
117
|
scrollView: {
|
|
118
118
|
flex: 1,
|
|
@@ -49,6 +49,9 @@ export default {
|
|
|
49
49
|
//member list
|
|
50
50
|
SHARING_MEMBER: 'SHARING_MEMBER',
|
|
51
51
|
REMOVE_MEMBER: 'REMOVE_MEMBER',
|
|
52
|
+
CHECK_BOX_CUSTOM: 'CHECK_BOX_CUSTOM',
|
|
53
|
+
TEXT_PHONE_NUMBER_ITEM: 'TEXT_PHONE_NUMBER_ITEM',
|
|
54
|
+
TEXT_PHONE_NUMBER_UNIT_MEMBER: 'TEXT_PHONE_NUMBER_UNIT_MEMBER',
|
|
52
55
|
|
|
53
56
|
// SmartTiviTemplate
|
|
54
57
|
SMART_TIVI_TEMPLATE: {
|
|
@@ -417,6 +420,7 @@ export default {
|
|
|
417
420
|
SELECT_UNIT_NAME: 'SELECT_UNIT_NAME',
|
|
418
421
|
SELECT_UNIT_RADIO_BUTTON: 'SELECT_UNIT_RADIO_BUTTON',
|
|
419
422
|
SELECT_UNIT_SELECT: 'SELECT_UNIT_SELECT',
|
|
423
|
+
SELECT_MEMBER_UNIT: 'SELECT_MEMBER_UNIT',
|
|
420
424
|
|
|
421
425
|
// select wifi
|
|
422
426
|
SELECT_WIFI: 'SELECT_WIFI',
|
|
@@ -434,6 +438,8 @@ export default {
|
|
|
434
438
|
BUTTON_ADD_AUTO_SMART: 'BUTTON_ADD_AUTO_SMART',
|
|
435
439
|
BUTTON_CONNECT_WIFI: 'BUTTON_CONNECT_WIFI',
|
|
436
440
|
BUTTON_BOTTOM_SMART_ACCOUNT: 'BUTTON_BOTTOM_SMART_ACCOUNT',
|
|
441
|
+
BUTTON_ADD_MEMBER: 'BUTTON_ADD_MEMBER',
|
|
442
|
+
BUTTON_REMOVE_MEMBER: 'BUTTON_REMOVE_MEMBER',
|
|
437
443
|
},
|
|
438
444
|
|
|
439
445
|
TERM_AND_POLICY_TITLE: 'TERM_AND_POLICY_TITLE',
|
|
@@ -456,6 +462,8 @@ export default {
|
|
|
456
462
|
// Select User
|
|
457
463
|
SELECT_USER_ADD_USER_TITLE: 'SELECT_USER_ADD_USER_TITLE',
|
|
458
464
|
SELECT_USER_ADD_USER_SUB_TITLE: 'SELECT_USER_ADD_USER_SUB_TITLE',
|
|
465
|
+
INPUT_PHONE_NUMBER_OR_EMAIL: 'INPUT_PHONE_NUMBER_OR_EMAIL',
|
|
466
|
+
INVITE_PHONE_NUMBER: 'INVITE_PHONE_NUMBER',
|
|
459
467
|
// Connected device
|
|
460
468
|
CONNECTED_DEVICE_SUCCESS: 'CONNECTED_DEVICE_SUCCESS',
|
|
461
469
|
CONNECTED_DEVICE_UNIT_NAME: 'CONNECTED_DEVICE_UNIT_NAME',
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import React, { memo, useMemo } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
ScrollView,
|
|
5
|
-
StyleSheet,
|
|
6
|
-
TouchableOpacity,
|
|
7
|
-
SafeAreaView,
|
|
8
|
-
} from 'react-native';
|
|
9
|
-
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
2
|
+
import { View, ScrollView, StyleSheet, TouchableOpacity } from 'react-native';
|
|
3
|
+
import { getStatusBarHeight } from 'react-native-iphone-x-helper';
|
|
10
4
|
|
|
5
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
11
6
|
import { Colors, Theme } from '../../configs';
|
|
12
7
|
import useTitleHeader from '../../hooks/Common/useTitleHeader';
|
|
13
8
|
import { AccessibilityLabel } from '../../configs/Constants';
|
|
14
|
-
|
|
15
9
|
import Text from '../../commons/Text';
|
|
16
10
|
import SvgSmile from '../../../assets/images/Feeling/smile.svg';
|
|
17
11
|
import SvgMeh from '../../../assets/images/Feeling/meh.svg';
|
|
@@ -82,7 +76,7 @@ const AQIGuide = memo(() => {
|
|
|
82
76
|
const { titles, uvIndex } = data;
|
|
83
77
|
|
|
84
78
|
return (
|
|
85
|
-
<
|
|
79
|
+
<View style={styles.container}>
|
|
86
80
|
<ScrollView style={styles.container} scrollIndicatorInsets={{ right: 1 }}>
|
|
87
81
|
{titles.map((item, index) => {
|
|
88
82
|
const { title, des } = item;
|
|
@@ -142,7 +136,7 @@ const AQIGuide = memo(() => {
|
|
|
142
136
|
);
|
|
143
137
|
})}
|
|
144
138
|
</ScrollView>
|
|
145
|
-
</
|
|
139
|
+
</View>
|
|
146
140
|
);
|
|
147
141
|
});
|
|
148
142
|
|
|
@@ -152,6 +146,7 @@ const styles = StyleSheet.create({
|
|
|
152
146
|
container: {
|
|
153
147
|
flex: 1,
|
|
154
148
|
backgroundColor: Theme.color.backgroundColor,
|
|
149
|
+
paddingTop: getStatusBarHeight() + 10,
|
|
155
150
|
},
|
|
156
151
|
titles: {
|
|
157
152
|
marginHorizontal: 16,
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import React, { memo, useCallback, useEffect, useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
ScrollView,
|
|
4
|
-
StyleSheet,
|
|
5
|
-
SafeAreaView,
|
|
6
|
-
StatusBar,
|
|
7
|
-
Platform,
|
|
8
|
-
} from 'react-native';
|
|
2
|
+
import { ScrollView, StyleSheet, View } from 'react-native';
|
|
9
3
|
import { useNavigation } from '@react-navigation/native';
|
|
10
|
-
import {
|
|
4
|
+
import { getStatusBarHeight } from 'react-native-iphone-x-helper';
|
|
11
5
|
|
|
6
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
12
7
|
import { API, Colors } from '../../configs';
|
|
13
8
|
import { Section, ViewButtonBottom } from '../../commons'; //components/Common
|
|
14
9
|
import Text from '../../commons/Text';
|
|
@@ -62,13 +57,7 @@ const AddNewDevice = memo(({ route }) => {
|
|
|
62
57
|
};
|
|
63
58
|
|
|
64
59
|
return (
|
|
65
|
-
<
|
|
66
|
-
style={
|
|
67
|
-
Platform.OS === 'android'
|
|
68
|
-
? styles.containerAndroid
|
|
69
|
-
: styles.containerIOS
|
|
70
|
-
}
|
|
71
|
-
>
|
|
60
|
+
<View style={styles.wrap}>
|
|
72
61
|
<Text
|
|
73
62
|
accessibilityLabel={AccessibilityLabel.ADD_NEW_DEVICE_ADD}
|
|
74
63
|
semibold
|
|
@@ -103,22 +92,17 @@ const AddNewDevice = memo(({ route }) => {
|
|
|
103
92
|
rightDisabled={stationId === -1}
|
|
104
93
|
onRightClick={onRight}
|
|
105
94
|
/>
|
|
106
|
-
</
|
|
95
|
+
</View>
|
|
107
96
|
);
|
|
108
97
|
});
|
|
109
98
|
|
|
110
99
|
export default AddNewDevice;
|
|
111
100
|
|
|
112
101
|
const styles = StyleSheet.create({
|
|
113
|
-
|
|
114
|
-
flex: 1,
|
|
115
|
-
backgroundColor: Colors.Gray2,
|
|
116
|
-
paddingTop: StatusBar.currentHeight,
|
|
117
|
-
},
|
|
118
|
-
containerIOS: {
|
|
102
|
+
wrap: {
|
|
119
103
|
flex: 1,
|
|
120
104
|
backgroundColor: Colors.Gray2,
|
|
121
|
-
paddingTop:
|
|
105
|
+
paddingTop: getStatusBarHeight() + 10,
|
|
122
106
|
},
|
|
123
107
|
txtHeader: {
|
|
124
108
|
marginTop: 16,
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import { StyleSheet
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { getStatusBarHeight } from 'react-native-iphone-x-helper';
|
|
2
3
|
import { Colors } from '../../configs';
|
|
3
4
|
|
|
4
5
|
export default StyleSheet.create({
|
|
5
6
|
wrap: {
|
|
6
7
|
flex: 1,
|
|
7
8
|
backgroundColor: Colors.Gray2,
|
|
8
|
-
|
|
9
|
-
android: {
|
|
10
|
-
paddingTop: StatusBar.currentHeight,
|
|
11
|
-
},
|
|
12
|
-
}),
|
|
9
|
+
paddingTop: getStatusBarHeight() + 10,
|
|
13
10
|
},
|
|
14
11
|
textHeader: {
|
|
15
12
|
marginTop: 16,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import { TouchableOpacity, View } from 'react-native';
|
|
3
3
|
import { useNavigation } from '@react-navigation/native';
|
|
4
|
-
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
5
4
|
|
|
5
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
6
6
|
import { ViewButtonBottom } from '../../commons';
|
|
7
7
|
import { HeaderCustom } from '../../commons/Header';
|
|
8
8
|
import Text from '../../commons/Text';
|
|
@@ -55,8 +55,8 @@ describe('Test select modbus gateway', () => {
|
|
|
55
55
|
tree = await create(wrapComponent(route));
|
|
56
56
|
});
|
|
57
57
|
const instance = tree.root;
|
|
58
|
-
const
|
|
59
|
-
expect(
|
|
58
|
+
const selectGateway = instance.findAllByType(SelectGateway);
|
|
59
|
+
expect(selectGateway).toHaveLength(1);
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
it('select gateway', async () => {
|
|
@@ -55,8 +55,8 @@ describe('Test select zigbee gateway', () => {
|
|
|
55
55
|
tree = await create(wrapComponent(route));
|
|
56
56
|
});
|
|
57
57
|
const instance = tree.root;
|
|
58
|
-
const
|
|
59
|
-
expect(
|
|
58
|
+
const selectGateway = instance.findAllByType(SelectGateway);
|
|
59
|
+
expect(selectGateway).toHaveLength(1);
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
it('select gateway', async () => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { memo, useCallback, useMemo, useState } from 'react';
|
|
2
|
-
import { ScrollView,
|
|
2
|
+
import { ScrollView, View, TextInput } from 'react-native';
|
|
3
3
|
import { useNavigation } from '@react-navigation/native';
|
|
4
|
-
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
5
4
|
|
|
5
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
6
6
|
import { Colors } from '../../configs';
|
|
7
7
|
import { Section, ViewButtonBottom } from '../../commons';
|
|
8
8
|
import Text from '../../commons/Text';
|
|
@@ -53,7 +53,7 @@ const AddNewGateway = memo(({ route }) => {
|
|
|
53
53
|
: t('Please_add_gateway_name');
|
|
54
54
|
|
|
55
55
|
return (
|
|
56
|
-
<
|
|
56
|
+
<View style={styles.wrap}>
|
|
57
57
|
<Text
|
|
58
58
|
accessibilityLabel={AccessibilityLabel.ADD_NEW_GATEWAY_ADD}
|
|
59
59
|
semibold
|
|
@@ -106,7 +106,7 @@ const AddNewGateway = memo(({ route }) => {
|
|
|
106
106
|
rightDisabled={!isValid}
|
|
107
107
|
onRightClick={onRight}
|
|
108
108
|
/>
|
|
109
|
-
</
|
|
109
|
+
</View>
|
|
110
110
|
);
|
|
111
111
|
});
|
|
112
112
|
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
2
|
import { getBottomSpace } from 'react-native-iphone-x-helper';
|
|
3
3
|
import { Colors } from '../../configs';
|
|
4
4
|
|
|
5
5
|
export default StyleSheet.create({
|
|
6
|
-
|
|
6
|
+
wrap: {
|
|
7
7
|
flex: 1,
|
|
8
8
|
backgroundColor: Colors.Gray2,
|
|
9
|
-
paddingTop: StatusBar.currentHeight,
|
|
10
|
-
},
|
|
11
|
-
containerIOS: {
|
|
12
|
-
flex: 1,
|
|
13
|
-
backgroundColor: Colors.Gray2,
|
|
14
|
-
paddingTop: 0,
|
|
15
9
|
},
|
|
16
10
|
textHeader: {
|
|
17
11
|
marginTop: 16,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { memo, useCallback, useState } from 'react';
|
|
2
|
-
import { ScrollView,
|
|
2
|
+
import { ScrollView, View } from 'react-native';
|
|
3
3
|
import { CommonActions, useNavigation } from '@react-navigation/native';
|
|
4
4
|
|
|
5
5
|
import { API, Colors } from '../../configs';
|
|
@@ -113,13 +113,7 @@ const AddNewOneTap = memo(({ route }) => {
|
|
|
113
113
|
: t('name_your_script');
|
|
114
114
|
|
|
115
115
|
return (
|
|
116
|
-
<
|
|
117
|
-
style={
|
|
118
|
-
Platform.OS === 'android'
|
|
119
|
-
? styles.containerAndroid
|
|
120
|
-
: styles.containerIOS
|
|
121
|
-
}
|
|
122
|
-
>
|
|
116
|
+
<View style={styles.wrap}>
|
|
123
117
|
<HeaderCustom isShowClose onClose={onClose} />
|
|
124
118
|
<ScrollView scrollIndicatorInsets={{ right: 1 }}>
|
|
125
119
|
<Text
|
|
@@ -146,7 +140,7 @@ const AddNewOneTap = memo(({ route }) => {
|
|
|
146
140
|
onPressMain={handleContinue}
|
|
147
141
|
typeMain={name !== '' ? 'primary' : 'disabled'}
|
|
148
142
|
/>
|
|
149
|
-
</
|
|
143
|
+
</View>
|
|
150
144
|
);
|
|
151
145
|
});
|
|
152
146
|
|
|
@@ -1,24 +1,67 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { SafeAreaView } from 'react-native';
|
|
3
2
|
import renderer, { act } from 'react-test-renderer';
|
|
3
|
+
import AccessibilityLabel from '../../configs/AccessibilityLabel';
|
|
4
4
|
import { SCProvider } from '../../context';
|
|
5
5
|
import { mockSCStore } from '../../context/mockStore';
|
|
6
|
-
import Drawer from './index';
|
|
6
|
+
import Drawer, { Row } from './index';
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const mockDispatch = jest.fn();
|
|
9
|
+
jest.mock('@react-navigation/native', () => {
|
|
10
|
+
return {
|
|
11
|
+
...jest.requireActual('@react-navigation/native'),
|
|
12
|
+
useNavigation: () => ({
|
|
13
|
+
dispatch: mockDispatch,
|
|
14
|
+
}),
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const wrapComponent = (initState = mockSCStore({})) => (
|
|
19
|
+
<SCProvider initState={initState}>
|
|
20
|
+
<Drawer />
|
|
11
21
|
</SCProvider>
|
|
12
22
|
);
|
|
13
23
|
|
|
14
24
|
describe('Drawer', () => {
|
|
15
25
|
let tree;
|
|
16
|
-
it('
|
|
26
|
+
it('test render with user', async () => {
|
|
17
27
|
await act(async () => {
|
|
18
28
|
tree = await renderer.create(wrapComponent());
|
|
19
29
|
});
|
|
20
30
|
const instance = tree.root;
|
|
21
|
-
const
|
|
22
|
-
expect(
|
|
31
|
+
const rows = instance.findAllByType(Row);
|
|
32
|
+
expect(rows).toHaveLength(3);
|
|
33
|
+
|
|
34
|
+
// NOTE: Hinh will add expect when has action for them
|
|
35
|
+
await act(async () => {
|
|
36
|
+
await rows[0].props.onPress();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
await act(async () => {
|
|
40
|
+
await rows[1].props.onPress();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
await act(async () => {
|
|
44
|
+
await rows[2].props.onPress();
|
|
45
|
+
});
|
|
46
|
+
expect(mockDispatch).toBeCalledWith({
|
|
47
|
+
payload: { index: 0, routes: [{ name: 'Main' }] },
|
|
48
|
+
type: 'RESET',
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('test render without user', async () => {
|
|
53
|
+
await act(async () => {
|
|
54
|
+
tree = await renderer.create(
|
|
55
|
+
wrapComponent({
|
|
56
|
+
auth: {
|
|
57
|
+
account: {},
|
|
58
|
+
},
|
|
59
|
+
})
|
|
60
|
+
);
|
|
61
|
+
});
|
|
62
|
+
const avatar = tree.root.findByProps({
|
|
63
|
+
accessibilityLabel: AccessibilityLabel.SIDE_MENU_AVATAR_USER,
|
|
64
|
+
});
|
|
65
|
+
expect(avatar.props.source).toBe(undefined);
|
|
23
66
|
});
|
|
24
67
|
});
|