@eohjsc/react-native-smart-city 0.2.86 → 0.2.89

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.
Files changed (126) hide show
  1. package/assets/images/Common/Calendar.svg +3 -0
  2. package/assets/images/Common/SmartPhone.svg +3 -0
  3. package/assets/images/Hanet/CaptureFaceID.svg +25 -0
  4. package/assets/images/Hanet/FaceFrame.svg +6 -0
  5. package/assets/images/brightnessBlack.svg +12 -0
  6. package/index.js +4 -0
  7. package/package.json +3 -3
  8. package/src/Images/SmartIr/AC.svg +14 -0
  9. package/src/Images/SmartIr/DIY.svg +3 -0
  10. package/src/Images/SmartIr/Fan.svg +10 -0
  11. package/src/Images/SmartIr/Fridge.svg +5 -0
  12. package/src/Images/SmartIr/Remote.svg +15 -0
  13. package/src/Images/SmartIr/SmartIr.svg +4 -0
  14. package/src/Images/SmartIr/TV.svg +10 -0
  15. package/src/Images/SmartIr/Union.svg +9 -0
  16. package/src/Images/SmartIr/WM.svg +11 -0
  17. package/src/Images/SmartIr/index.js +10 -0
  18. package/src/commons/ActionGroup/ColorPickerTemplate.js +51 -0
  19. package/src/commons/ActionGroup/ColorPickerTemplateStyles.js +17 -0
  20. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/AutoLockStyles.js +40 -0
  21. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/ButtonWrapper.js +65 -0
  22. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/ButtonWrapperStyles.js +43 -0
  23. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/__test__/index.test.js +48 -0
  24. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/index.js +57 -0
  25. package/src/commons/ActionGroup/{OnOffSmartLock.js → OnOffSmartLock/OnOffSmartLock.js} +5 -5
  26. package/src/commons/ActionGroup/{OnOffSmartLockStyle.js → OnOffSmartLock/OnOffSmartLockStyle.js} +1 -1
  27. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/ItemPasscode.js +48 -0
  28. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/ItemPasscodeStyles.js +42 -0
  29. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/PasscodeListStyles.js +49 -0
  30. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/index.js +66 -0
  31. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/ButtonWrapper.js +96 -0
  32. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/SetupGeneratePasscodeStyles.js +98 -0
  33. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/__test__/index.test.js +62 -0
  34. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/index.js +249 -0
  35. package/src/commons/ActionGroup/OnOffTemplate/index.js +4 -2
  36. package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +2 -1
  37. package/src/commons/ActionGroup/SliderRangeTemplate.js +64 -0
  38. package/src/commons/ActionGroup/{LightActionTemplateStyles.js → SliderRangeTemplateStyles.js} +0 -8
  39. package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +167 -186
  40. package/src/commons/ActionGroup/StatesGridActionTemplate.js +2 -1
  41. package/src/commons/ActionGroup/index.js +7 -4
  42. package/src/commons/BottomSheet/index.js +2 -1
  43. package/src/commons/Device/DisconnectedView.js +7 -1
  44. package/src/commons/Device/Hanet/ItemHanetDevice.js +109 -0
  45. package/src/commons/Device/HistoryChart.js +2 -2
  46. package/src/commons/Device/HorizontalBarChart.js +7 -0
  47. package/src/commons/Device/ItemDevice.js +18 -15
  48. package/src/commons/Device/LinearChart.js +14 -41
  49. package/src/commons/Device/__test__/DisconnectedView.test.js +13 -2
  50. package/src/commons/RowItem/index.js +12 -7
  51. package/src/commons/SubUnit/Favorites/index.js +2 -2
  52. package/src/commons/SubUnit/ShortDetail.js +39 -20
  53. package/src/commons/WheelDateTimePicker/index.js +18 -4
  54. package/src/configs/API.js +23 -1
  55. package/src/configs/Colors.js +1 -0
  56. package/src/configs/Constants.js +48 -0
  57. package/src/configs/SCConfig.js +1 -1
  58. package/src/context/actionType.ts +4 -0
  59. package/src/context/mockStore.ts +3 -0
  60. package/src/context/reducer.ts +20 -0
  61. package/src/iot/RemoteControl/Bluetooth.js +3 -22
  62. package/src/iot/RemoteControl/index.js +0 -1
  63. package/src/navigations/HanetCameraStack.js +41 -0
  64. package/src/navigations/SmartIrStack.js +31 -0
  65. package/src/navigations/SmartLockStack.js +51 -0
  66. package/src/navigations/UnitStack.js +46 -4
  67. package/src/screens/ActivityLog/hooks/index.js +1 -1
  68. package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +1 -1
  69. package/src/screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning.js +79 -72
  70. package/src/screens/AddNewGateway/PlugAndPlay/GatewayWifiList.js +155 -27
  71. package/src/screens/AddNewGateway/PlugAndPlay/__test__/ConnectWifiWarning.test.js +65 -0
  72. package/src/screens/AddNewGateway/PlugAndPlay/__test__/GatewayWifiList.test.js +26 -2
  73. package/src/screens/Device/__test__/detail.test.js +0 -10
  74. package/src/screens/Device/components/SensorConnectStatusViewHeader.js +13 -2
  75. package/src/screens/Device/detail.js +118 -38
  76. package/src/screens/Device/hooks/useDisconnectedDevice.js +28 -16
  77. package/src/screens/GuestInfo/components/AccessScheduleItem.js +9 -2
  78. package/src/screens/GuestInfo/components/RecurringDetail.js +3 -2
  79. package/src/screens/GuestInfo/components/TemporaryDetail.js +3 -2
  80. package/src/screens/GuestInfo/styles/AccessScheduleItemStyles.js +3 -0
  81. package/src/screens/HanetCamera/CaptureFaceID.js +210 -0
  82. package/src/screens/HanetCamera/Detail.js +252 -0
  83. package/src/screens/HanetCamera/ManageAccess.js +173 -0
  84. package/src/screens/HanetCamera/MemberInfo.js +208 -0
  85. package/src/screens/HanetCamera/__test__/CaptureFaceID.test.js +133 -0
  86. package/src/screens/HanetCamera/__test__/Detail.test.js +185 -0
  87. package/src/screens/HanetCamera/__test__/ManageAccess.test.js +152 -0
  88. package/src/screens/HanetCamera/__test__/MemberInfo.test.js +178 -0
  89. package/src/screens/HanetCamera/components/CheckinHeader.js +37 -0
  90. package/src/screens/HanetCamera/hooks/__test__/useHanetCheckinData.test.js +151 -0
  91. package/src/screens/HanetCamera/hooks/__test__/useHanetPlaceMembers.test.js +71 -0
  92. package/src/screens/HanetCamera/hooks/index.js +5 -0
  93. package/src/screens/HanetCamera/hooks/useHanetCheckinData.js +116 -0
  94. package/src/screens/HanetCamera/hooks/useHanetPlaceMembers.js +86 -0
  95. package/src/screens/HanetCamera/hooks/useStateAlertAction.js +62 -0
  96. package/src/screens/HanetCamera/styles/captureFaceIDStyles.js +50 -0
  97. package/src/screens/HanetCamera/styles/checkinHeaderStyles.js +24 -0
  98. package/src/screens/HanetCamera/styles/detailStyles.js +107 -0
  99. package/src/screens/HanetCamera/styles/manageAccessStyles.js +49 -0
  100. package/src/screens/HanetCamera/styles/memberInfoStyles.js +73 -0
  101. package/src/screens/HanetCamera/utils/Monitor.js +52 -0
  102. package/src/screens/Notification/__test__/NotificationItem.test.js +1 -0
  103. package/src/screens/Notification/components/NotificationItem.js +16 -0
  104. package/src/screens/SmartIr/__test__/ButtonsBottom.test.js +31 -0
  105. package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +80 -0
  106. package/src/screens/SmartIr/__test__/SelectBrand.test.js +65 -0
  107. package/src/screens/SmartIr/__test__/SelectDeviceType.test.js +57 -0
  108. package/src/screens/SmartIr/__test__/SmartIr.test.js +1 -0
  109. package/src/screens/SmartIr/components/GroupButtonByType/ButtonsBottom.js +45 -0
  110. package/src/screens/SmartIr/components/GroupButtonByType/ButtonsBottomStyles.js +31 -0
  111. package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +208 -0
  112. package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByTypeStyles.js +113 -0
  113. package/src/screens/SmartIr/components/SelectBrand.js +61 -0
  114. package/src/screens/SmartIr/components/SelectBrandStyles.js +14 -0
  115. package/src/screens/SmartIr/components/SelectDeviceType.js +96 -0
  116. package/src/screens/SmartIr/components/SelectDeviceTypeStyles.js +30 -0
  117. package/src/screens/SmartIr/index.js +8 -3
  118. package/src/screens/Unit/Detail.js +7 -11
  119. package/src/screens/Unit/__test__/Detail.test.js +0 -10
  120. package/src/screens/Unit/components/MyUnitDevice/index.js +2 -4
  121. package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +38 -9
  122. package/src/utils/I18n/translations/en.json +51 -1
  123. package/src/utils/I18n/translations/vi.json +51 -1
  124. package/src/utils/Route/index.js +14 -1
  125. package/src/commons/ActionGroup/LightActionTemplate.js +0 -103
  126. package/src/commons/ActionGroup/__test__/LightActionTemplate.test.js +0 -59
@@ -0,0 +1,57 @@
1
+ import React, { memo, useCallback, useState } from 'react';
2
+ import { SafeAreaView, View } from 'react-native';
3
+ import Slider from 'react-native-slider';
4
+ import Text from '../../../Text';
5
+ import { HeaderCustom } from '../../../Header';
6
+ import ButtonWrapper from './ButtonWrapper';
7
+ import { TESTID } from '../../../../configs/Constants';
8
+ import styles from './AutoLockStyles';
9
+ import t from '../../../../hooks/Common/useTranslations';
10
+ import { Colors } from '../../../../configs';
11
+
12
+ const AutoLock = memo(() => {
13
+ const [isEnabled, setIsEnabled] = useState(false);
14
+
15
+ const handleToggleSwitch = useCallback(() => {
16
+ setIsEnabled((previousState) => !previousState);
17
+ }, []);
18
+ return (
19
+ <SafeAreaView style={styles.container}>
20
+ <HeaderCustom title={t('auto_lock')} isShowSeparator />
21
+ <View style={styles.wrap}>
22
+ <Text style={styles.textAutoLock}>{t('auto_lock')}</Text>
23
+ <Text style={styles.textYourDoor}>{t('your_door_will_lock')}</Text>
24
+ <ButtonWrapper
25
+ isButtonEnable
26
+ toggleSwitch={handleToggleSwitch}
27
+ isEnabled={isEnabled}
28
+ testID={TESTID.AUTO_LOCK_BUTTON_ENABLE}
29
+ />
30
+ <ButtonWrapper
31
+ isButtonInstant
32
+ testID={TESTID.AUTO_LOCK_BUTTON_INSTANT}
33
+ />
34
+ <ButtonWrapper
35
+ isButtonReLockTiming
36
+ isEnabled={isEnabled}
37
+ testID={TESTID.AUTO_LOCK_BUTTON_RELOCK_TIMING}
38
+ />
39
+ <View style={styles.slider}>
40
+ <Slider
41
+ step={1}
42
+ minimumValue={0}
43
+ maximumValue={100}
44
+ thumbTintColor={Colors.Gray3}
45
+ minimumTrackTintColor={isEnabled ? Colors.Primary : Colors.Gray6}
46
+ maximumTrackTintColor={Colors.Gray3}
47
+ trackStyle={styles.trackSlider}
48
+ thumbStyle={styles.thumbSlider}
49
+ />
50
+ </View>
51
+ <Text style={styles.textReLock}>{t('re_lock_will_lock')}</Text>
52
+ </View>
53
+ </SafeAreaView>
54
+ );
55
+ });
56
+
57
+ export default AutoLock;
@@ -1,11 +1,11 @@
1
1
  import React, { memo, useCallback, useState } from 'react';
2
2
  import { SafeAreaView, TouchableOpacity, View } from 'react-native';
3
- import { useTranslations } from '../../hooks/Common/useTranslations';
4
- import { Section } from '../Section';
5
- import Text from '../Text';
3
+ import { useTranslations } from '../../../hooks/Common/useTranslations';
4
+ import { Section } from '../../Section';
5
+ import Text from '../../Text';
6
6
  import styles from './OnOffSmartLockStyle';
7
- import ButtonLock from '../../../assets/images/Device/button-lock.svg';
8
- import ButtonUnLock from '../../../assets/images/Device/button-unlock.svg';
7
+ import ButtonLock from '../../../../assets/images/Device/button-lock.svg';
8
+ import ButtonUnLock from '../../../../assets/images/Device/button-unlock.svg';
9
9
 
10
10
  const OnOffSmartLock = memo(({ actionGroup, doAction, sensor }) => {
11
11
  const t = useTranslations();
@@ -1,5 +1,5 @@
1
1
  import { StyleSheet } from 'react-native';
2
- import { Colors } from '../../configs';
2
+ import { Colors } from '../../../configs';
3
3
 
4
4
  export default StyleSheet.create({
5
5
  container: {
@@ -0,0 +1,48 @@
1
+ import React, { memo } from 'react';
2
+ import { SafeAreaView, View, TouchableOpacity } from 'react-native';
3
+
4
+ import Text from '../../../Text';
5
+ import { HeaderCustom } from '../../../Header';
6
+ import t from '../../../../hooks/Common/useTranslations';
7
+ import { Colors } from '../../../../configs';
8
+ import styles from './ItemPasscodeStyles';
9
+
10
+ const ButtonWrapper = ({ item, textHeadline }) => {
11
+ return (
12
+ <View style={styles.wrap}>
13
+ <View style={styles.buttonWrap}>
14
+ <Text style={styles.textHeadline}>{textHeadline}</Text>
15
+ <Text style={styles.textEndline}>{item}</Text>
16
+ </View>
17
+ </View>
18
+ );
19
+ };
20
+
21
+ const ItemPasscode = memo(({ route }) => {
22
+ const { item } = route.params;
23
+
24
+ return (
25
+ <SafeAreaView style={styles.container}>
26
+ <HeaderCustom isShowSeparator title={item.code} />
27
+ <ButtonWrapper textHeadline={t('code')} item={item.code} />
28
+ <ButtonWrapper textHeadline={t('user')} item={item.name} />
29
+ <ButtonWrapper
30
+ textHeadline={t('create_time')}
31
+ item={'29/1/2022 12:00:22'}
32
+ />
33
+ <ButtonWrapper textHeadline={t('status')} item={'Active'} />
34
+ <TouchableOpacity style={styles.removeButton}>
35
+ <Text
36
+ type={'H4'}
37
+ semibold
38
+ color={Colors.Red}
39
+ style={styles.removeBorderBottom}
40
+ >
41
+ {t('delete_passcode')}
42
+ </Text>
43
+ </TouchableOpacity>
44
+ </SafeAreaView>
45
+ );
46
+ });
47
+
48
+ export default ItemPasscode;
@@ -0,0 +1,42 @@
1
+ import { Colors } from '../../../../configs';
2
+ import { StyleSheet } from 'react-native';
3
+ import { getBottomSpace } from 'react-native-iphone-x-helper';
4
+
5
+ export default StyleSheet.create({
6
+ container: {
7
+ flex: 1,
8
+ backgroundColor: Colors.White,
9
+ },
10
+ wrap: {
11
+ marginHorizontal: 16,
12
+ },
13
+ buttonWrap: {
14
+ flexDirection: 'row',
15
+ justifyContent: 'space-between',
16
+ alignItems: 'center',
17
+ marginTop: 26,
18
+ paddingBottom: 16,
19
+ borderBottomWidth: 1,
20
+ borderColor: Colors.Gray3,
21
+ },
22
+ textHeadline: {
23
+ fontSize: 14,
24
+ color: Colors.Gray7,
25
+ },
26
+ textEndline: {
27
+ fontSize: 14,
28
+ fontWeight: 'bold',
29
+ color: Colors.Gray9,
30
+ },
31
+ removeButton: {
32
+ position: 'absolute',
33
+ bottom: 0,
34
+ borderWidth: 0,
35
+ alignSelf: 'center',
36
+ paddingBottom: 16 + getBottomSpace(),
37
+ },
38
+ removeBorderBottom: {
39
+ borderBottomWidth: 1,
40
+ borderBottomColor: Colors.Red,
41
+ },
42
+ });
@@ -0,0 +1,49 @@
1
+ import { Colors, Theme } from '../../../../configs';
2
+ import { StyleSheet } from 'react-native';
3
+
4
+ export default StyleSheet.create({
5
+ container: {
6
+ flex: 1,
7
+ backgroundColor: Colors.White,
8
+ },
9
+ wrap: {
10
+ marginHorizontal: 16,
11
+ },
12
+ searchBox: {
13
+ ...Theme.flexRow,
14
+ paddingHorizontal: 16,
15
+ backgroundColor: Colors.Gray2,
16
+ borderWidth: 1,
17
+ borderColor: Colors.Gray4,
18
+ borderRadius: 30,
19
+ marginTop: 8,
20
+ height: 48,
21
+ marginBottom: 22,
22
+ },
23
+ search: {
24
+ marginHorizontal: 10,
25
+ color: Colors.Gray6,
26
+ },
27
+ textSearchInput: {
28
+ fontSize: 14,
29
+ width: '90%',
30
+ },
31
+ buttonWrapper: {
32
+ flexDirection: 'row',
33
+ justifyContent: 'space-between',
34
+ alignItems: 'center',
35
+ paddingBottom: 16,
36
+ marginBottom: 16,
37
+ borderBottomWidth: 1,
38
+ borderColor: Colors.Gray3,
39
+ },
40
+ textCode: {
41
+ fontSize: 14,
42
+ color: Colors.Gray9,
43
+ fontWeight: 'bold',
44
+ },
45
+ textName: {
46
+ fontSize: 14,
47
+ color: Colors.Gray8,
48
+ },
49
+ });
@@ -0,0 +1,66 @@
1
+ import React, { memo, useCallback, useMemo } from 'react';
2
+ import { SafeAreaView, TextInput, View, TouchableOpacity } from 'react-native';
3
+ import { IconOutline } from '@ant-design/icons-react-native';
4
+ import { useNavigation } from '@react-navigation/native';
5
+
6
+ import Text from '../../../Text';
7
+ import { HeaderCustom } from '../../../Header';
8
+ import t from '../../../../hooks/Common/useTranslations';
9
+ import { Colors } from '../../../../configs';
10
+ import Routes from '../../../../utils/Route';
11
+ import styles from './PasscodeListStyles';
12
+
13
+ const PasscodeList = memo(() => {
14
+ const navigation = useNavigation();
15
+ const dataPasscodeList = useMemo(
16
+ () => [
17
+ { code: 123361, name: 'Do Loi' },
18
+ { code: 128232, name: 'Phuong Nam' },
19
+ { code: 123651, name: 'Jhonny Tam' },
20
+ ],
21
+ []
22
+ );
23
+
24
+ const handleClickButton = useCallback(
25
+ (item) => () => {
26
+ navigation.navigate(Routes.SmartLockStack, {
27
+ screen: Routes.ItemPasscode,
28
+ params: {
29
+ item,
30
+ },
31
+ });
32
+ },
33
+ [navigation]
34
+ );
35
+ return (
36
+ <SafeAreaView style={styles.container}>
37
+ <HeaderCustom title={t('passcode_list')} />
38
+ <View style={styles.wrap}>
39
+ <View style={styles.searchBox}>
40
+ <View>
41
+ <IconOutline name="search" size={24} style={styles.search} />
42
+ </View>
43
+ <TextInput
44
+ placeholder={t('search')}
45
+ placeholderTextColor={Colors.Gray8}
46
+ style={styles.textSearchInput}
47
+ />
48
+ </View>
49
+ {dataPasscodeList.map((item) => (
50
+ <TouchableOpacity
51
+ onPress={handleClickButton(item)}
52
+ style={styles.buttonWrapper}
53
+ >
54
+ <View>
55
+ <Text style={styles.textCode}>{item.code}</Text>
56
+ <Text style={styles.textName}>{item.name}</Text>
57
+ </View>
58
+ <IconOutline name="right" size={20} color={Colors.Gray8} />
59
+ </TouchableOpacity>
60
+ ))}
61
+ </View>
62
+ </SafeAreaView>
63
+ );
64
+ });
65
+
66
+ export default PasscodeList;
@@ -0,0 +1,96 @@
1
+ import React, { memo } from 'react';
2
+ import { IconOutline } from '@ant-design/icons-react-native';
3
+ import { Text, TouchableOpacity, View } from 'react-native';
4
+
5
+ import { RadioCircle } from '../../..';
6
+ import { Colors } from '../../../../configs';
7
+ import styles from './SetupGeneratePasscodeStyles';
8
+
9
+ const ButtonWrapper = memo(
10
+ ({
11
+ testID,
12
+ textHeadline,
13
+ textMinutes,
14
+ value,
15
+ isButtonChooseUser,
16
+ isButtonSetTime,
17
+ valueTime,
18
+ isButtonDuration,
19
+ onPressSetTime,
20
+ onPressSetMinute,
21
+ valueMinute,
22
+ isSelectCircle,
23
+ onPressSelectCircle,
24
+ }) => {
25
+ const textMinutesCapitalized =
26
+ textMinutes?.charAt(0).toUpperCase() + textMinutes?.slice(1);
27
+ const boxNotSelect = { ...styles.boxSetTime, ...styles.boxSetTimeDuration };
28
+ return (
29
+ <View
30
+ testID={testID}
31
+ style={
32
+ !isButtonDuration
33
+ ? styles.buttonWrapper
34
+ : { ...styles.buttonWrapper, ...styles.rowWrapperSchedule }
35
+ }
36
+ >
37
+ {!isButtonDuration ? (
38
+ <Text style={styles.textHeadLine}>{textHeadline}</Text>
39
+ ) : (
40
+ <TouchableOpacity
41
+ onPress={onPressSelectCircle}
42
+ style={styles.wrapDuration}
43
+ >
44
+ <View style={styles.circleDuration}>
45
+ <RadioCircle active={isSelectCircle} />
46
+ </View>
47
+ <Text style={styles.textDuration}>{textHeadline}</Text>
48
+ </TouchableOpacity>
49
+ )}
50
+ {isButtonChooseUser && (
51
+ <TouchableOpacity style={styles.buttonValue}>
52
+ <Text style={styles.value}>{value}</Text>
53
+ <IconOutline name="right" size={20} color={Colors.Gray8} />
54
+ </TouchableOpacity>
55
+ )}
56
+ {isButtonSetTime && (
57
+ <TouchableOpacity onPress={onPressSetTime} style={styles.boxSetTime}>
58
+ <Text style={styles.textBoxSetTime}>{valueTime}</Text>
59
+ </TouchableOpacity>
60
+ )}
61
+ {isButtonDuration && (
62
+ <View style={styles.wrapDuration}>
63
+ <TouchableOpacity
64
+ disabled={!isSelectCircle}
65
+ onPress={onPressSetMinute}
66
+ style={isSelectCircle ? styles.boxSetTime : boxNotSelect}
67
+ >
68
+ <Text
69
+ style={
70
+ isSelectCircle
71
+ ? styles.textDurationNotSelect
72
+ : styles.textTimeDuration
73
+ }
74
+ >
75
+ {valueMinute}
76
+ </Text>
77
+ </TouchableOpacity>
78
+ <View style={isSelectCircle ? styles.boxSetTime : boxNotSelect}>
79
+ <Text
80
+ style={
81
+ isSelectCircle
82
+ ? styles.textDurationNotSelect
83
+ : styles.textTimeDuration
84
+ }
85
+ >
86
+ {textMinutesCapitalized}
87
+ </Text>
88
+ </View>
89
+ </View>
90
+ )}
91
+ </View>
92
+ );
93
+ }
94
+ );
95
+
96
+ export default ButtonWrapper;
@@ -0,0 +1,98 @@
1
+ import { Colors } from '../../../../configs';
2
+ import { StyleSheet } from 'react-native';
3
+ import { getBottomSpace } from 'react-native-iphone-x-helper';
4
+
5
+ export default StyleSheet.create({
6
+ container: {
7
+ flex: 1,
8
+ backgroundColor: Colors.White,
9
+ },
10
+ scrollview: {
11
+ flex: 1,
12
+ marginHorizontal: 16,
13
+ },
14
+ buttonWrapper: {
15
+ flexDirection: 'row',
16
+ justifyContent: 'space-between',
17
+ alignItems: 'center',
18
+ borderBottomWidth: 0.5,
19
+ borderBottomColor: Colors.Gray3,
20
+ paddingTop: 24,
21
+ paddingBottom: 24,
22
+ },
23
+ rowWrapperSchedule: {
24
+ borderBottomWidth: 0,
25
+ },
26
+ buttonValue: {
27
+ flex: 1,
28
+ flexDirection: 'row',
29
+ justifyContent: 'flex-end',
30
+ alignItems: 'center',
31
+ },
32
+ value: {
33
+ marginRight: 20,
34
+ fontSize: 14,
35
+ color: Colors.Gray8,
36
+ },
37
+ textHeadLine: {
38
+ fontSize: 16,
39
+ color: Colors.Gray9,
40
+ fontWeight: 'bold',
41
+ },
42
+ textDuration: {
43
+ fontSize: 16,
44
+ color: Colors.Gray9,
45
+ marginLeft: 7,
46
+ },
47
+ boxSetTime: {
48
+ flexDirection: 'row',
49
+ justifyContent: 'center',
50
+ alignItems: 'center',
51
+ height: 36,
52
+ width: 78,
53
+ borderRadius: 5,
54
+ borderWidth: 1,
55
+ borderColor: Colors.Green7,
56
+ marginLeft: 3,
57
+ },
58
+ boxSetTimeDuration: {
59
+ borderColor: Colors.Gray6,
60
+ },
61
+ textBoxSetTime: {
62
+ fontSize: 18,
63
+ color: Colors.Green7,
64
+ fontWeight: '500',
65
+ },
66
+ textTimeDuration: {
67
+ fontSize: 18,
68
+ color: Colors.Gray6,
69
+ fontWeight: '500',
70
+ },
71
+ textDurationNotSelect: {
72
+ fontSize: 18,
73
+ color: Colors.Primary,
74
+ fontWeight: '500',
75
+ },
76
+ circleDuration: {
77
+ marginTop: 6,
78
+ },
79
+ wrapDuration: {
80
+ flexDirection: 'row',
81
+ justifyContent: 'center',
82
+ alignSelf: 'center',
83
+ },
84
+ wrap: {
85
+ paddingBottom: 100,
86
+ },
87
+ viewBottomFixed: {
88
+ position: 'absolute',
89
+ bottom: 0,
90
+ left: 0,
91
+ right: 0,
92
+ paddingBottom: getBottomSpace() > 0 ? getBottomSpace() : 32,
93
+ paddingTop: 29,
94
+ backgroundColor: Colors.White,
95
+ borderColor: Colors.ShadownTransparent,
96
+ borderTopWidth: 1,
97
+ },
98
+ });
@@ -0,0 +1,62 @@
1
+ import React from 'react';
2
+ import { act, create } from 'react-test-renderer';
3
+
4
+ import SetupGeneratePasscode from '../index';
5
+ import { mockSCStore } from '../../../../../context/mockStore';
6
+ import { TESTID } from '../../../../../configs/Constants';
7
+ import { SCProvider } from '../../../../../context';
8
+
9
+ const mockNavigate = jest.fn();
10
+ jest.mock('@react-navigation/native', () => {
11
+ return {
12
+ ...jest.requireActual('@react-navigation/native'),
13
+ useRoute: jest.fn(),
14
+ useNavigation: () => ({
15
+ navigate: mockNavigate,
16
+ }),
17
+ };
18
+ });
19
+
20
+ const wrapComponent = () => (
21
+ <SCProvider initState={mockSCStore({})}>
22
+ <SetupGeneratePasscode />
23
+ </SCProvider>
24
+ );
25
+
26
+ describe('Test SetupGeneratePasscode', () => {
27
+ let tree;
28
+
29
+ beforeEach(() => {
30
+ mockNavigate.mockClear();
31
+ });
32
+
33
+ const getElement = (instance) => {
34
+ const changeName = instance.findAll(
35
+ (item) => item.props.testID === TESTID.GENERATE_PASSCODE_CHOOSE_USER
36
+ );
37
+ const changeTime = instance.findAll(
38
+ (item) => item.props.testID === TESTID.GENERATE_PASSCODE_SET_TIME
39
+ );
40
+ const changeDuration = instance.findAll(
41
+ (item) => item.props.testID === TESTID.GENERATE_PASSCODE_SET_DURATION
42
+ );
43
+ return {
44
+ changeName,
45
+ changeTime,
46
+ changeDuration,
47
+ };
48
+ };
49
+
50
+ test('render SetupGeneratePasscode', async () => {
51
+ await act(async () => {
52
+ tree = create(wrapComponent());
53
+ });
54
+
55
+ const instance = tree.root;
56
+ const { changeName, changeTime, changeDuration } = getElement(instance);
57
+
58
+ expect(changeName[0]).toBeDefined();
59
+ expect(changeTime[0]).toBeDefined();
60
+ expect(changeDuration[0]).toBeDefined();
61
+ });
62
+ });