@eohjsc/react-native-smart-city 0.2.56 → 0.2.60

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/Map/MarkerGeolocation.svg +4 -0
  2. package/assets/images/SonosSpeaker/buttonpause-active.svg +3 -0
  3. package/assets/images/SonosSpeaker/buttonpause-notactive.svg +3 -0
  4. package/assets/images/SonosSpeaker/picture-main-notactive.svg +5 -0
  5. package/assets/images/SonosSpeaker/picture-main.svg +6 -0
  6. package/assets/images/SonosSpeaker/picture-volume.svg +3 -0
  7. package/package.json +4 -22
  8. package/src/Images/Common/buttonLeftCurtain.png +0 -0
  9. package/src/Images/Common/buttonPause-center-curtain.png +0 -0
  10. package/src/Images/Common/buttonRightCurtain.png +0 -0
  11. package/src/commons/ActionGroup/CurtainButtonTemplate.js +139 -0
  12. package/src/commons/ActionGroup/CurtainButtonTemplateStyle.js +58 -0
  13. package/src/commons/ActionGroup/__test__/CurtainButtonTemplate.test.js +72 -0
  14. package/src/commons/ActionGroup/index.js +3 -0
  15. package/src/commons/Auth/__test__/AccountList.test.js +33 -0
  16. package/src/commons/CameraDevice/index.js +2 -0
  17. package/src/commons/CardShadow/index.js +1 -1
  18. package/src/commons/CardShadow/styles.js +1 -3
  19. package/src/commons/DateTimeRangeChange/DateTimeButton.js +1 -1
  20. package/src/commons/DateTimeRangeChange/index.js +2 -2
  21. package/src/commons/Device/HistoryChart.js +21 -55
  22. package/src/commons/Device/HorizontalBarChart.js +46 -30
  23. package/src/commons/Device/LinearChart.js +0 -34
  24. package/src/commons/Device/PMSensor/PMSensorIndicatior.js +1 -1
  25. package/src/commons/Device/PMSensor/PMSensorIndicatorStyles.js +2 -1
  26. package/src/commons/Device/SonosSpeaker/__test__/SonosSpeaker.test.js +57 -0
  27. package/src/commons/Device/SonosSpeaker/index.js +88 -0
  28. package/src/commons/Device/SonosSpeaker/styles.js +57 -0
  29. package/src/commons/Form/CurrencyInput.js +169 -0
  30. package/src/commons/Form/__test__/CurrencyInput.test.js +65 -0
  31. package/src/commons/FourButtonFilterHistory/__test__/FourButtonFilterHistory.test.js +48 -0
  32. package/src/commons/FourButtonFilterHistory/index.js +72 -0
  33. package/src/commons/FourButtonFilterHistory/styles.js +22 -0
  34. package/src/commons/MediaPlayerDetail/Styles/MediaPlayerDetailStyles.js +14 -0
  35. package/src/commons/MediaPlayerDetail/index.js +204 -161
  36. package/src/commons/SearchLocation/index.js +0 -1
  37. package/src/commons/Sharing/RowMember.js +7 -2
  38. package/src/commons/Sharing/__test__/RowMember.test.js +42 -0
  39. package/src/commons/SubUnit/ShortDetail.js +12 -6
  40. package/src/commons/UnitSummary/AirQuality/SegmentedRoundDisplay/index.js +1 -1
  41. package/src/commons/UnitSummary/ConfigHistoryChart.js +2 -1
  42. package/src/configs/API.js +13 -3
  43. package/src/configs/Constants.js +14 -4
  44. package/src/configs/Images.js +3 -0
  45. package/src/configs/SCConfig.js +8 -0
  46. package/src/context/actionType.ts +5 -0
  47. package/src/context/mockStore.ts +3 -0
  48. package/src/context/reducer.ts +14 -0
  49. package/src/iot/RemoteControl/Bluetooth.js +14 -0
  50. package/src/iot/RemoteControl/index.js +0 -1
  51. package/src/navigations/UnitStack.js +42 -4
  52. package/src/screens/ActivityLog/FilterPopup.js +1 -1
  53. package/src/screens/ActivityLog/ItemLog.js +11 -2
  54. package/src/screens/ActivityLog/__test__/ItemLog.test.js +46 -0
  55. package/src/screens/ActivityLog/hooks/index.js +1 -0
  56. package/src/screens/ActivityLog/index.js +0 -1
  57. package/src/screens/AddCommon/SelectSubUnit.js +24 -2
  58. package/src/screens/AddCommon/SelectUnit.js +12 -0
  59. package/src/screens/AddLocationMaps/index.js +139 -44
  60. package/src/screens/AddLocationMaps/indexStyle.js +14 -12
  61. package/src/screens/AddNewAction/SelectAction.js +1 -0
  62. package/src/screens/Automate/MultiUnits.js +8 -8
  63. package/src/screens/Automate/__test__/MultiUnits.test.js +2 -2
  64. package/src/screens/Automate/__test__/index.test.js +2 -0
  65. package/src/screens/Automate/index.js +4 -2
  66. package/src/screens/Device/__test__/detail.test.js +3 -7
  67. package/src/screens/Device/components/SensorDisplayItem.js +10 -10
  68. package/src/screens/Device/detail.js +65 -15
  69. package/src/screens/Device/hooks/useDisconnectedDevice.js +32 -26
  70. package/src/screens/Device/styles.js +3 -3
  71. package/src/screens/EmergencySetting/__test__/DropDownItem.test.js +59 -0
  72. package/src/screens/EmergencySetting/__test__/index.test.js +27 -0
  73. package/src/screens/EmergencySetting/components/DropDownItem.js +54 -0
  74. package/src/screens/EmergencySetting/index.js +90 -0
  75. package/src/screens/EmergencySetting/styles/DropDownItem.js +38 -0
  76. package/src/screens/EmergencySetting/styles.js +19 -0
  77. package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +126 -0
  78. package/src/screens/MoveToAnotherSubUnit/index.js +88 -0
  79. package/src/screens/MoveToAnotherSubUnit/styles/MoveToAnotherSubUnitStyles.js +50 -0
  80. package/src/screens/Notification/__test__/Notification.test.js +3 -3
  81. package/src/screens/Notification/components/NotificationItem.js +3 -6
  82. package/src/screens/Notification/index.js +2 -2
  83. package/src/screens/ScriptDetail/Styles/indexStyles.js +0 -1
  84. package/src/screens/ScriptDetail/__test__/index.test.js +13 -0
  85. package/src/screens/ScriptDetail/index.js +20 -17
  86. package/src/screens/SelectUnit/index.js +2 -0
  87. package/src/screens/Sharing/MemberList.js +2 -9
  88. package/src/screens/SubUnit/AddSubUnit.js +79 -59
  89. package/src/screens/SubUnit/AddSubUnitStyles.js +0 -2
  90. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +4 -3
  91. package/src/screens/TDSGuide/index.js +6 -4
  92. package/src/screens/Unit/ChooseLocation.js +96 -0
  93. package/src/screens/Unit/ChooseLocationStyles.js +26 -0
  94. package/src/screens/Unit/Detail.js +14 -2
  95. package/src/screens/Unit/ManageUnit.js +4 -5
  96. package/src/screens/Unit/SelectAddress.js +240 -0
  97. package/src/screens/Unit/SelectAddressStyles.js +48 -0
  98. package/src/screens/Unit/SmartAccountItem.js +1 -1
  99. package/src/screens/Unit/Summaries.js +5 -1
  100. package/src/screens/Unit/__test__/ChooseLocation.test.js +112 -0
  101. package/src/screens/Unit/__test__/SelectAddress.test.js +216 -0
  102. package/src/screens/Unit/components/MyUnitDevice/index.js +21 -5
  103. package/src/screens/Unit/hook/useStateAlertRemove.js +3 -1
  104. package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +2 -2
  105. package/src/screens/UnitSummary/components/PowerConsumption/index.js +3 -2
  106. package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +1 -3
  107. package/src/screens/UnitSummary/index.js +3 -2
  108. package/src/screens/WaterQualityGuide/index.js +1 -0
  109. package/src/utils/Apis/axios.js +17 -5
  110. package/src/utils/I18n/translations/en.json +19 -4
  111. package/src/utils/I18n/translations/vi.json +22 -7
  112. package/src/utils/Route/index.js +4 -1
  113. package/src/utils/Utils.js +22 -2
  114. package/assets/images/AddLocationMaps/PinLocation.svg +0 -3
  115. package/assets/images/AddLocationMaps/Point.svg +0 -3
  116. package/src/commons/ThreeButtonHistory/CalendarHeader.js +0 -35
  117. package/src/commons/ThreeButtonHistory/CalendarHeaderStyles.js +0 -17
  118. package/src/commons/ThreeButtonHistory/SelectMonth.js +0 -53
  119. package/src/commons/ThreeButtonHistory/SelectMonthStyles.js +0 -29
  120. package/src/commons/ThreeButtonHistory/__test__/SelectMonth.test.js +0 -37
  121. package/src/commons/ThreeButtonHistory/__test__/ThreeButtonHistory.test.js +0 -231
  122. package/src/commons/ThreeButtonHistory/index.js +0 -281
  123. package/src/commons/ThreeButtonHistory/styles.js +0 -65
  124. package/src/screens/Unit/ManageUnit/index.js +0 -286
  125. package/src/screens/Unit/SelectLocation.js +0 -161
  126. package/src/screens/Unit/SelectLocationStyles.js +0 -114
@@ -1,231 +0,0 @@
1
- import React from 'react';
2
- import { act, create } from 'react-test-renderer';
3
- import { SCProvider } from '../../../context';
4
- import { mockSCStore } from '../../../context/mockStore';
5
- import ThreeButtonHistory from '../index';
6
- import moment from 'moment';
7
- import SelectMonth from '../SelectMonth';
8
- import { TESTID } from '../../../configs/Constants';
9
- import { TouchableOpacity } from 'react-native';
10
- import CalendarHeader from '../CalendarHeader';
11
- import ViewButtonBottom from '../../ViewButtonBottom';
12
- import BottomSheet from '../../BottomSheet';
13
- import styles from '../styles';
14
-
15
- const wrapComponent = (props) => (
16
- <SCProvider initState={mockSCStore({})}>
17
- <ThreeButtonHistory {...props} />
18
- </SCProvider>
19
- );
20
-
21
- jest.mock('react', () => {
22
- return {
23
- ...jest.requireActual('react'),
24
- memo: (x) => x,
25
- };
26
- });
27
-
28
- describe('test ThreeButtonHistory', () => {
29
- Date.now = jest.fn(() => new Date('2021-09-09T10:00:00.000Z'));
30
- let tree;
31
- let props;
32
- const startDate = moment().add(-7, 'days').valueOf();
33
- const endDate = moment().valueOf();
34
- const mockSetStartDate = jest.fn();
35
- const mockSetEndDate = jest.fn();
36
- const mockSetGroupBy = jest.fn();
37
-
38
- beforeEach(() => {
39
- mockSetStartDate.mockClear();
40
- mockSetEndDate.mockClear();
41
- mockSetGroupBy.mockClear();
42
- props = {
43
- startDate,
44
- endDate,
45
- setStartDate: mockSetStartDate,
46
- setEndDate: mockSetEndDate,
47
- setGroupBy: mockSetGroupBy,
48
- };
49
- });
50
-
51
- const openCalendar = async (instance) => {
52
- const historyButtons = instance.findAll(
53
- (el) =>
54
- el.props.testID === TESTID.HISTORY_BUTTON &&
55
- el.type === TouchableOpacity
56
- );
57
- expect(historyButtons).toHaveLength(3);
58
- await act(async () => {
59
- await historyButtons[2].props.onPress();
60
- });
61
- };
62
-
63
- const testSelectGroupBy = async (index, groupBy) => {
64
- await act(async () => {
65
- tree = await create(wrapComponent(props));
66
- });
67
- const instance = tree.root;
68
- const historyButtons = instance.findAll(
69
- (el) =>
70
- el.props.testID === TESTID.HISTORY_BUTTON &&
71
- el.type === TouchableOpacity
72
- );
73
- await act(async () => {
74
- await historyButtons[index].props.onPress();
75
- });
76
- expect(mockSetGroupBy).toBeCalledWith(groupBy);
77
- };
78
-
79
- test('test group by date', async () => {
80
- await testSelectGroupBy(2, 'date');
81
- });
82
-
83
- test('test group by week', async () => {
84
- await testSelectGroupBy(0, 'week');
85
- });
86
-
87
- test('test group by month', async () => {
88
- await testSelectGroupBy(1, 'month');
89
- });
90
-
91
- test('test calendar change month', async () => {
92
- await act(async () => {
93
- tree = await create(wrapComponent(props));
94
- });
95
- const instance = tree.root;
96
-
97
- await openCalendar(instance);
98
- const calendar = instance.find(
99
- (el) => el.props.testID === TESTID.HISTORY_CALENDAR
100
- );
101
- const calendarHeader = instance.findByType(CalendarHeader);
102
- expect(calendarHeader.props.currentMonth.toString()).toBe(
103
- moment().toString()
104
- );
105
- // Click calendar title
106
- await act(async () => {
107
- await calendarHeader.props.onPressTitle();
108
- });
109
- const selectMonth = instance.findByType(SelectMonth);
110
- expect(selectMonth).toBeDefined();
111
- expect(calendar.props.style).toBe(styles.displayNone);
112
- // Click arrow left
113
- await act(async () => {
114
- await calendarHeader.props.onSubtractMonth();
115
- });
116
- expect(calendarHeader.props.currentMonth.toString()).toBe(
117
- moment().add(-1, 'month').toString()
118
- );
119
- // Click arrow right
120
- await act(async () => {
121
- await calendarHeader.props.onAddMonth();
122
- });
123
- expect(calendarHeader.props.currentMonth.toString()).toBe(
124
- moment().toString()
125
- );
126
- // Click arrow right
127
- await act(async () => {
128
- await calendarHeader.props.onAddMonth();
129
- });
130
- expect(calendarHeader.props.currentMonth.toString()).toBe(
131
- moment().toString()
132
- ); // exceeded limit
133
- });
134
-
135
- test('test press Done', async () => {
136
- await act(async () => {
137
- tree = await create(wrapComponent(props));
138
- });
139
- const instance = tree.root;
140
- const modal = instance.findByType(BottomSheet);
141
-
142
- await openCalendar(instance);
143
- expect(modal.props.isVisible).toBeTruthy();
144
-
145
- const calendar = instance.find(
146
- (el) => el.props.testID === TESTID.HISTORY_CALENDAR
147
- );
148
- const calendarHeader = instance.findByType(CalendarHeader);
149
- const viewButtonBottom = instance.findByType(ViewButtonBottom);
150
- // Click calendar title
151
- await act(async () => {
152
- await calendarHeader.props.onPressTitle();
153
- });
154
- expect(calendar.props.style).toBe(styles.displayNone);
155
- // Click Done
156
- await act(async () => {
157
- await viewButtonBottom.props.onRightClick();
158
- });
159
- expect(calendar.props.style).not.toBe(styles.displayNone);
160
- // Click Done
161
- await act(async () => {
162
- await viewButtonBottom.props.onRightClick();
163
- });
164
- expect(mockSetStartDate).toBeCalled();
165
- expect(mockSetEndDate).toBeCalled();
166
- expect(modal.props.isVisible).toBeFalsy();
167
- });
168
-
169
- test('test press Cancel', async () => {
170
- await act(async () => {
171
- tree = await create(wrapComponent(props));
172
- });
173
- const instance = tree.root;
174
- const modal = instance.findByType(BottomSheet);
175
-
176
- await openCalendar(instance);
177
- expect(modal.props.isVisible).toBeTruthy();
178
-
179
- const calendar = instance.find(
180
- (el) => el.props.testID === TESTID.HISTORY_CALENDAR
181
- );
182
- const calendarHeader = instance.findByType(CalendarHeader);
183
- const viewButtonBottom = instance.findByType(ViewButtonBottom);
184
- // Click calendar title
185
- await act(async () => {
186
- await calendarHeader.props.onPressTitle();
187
- });
188
- expect(calendar.props.style).toBe(styles.displayNone);
189
- // Click Cancel
190
- await act(async () => {
191
- await viewButtonBottom.props.onLeftClick();
192
- });
193
- expect(calendar.props.style).not.toBe(styles.displayNone);
194
- // Click Cancel
195
- await act(async () => {
196
- await viewButtonBottom.props.onLeftClick();
197
- });
198
- expect(modal.props.isVisible).toBeFalsy();
199
- });
200
-
201
- test('test calendar select date range', async () => {
202
- await act(async () => {
203
- tree = await create(wrapComponent(props));
204
- });
205
- const instance = tree.root;
206
-
207
- await openCalendar(instance);
208
- const calendar = instance.find(
209
- (el) => el.props.testID === TESTID.HISTORY_CALENDAR
210
- );
211
-
212
- const selectDate = async (date) => {
213
- await act(async () => {
214
- await calendar.props.onDayPress({ dateString: date });
215
- });
216
- };
217
- await selectDate('2021-09-20');
218
- await selectDate('2021-09-02');
219
- await selectDate('2021-09-09');
220
- await selectDate('2021-09-10');
221
- await selectDate('2021-09-05');
222
- await selectDate('2021-09-05');
223
- await selectDate('2021-09-20');
224
- const viewButtonBottom = instance.findByType(ViewButtonBottom);
225
- await act(async () => {
226
- await viewButtonBottom.props.onRightClick();
227
- });
228
- expect(mockSetStartDate).toBeCalledWith(moment('2021-09-10').valueOf());
229
- expect(mockSetEndDate).toBeCalledWith(moment('2021-09-20').valueOf());
230
- });
231
- });
@@ -1,281 +0,0 @@
1
- import React, { memo, useCallback, useState, useMemo, useRef } from 'react';
2
- import { View, TouchableOpacity } from 'react-native';
3
- import { IconOutline } from '@ant-design/icons-react-native';
4
- import { Calendar } from 'react-native-calendars';
5
- import moment from 'moment';
6
-
7
- import Text from '../../commons/Text';
8
- import BottomSheet from '../../commons/BottomSheet';
9
- import SelectMonth from './SelectMonth';
10
- import CalendarHeader from './CalendarHeader';
11
- import ViewButtonBottom from '../ViewButtonBottom';
12
- import { useTranslations } from '../../hooks/Common/useTranslations';
13
-
14
- import { Colors } from '../../configs';
15
- import { TESTID } from '../../configs/Constants';
16
- import styles from './styles';
17
-
18
- const ThreeButtonHistory = memo(
19
- ({ startDate, endDate, setEndDate, setStartDate, setGroupBy }) => {
20
- const t = useTranslations();
21
- const calendarRef = useRef();
22
- const [selectedIndex, setSelectedIndex] = useState(2);
23
- const [isShowDate, setIsShowDate] = useState(false);
24
- const [selectedStart, setSelectedStart] = useState(
25
- moment(startDate).format('YYYY-MM-DD')
26
- );
27
- const [selectedEnd, setSelectedEnd] = useState(
28
- moment(endDate).format('YYYY-MM-DD')
29
- );
30
-
31
- const [showSelectMonth, setShowSelectMonth] = useState(false);
32
- const [currentMonth, setCurrentMonth] = useState(moment());
33
-
34
- const listItem = useMemo(
35
- () => [
36
- {
37
- id: 1,
38
- dateTitle: '7D',
39
- },
40
- {
41
- id: 2,
42
- dateTitle: '1M',
43
- },
44
- {
45
- id: 3,
46
- dateTitle: (
47
- <View style={styles.paddingTop2}>
48
- <IconOutline
49
- name="calendar"
50
- color={selectedIndex === 2 ? Colors.Primary : Colors.Gray8}
51
- size={21}
52
- />
53
- </View>
54
- ),
55
- },
56
- ],
57
- [selectedIndex]
58
- );
59
-
60
- const onPressCancel = useCallback(() => {
61
- if (showSelectMonth) {
62
- setShowSelectMonth(false);
63
- return;
64
- }
65
- setIsShowDate(false);
66
- }, [showSelectMonth, setShowSelectMonth]);
67
-
68
- const onPressDone = useCallback(() => {
69
- if (showSelectMonth) {
70
- setShowSelectMonth(false);
71
- return;
72
- }
73
- if (selectedStart === null || selectedEnd === null) {
74
- return;
75
- }
76
- setIsShowDate(false);
77
- setStartDate(moment(selectedStart).valueOf());
78
- setEndDate(moment(selectedEnd).valueOf());
79
- }, [
80
- setStartDate,
81
- selectedStart,
82
- setEndDate,
83
- selectedEnd,
84
- showSelectMonth,
85
- setShowSelectMonth,
86
- ]);
87
-
88
- const onDayPress = useCallback(
89
- (date) => {
90
- const selectedDate = date.dateString;
91
- if (selectedDate === selectedStart) {
92
- setSelectedStart(null);
93
- return;
94
- }
95
- if (selectedDate === selectedEnd) {
96
- setSelectedEnd(null);
97
- return;
98
- }
99
- if (selectedStart !== null && selectedEnd !== null) {
100
- return;
101
- }
102
- if (selectedEnd === null) {
103
- setSelectedEnd(selectedDate);
104
- } else {
105
- if (moment(selectedDate).isAfter(selectedEnd, 'date')) {
106
- setSelectedStart(selectedEnd);
107
- setSelectedEnd(selectedDate);
108
- } else {
109
- setSelectedStart(selectedDate);
110
- }
111
- }
112
- },
113
- [selectedStart, selectedEnd]
114
- );
115
-
116
- const onPressItemButton = useCallback(
117
- (index) => {
118
- switch (index) {
119
- case 0:
120
- setGroupBy('week');
121
- break;
122
- case 1:
123
- setGroupBy('month');
124
- break;
125
- case 2:
126
- setGroupBy('date');
127
- if (selectedIndex === 2) {
128
- setIsShowDate(true);
129
- }
130
- }
131
- setSelectedIndex(index);
132
- },
133
- [selectedIndex, setGroupBy]
134
- );
135
-
136
- const ItemButton = memo(
137
- ({ dateTitle, onPress, isSelected }) => {
138
- return (
139
- <TouchableOpacity
140
- onPress={onPress}
141
- style={[styles.buttonDate, isSelected && styles.buttonDateActive]}
142
- testID={TESTID.HISTORY_BUTTON}
143
- >
144
- <View>
145
- <Text semibold color={isSelected && Colors.Primary}>
146
- {dateTitle}
147
- </Text>
148
- </View>
149
- </TouchableOpacity>
150
- );
151
- },
152
- [selectedIndex]
153
- );
154
-
155
- const onPressCalendarTitle = useCallback(() => {
156
- setShowSelectMonth((state) => !state);
157
- }, [setShowSelectMonth]);
158
-
159
- const onAddMonth = useCallback(() => {
160
- setCurrentMonth((oldMonth) => {
161
- const newMonth = moment(oldMonth).add(1, 'months');
162
- if (newMonth.isAfter(moment(), 'month')) {
163
- return oldMonth;
164
- }
165
- calendarRef?.current?.addMonth(1);
166
- return newMonth;
167
- });
168
- }, []);
169
-
170
- const onSubtractMonth = useCallback(() => {
171
- setCurrentMonth((oldMonth) => moment(oldMonth).add(-1, 'months'));
172
- calendarRef?.current?.addMonth(-1);
173
- }, []);
174
-
175
- const onMonthSelected = useCallback(
176
- (month) => {
177
- setCurrentMonth((oldMonth) => {
178
- const monthDiff = month.month() - oldMonth.month();
179
- calendarRef?.current?.addMonth(monthDiff);
180
- return month;
181
- });
182
- },
183
- [setCurrentMonth]
184
- );
185
-
186
- const markedDates = useMemo(() => {
187
- const dates = {
188
- [selectedStart]: {
189
- selected: true,
190
- selectedColor: Colors.Primary,
191
- selectedTextColor: Colors.White,
192
- },
193
- [selectedEnd]: {
194
- selected: true,
195
- selectedColor: Colors.Primary,
196
- selectedTextColor: Colors.White,
197
- },
198
- };
199
- const currDate = moment(selectedStart).startOf('day');
200
- const lastDate = moment(selectedEnd).startOf('day');
201
-
202
- while (currDate.add(1, 'days').diff(lastDate) < 0) {
203
- dates[[moment(currDate).format('YYYY-MM-DD')]] = {
204
- customStyles: {
205
- container: {
206
- borderRadius: 0,
207
- width: 60,
208
- backgroundColor: Colors.Gray4,
209
- },
210
- text: {
211
- color: Colors.Black,
212
- },
213
- },
214
- selected: true,
215
- disableTouchEvent: true,
216
- color: Colors.Gray4,
217
- };
218
- }
219
- return dates;
220
- }, [selectedStart, selectedEnd]);
221
-
222
- return (
223
- <>
224
- <View style={styles.historyTitleRight}>
225
- {listItem &&
226
- listItem.map((item, index) => {
227
- return (
228
- <ItemButton
229
- key={index}
230
- dateTitle={item.dateTitle}
231
- onPress={() => onPressItemButton(index)}
232
- isSelected={selectedIndex === index}
233
- />
234
- );
235
- })}
236
- </View>
237
- <BottomSheet
238
- isVisible={isShowDate}
239
- onBackdropPress={onPressCancel}
240
- style={styles.modal}
241
- >
242
- <View style={styles.calendar}>
243
- <CalendarHeader
244
- currentMonth={currentMonth}
245
- onAddMonth={onAddMonth}
246
- onSubtractMonth={onSubtractMonth}
247
- onPressTitle={onPressCalendarTitle}
248
- />
249
- {showSelectMonth && (
250
- <SelectMonth
251
- selectedMonth={currentMonth}
252
- setSelectedMonth={onMonthSelected}
253
- />
254
- )}
255
- <Calendar
256
- ref={calendarRef}
257
- current={currentMonth.format('YYYY-MM-DD')}
258
- style={showSelectMonth && styles.displayNone}
259
- markingType={'custom'}
260
- onDayPress={onDayPress}
261
- maxDate={moment().format('YYYY-MM-DD')}
262
- markedDates={markedDates}
263
- hideArrows={true}
264
- renderHeader={() => <></>}
265
- testID={TESTID.HISTORY_CALENDAR}
266
- />
267
- <View style={styles.separator} />
268
- <ViewButtonBottom
269
- leftTitle={t('cancel')}
270
- onLeftClick={onPressCancel}
271
- rightTitle={t('done')}
272
- onRightClick={onPressDone}
273
- />
274
- </View>
275
- </BottomSheet>
276
- </>
277
- );
278
- }
279
- );
280
-
281
- export default ThreeButtonHistory;
@@ -1,65 +0,0 @@
1
- import { StyleSheet } from 'react-native';
2
- import { isIphoneX } from 'react-native-iphone-x-helper';
3
-
4
- import { Colors } from '../../configs';
5
-
6
- export default StyleSheet.create({
7
- historyTitle: {
8
- flex: 1,
9
- flexDirection: 'row',
10
- justifyContent: 'space-between',
11
- },
12
- historyTitleRight: {
13
- flexDirection: 'row',
14
- backgroundColor: Colors.Gray4,
15
- borderRadius: 5,
16
- paddingHorizontal: 2,
17
- },
18
- buttonDate: {
19
- alignItems: 'center',
20
- marginVertical: 2,
21
- borderRadius: 5,
22
- paddingHorizontal: 8,
23
- },
24
- buttonDateActive: {
25
- backgroundColor: Colors.White,
26
- },
27
- modal: {
28
- margin: 0,
29
- padding: 0,
30
- },
31
- calendar: {
32
- position: 'absolute',
33
- bottom: 0,
34
- left: 0,
35
- right: 0,
36
- borderTopLeftRadius: 10,
37
- borderTopRightRadius: 10,
38
- overflow: 'hidden',
39
- backgroundColor: Colors.White,
40
- },
41
- separator: {
42
- height: 1,
43
- backgroundColor: Colors.Gray3,
44
- marginTop: 5,
45
- },
46
- wrapBottomButton: {
47
- height: 56 + (isIphoneX() ? 10 : 0),
48
- justifyContent: 'space-between',
49
- alignItems: 'center',
50
- paddingHorizontal: 80,
51
- flexDirection: 'row',
52
- marginTop: -10,
53
- },
54
- button: {
55
- height: 40,
56
- justifyContent: 'center',
57
- alignItems: 'center',
58
- },
59
- paddingTop2: {
60
- paddingTop: 2,
61
- },
62
- displayNone: {
63
- display: 'none',
64
- },
65
- });