@hero-design/rn 8.63.3 → 8.64.0
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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +6 -0
- package/es/index.js +85 -38
- package/eslint.config.js +42 -0
- package/lib/index.js +85 -38
- package/package.json +7 -3
- package/rollup.config.js +13 -0
- package/sonar-project.properties +1 -1
- package/src/components/BottomSheet/__tests__/__snapshots__/index.spec.tsx.snap +5 -0
- package/src/components/BottomSheet/__tests__/index.spec.tsx +17 -0
- package/src/components/BottomSheet/index.tsx +6 -0
- package/src/components/Calendar/CalendarRowItem.tsx +3 -1
- package/src/components/Calendar/StyledCalendar.tsx +21 -8
- package/src/components/Calendar/__tests__/CalendarRowItem.spec.tsx +1 -0
- package/src/components/Calendar/__tests__/__snapshots__/CalendarRowItem.spec.tsx.snap +4 -2
- package/src/components/Calendar/__tests__/index.spec.tsx +7 -1
- package/src/components/Calendar/index.tsx +30 -8
- package/src/components/DatePicker/DatePickerCalendar.tsx +14 -10
- package/src/components/DatePicker/DatePickerIOS.tsx +2 -0
- package/src/components/DatePicker/__tests__/DatePickerCalendar.spec.tsx +37 -0
- package/src/components/DatePicker/__tests__/DatePickerIOS.spec.tsx +34 -0
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +5 -0
- package/src/components/DatePicker/types.ts +4 -0
- package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +5 -0
- package/src/components/FAB/ActionGroup/__tests__/index.spec.tsx +45 -24
- package/src/components/FAB/ActionGroup/index.tsx +6 -0
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +20 -0
- package/src/components/Select/MultiSelect/__tests__/index.spec.tsx +28 -0
- package/src/components/Select/MultiSelect/index.tsx +6 -0
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +15 -0
- package/src/components/Select/SingleSelect/__tests__/index.spec.tsx +25 -0
- package/src/components/Select/SingleSelect/index.tsx +6 -0
- package/src/components/TimePicker/TimePickerIOS.tsx +2 -0
- package/src/components/TimePicker/__tests__/TimePickerIOS.spec.tsx +31 -0
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +5 -0
- package/src/components/TimePicker/types.ts +4 -0
- package/src/testHelpers/utils.ts +21 -0
- package/stats/8.63.3/rn-stats.html +4844 -0
- package/stats/8.64.0/rn-stats.html +4842 -0
- package/types/components/BottomSheet/index.d.ts +5 -1
- package/types/components/Calendar/CalendarRowItem.d.ts +2 -1
- package/types/components/Calendar/StyledCalendar.d.ts +7 -0
- package/types/components/DatePicker/DatePickerCalendar.d.ts +1 -1
- package/types/components/DatePicker/DatePickerIOS.d.ts +1 -1
- package/types/components/DatePicker/types.d.ts +4 -0
- package/types/components/FAB/ActionGroup/index.d.ts +4 -0
- package/types/components/Select/MultiSelect/index.d.ts +5 -1
- package/types/components/Select/SingleSelect/index.d.ts +5 -1
- package/types/components/Select/index.d.ts +1 -1
- package/types/components/TimePicker/TimePickerIOS.d.ts +1 -1
- package/types/components/TimePicker/types.d.ts +4 -0
- package/types/testHelpers/utils.d.ts +1 -0
- package/.eslintrc.js +0 -13
- package/src/theme/components/.eslintrc.json +0 -10
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import type { ModalProps } from 'react-native';
|
|
4
4
|
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
5
5
|
import TimePickerIOS from '../TimePickerIOS';
|
|
6
|
+
import { setOrientation } from '../../../testHelpers/utils';
|
|
6
7
|
|
|
7
8
|
jest.mock('react-native/Libraries/Modal/Modal', () => {
|
|
8
9
|
const Modal = jest.requireActual('react-native/Libraries/Modal/Modal');
|
|
@@ -43,6 +44,36 @@ describe('TimePickerIOS', () => {
|
|
|
43
44
|
expect(onChange).toBeCalledWith(new Date('December 17, 1995 05:30:00'));
|
|
44
45
|
});
|
|
45
46
|
|
|
47
|
+
it('renders correctly in landscape mode', () => {
|
|
48
|
+
setOrientation('landscape');
|
|
49
|
+
|
|
50
|
+
const onChange = jest.fn();
|
|
51
|
+
const { getByText, queryByTestId } = renderWithTheme(
|
|
52
|
+
<TimePickerIOS
|
|
53
|
+
value={new Date('December 17, 1995 03:24:00')}
|
|
54
|
+
label="Break time"
|
|
55
|
+
confirmLabel="Confirm"
|
|
56
|
+
onChange={onChange}
|
|
57
|
+
supportedOrientations={['landscape']}
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
// Open time picker
|
|
62
|
+
fireEvent.press(getByText('Break time'));
|
|
63
|
+
expect(queryByTestId('timePickerIOS')).toBeTruthy();
|
|
64
|
+
|
|
65
|
+
// Change time
|
|
66
|
+
fireEvent(
|
|
67
|
+
queryByTestId('timePickerIOS'),
|
|
68
|
+
'onChange',
|
|
69
|
+
null,
|
|
70
|
+
new Date('December 17, 1995 05:30:00')
|
|
71
|
+
);
|
|
72
|
+
fireEvent.press(getByText('Confirm'));
|
|
73
|
+
|
|
74
|
+
expect(onChange).toBeCalledWith(new Date('December 17, 1995 05:30:00'));
|
|
75
|
+
});
|
|
76
|
+
|
|
46
77
|
it('renders correct help text', () => {
|
|
47
78
|
const { getByText } = renderWithTheme(
|
|
48
79
|
<TimePickerIOS
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Dimensions } from 'react-native';
|
|
2
|
+
|
|
3
|
+
const DEFAULT_DIMENSIONS = {
|
|
4
|
+
width: 390,
|
|
5
|
+
height: 844,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const setOrientation = (orientation: 'portrait' | 'landscape') => {
|
|
9
|
+
jest.spyOn(Dimensions, 'get').mockImplementation(() => ({
|
|
10
|
+
width:
|
|
11
|
+
orientation === 'landscape'
|
|
12
|
+
? DEFAULT_DIMENSIONS.height
|
|
13
|
+
: DEFAULT_DIMENSIONS.width,
|
|
14
|
+
height:
|
|
15
|
+
orientation === 'landscape'
|
|
16
|
+
? DEFAULT_DIMENSIONS.width
|
|
17
|
+
: DEFAULT_DIMENSIONS.height,
|
|
18
|
+
scale: 1,
|
|
19
|
+
fontScale: 1,
|
|
20
|
+
}));
|
|
21
|
+
};
|