@hero-design/rn 8.113.0 → 8.113.1

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 (81) hide show
  1. package/.turbo/turbo-build.log +3 -3
  2. package/CHANGELOG.md +11 -0
  3. package/es/index.js +116 -133
  4. package/lib/index.js +115 -132
  5. package/package.json +4 -4
  6. package/src/components/Alert/index.tsx +1 -1
  7. package/src/components/Badge/Count.tsx +2 -2
  8. package/src/components/Badge/Status.tsx +2 -2
  9. package/src/components/Badge/index.tsx +2 -1
  10. package/src/components/BottomNavigation/StyledBottomNavigation.tsx +1 -1
  11. package/src/components/BottomNavigation/__tests__/__snapshots__/index.spec.tsx.snap +32 -36
  12. package/src/components/BottomNavigation/__tests__/index.spec.tsx +17 -8
  13. package/src/components/BottomNavigation/index.tsx +4 -5
  14. package/src/components/BottomSheet/ScrollView.tsx +2 -1
  15. package/src/components/BottomSheet/index.tsx +1 -1
  16. package/src/components/Button/Button.tsx +2 -2
  17. package/src/components/Calendar/__tests__/index.spec.tsx +3 -8
  18. package/src/components/Card/DataCard/index.tsx +2 -2
  19. package/src/components/Card/index.tsx +2 -2
  20. package/src/components/Carousel/index.tsx +2 -2
  21. package/src/components/DatePicker/Dialog/__tests__/IOSDialog.spec.tsx +0 -6
  22. package/src/components/DatePicker/__tests__/DatePickerCalendar.spec.tsx +2 -10
  23. package/src/components/DatePicker/__tests__/DatePickerIOS.spec.tsx +27 -0
  24. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +176 -728
  25. package/src/components/Drawer/DragableDrawer/index.tsx +2 -2
  26. package/src/components/Drawer/index.tsx +2 -2
  27. package/src/components/FAB/__tests__/index.spec.tsx +33 -8
  28. package/src/components/Image/index.tsx +2 -1
  29. package/src/components/List/BasicListItem.tsx +2 -1
  30. package/src/components/List/ListItem.tsx +1 -1
  31. package/src/components/MapPin/Focussed.tsx +2 -1
  32. package/src/components/MapPin/index.tsx +2 -1
  33. package/src/components/Modal/__tests__/index.spec.tsx +46 -0
  34. package/src/components/Modal/index.tsx +121 -149
  35. package/src/components/Progress/ProgressBar.tsx +2 -1
  36. package/src/components/Progress/ProgressCircle.tsx +2 -1
  37. package/src/components/RichTextEditor/MentionList.tsx +2 -1
  38. package/src/components/Tabs/ScrollableTabsHeader/ScrollableTabsHeader.tsx +4 -6
  39. package/src/components/Tabs/__tests__/ScrollableTabs.spec.tsx +43 -32
  40. package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabs.spec.tsx.snap +105 -129
  41. package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabsHeader.spec.tsx.snap +30 -42
  42. package/src/components/Tabs/__tests__/__snapshots__/index.spec.tsx.snap +0 -683
  43. package/src/components/Tabs/__tests__/index.spec.tsx +37 -25
  44. package/src/components/Tabs/index.tsx +2 -2
  45. package/src/components/Tag/index.tsx +1 -1
  46. package/src/components/TimePicker/__tests__/TimePickerIOS.spec.tsx +0 -6
  47. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +237 -282
  48. package/src/components/Toast/Toast.tsx +2 -1
  49. package/src/components/Toolbar/ToolbarItem.tsx +2 -1
  50. package/src/components/Typography/Label/index.tsx +1 -1
  51. package/src/testHelpers/renderWithTheme.tsx +2 -1
  52. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +1 -1
  53. package/src/theme/components/bottomNavigation.ts +1 -1
  54. package/types/components/Alert/index.d.ts +1 -1
  55. package/types/components/Badge/Count.d.ts +2 -2
  56. package/types/components/Badge/Status.d.ts +2 -2
  57. package/types/components/Badge/index.d.ts +4 -3
  58. package/types/components/BottomNavigation/StyledBottomNavigation.d.ts +1 -1
  59. package/types/components/BottomNavigation/index.d.ts +2 -2
  60. package/types/components/BottomSheet/index.d.ts +1 -1
  61. package/types/components/Button/Button.d.ts +2 -2
  62. package/types/components/Card/DataCard/index.d.ts +2 -2
  63. package/types/components/Card/index.d.ts +3 -3
  64. package/types/components/Carousel/index.d.ts +2 -2
  65. package/types/components/Drawer/DragableDrawer/index.d.ts +2 -2
  66. package/types/components/Drawer/index.d.ts +3 -3
  67. package/types/components/Image/index.d.ts +2 -1
  68. package/types/components/List/BasicListItem.d.ts +2 -1
  69. package/types/components/List/ListItem.d.ts +1 -1
  70. package/types/components/MapPin/Focussed.d.ts +2 -1
  71. package/types/components/MapPin/index.d.ts +3 -2
  72. package/types/components/Modal/index.d.ts +2 -2
  73. package/types/components/Progress/ProgressBar.d.ts +2 -1
  74. package/types/components/Progress/ProgressCircle.d.ts +2 -1
  75. package/types/components/Progress/index.d.ts +2 -2
  76. package/types/components/RichTextEditor/MentionList.d.ts +2 -1
  77. package/types/components/Tabs/index.d.ts +2 -2
  78. package/types/components/Tag/index.d.ts +1 -1
  79. package/types/components/Toast/Toast.d.ts +2 -1
  80. package/types/components/Typography/Label/index.d.ts +1 -1
  81. package/types/testHelpers/renderWithTheme.d.ts +84 -1
@@ -1,7 +1,7 @@
1
1
  import { View } from 'react-native';
2
2
  import React, { useMemo } from 'react';
3
3
  import type { StyleProp, ViewStyle, ViewProps } from 'react-native';
4
- import type { ReactNode } from 'react';
4
+ import type { ReactElement, ReactNode } from 'react';
5
5
  import { StyledCount, StyledCountText } from './StyledBadge';
6
6
  import { DEFAULT_MAX_NUMBER } from './constants';
7
7
 
@@ -40,7 +40,7 @@ const Status = ({
40
40
  testID,
41
41
  content: originalContent,
42
42
  ...nativeProps
43
- }: CountProps): JSX.Element => {
43
+ }: CountProps): ReactElement => {
44
44
  const content = useMemo(() => {
45
45
  return originalContent > max ? `${max}+` : String(originalContent);
46
46
  }, [originalContent, max]);
@@ -1,7 +1,7 @@
1
1
  import { View, Animated } from 'react-native';
2
2
  import React from 'react';
3
3
  import type { StyleProp, ViewStyle, ViewProps } from 'react-native';
4
- import type { ReactNode } from 'react';
4
+ import type { ReactElement, ReactNode } from 'react';
5
5
  import { StyledStatus } from './StyledBadge';
6
6
 
7
7
  export interface StatusProps extends ViewProps {
@@ -34,7 +34,7 @@ const Status = ({
34
34
  style,
35
35
  testID,
36
36
  ...nativeProps
37
- }: StatusProps): JSX.Element => {
37
+ }: StatusProps): ReactElement => {
38
38
  const { current: opacity } = React.useRef<Animated.Value>(
39
39
  new Animated.Value(visible ? 1 : 0)
40
40
  );
@@ -1,4 +1,5 @@
1
1
  import { Animated } from 'react-native';
2
+ import type { ReactElement } from 'react';
2
3
  import React, { useMemo } from 'react';
3
4
  import { StyledView, StyledText, StyledIcon } from './StyledBadge';
4
5
  import BadgeStatus from './Status';
@@ -22,7 +23,7 @@ const Badge = ({
22
23
  variant = 'filled',
23
24
  icon,
24
25
  ...nativeProps
25
- }: BadgeProps): JSX.Element => {
26
+ }: BadgeProps): ReactElement => {
26
27
  const { current: opacity } = React.useRef<Animated.Value>(
27
28
  new Animated.Value(visible ? 1 : 0)
28
29
  );
@@ -43,7 +43,7 @@ const BottomBarItem = styled(View)({
43
43
  alignItems: 'center',
44
44
  });
45
45
 
46
- const StyledBottomBarText = styled(Typography.Caption)(({ theme }) => ({
46
+ const StyledBottomBarText = styled(Typography.Label)(({ theme }) => ({
47
47
  marginTop: theme.__hd__.bottomNavigation.space.titleMarginTop,
48
48
  }));
49
49
 
@@ -158,20 +158,19 @@ exports[`BottomNavigation renders correctly 1`] = `
158
158
  [
159
159
  {
160
160
  "color": "#401960",
161
- "fontFamily": "BeVietnamPro-SemiBold",
162
- "fontSize": 12,
163
- "letterSpacing": 0.24,
164
- "lineHeight": 16,
161
+ "fontFamily": "BeVietnamPro-Regular",
162
+ "fontSize": 10,
163
+ "letterSpacing": 0,
164
+ "lineHeight": 14,
165
165
  },
166
166
  [
167
167
  {
168
- "marginTop": 4,
168
+ "marginTop": 2,
169
169
  },
170
170
  undefined,
171
171
  ],
172
172
  ]
173
173
  }
174
- themeFontWeight="semi-bold"
175
174
  themeIntent="primary"
176
175
  themeIsItalic={false}
177
176
  >
@@ -212,14 +211,14 @@ exports[`BottomNavigation renders correctly 1`] = `
212
211
  style={
213
212
  [
214
213
  {
215
- "color": "#001f23",
214
+ "color": "#4d6265",
216
215
  "fontSize": 24,
217
216
  },
218
217
  undefined,
219
218
  ]
220
219
  }
221
220
  testID="hero-icon-speaker-outlined"
222
- themeIntent="text"
221
+ themeIntent="muted"
223
222
  themeSize="medium"
224
223
  />
225
224
  <Text
@@ -228,22 +227,21 @@ exports[`BottomNavigation renders correctly 1`] = `
228
227
  style={
229
228
  [
230
229
  {
231
- "color": "#001f23",
232
- "fontFamily": "BeVietnamPro-SemiBold",
233
- "fontSize": 12,
234
- "letterSpacing": 0.24,
235
- "lineHeight": 16,
230
+ "color": "#4d6265",
231
+ "fontFamily": "BeVietnamPro-Regular",
232
+ "fontSize": 10,
233
+ "letterSpacing": 0,
234
+ "lineHeight": 14,
236
235
  },
237
236
  [
238
237
  {
239
- "marginTop": 4,
238
+ "marginTop": 2,
240
239
  },
241
240
  undefined,
242
241
  ],
243
242
  ]
244
243
  }
245
- themeFontWeight="semi-bold"
246
- themeIntent="body"
244
+ themeIntent="muted"
247
245
  themeIsItalic={false}
248
246
  >
249
247
  Feed
@@ -283,14 +281,14 @@ exports[`BottomNavigation renders correctly 1`] = `
283
281
  style={
284
282
  [
285
283
  {
286
- "color": "#001f23",
284
+ "color": "#4d6265",
287
285
  "fontSize": 24,
288
286
  },
289
287
  undefined,
290
288
  ]
291
289
  }
292
290
  testID="hero-icon-bell-outlined"
293
- themeIntent="text"
291
+ themeIntent="muted"
294
292
  themeSize="medium"
295
293
  />
296
294
  <Text
@@ -299,22 +297,21 @@ exports[`BottomNavigation renders correctly 1`] = `
299
297
  style={
300
298
  [
301
299
  {
302
- "color": "#001f23",
303
- "fontFamily": "BeVietnamPro-SemiBold",
304
- "fontSize": 12,
305
- "letterSpacing": 0.24,
306
- "lineHeight": 16,
300
+ "color": "#4d6265",
301
+ "fontFamily": "BeVietnamPro-Regular",
302
+ "fontSize": 10,
303
+ "letterSpacing": 0,
304
+ "lineHeight": 14,
307
305
  },
308
306
  [
309
307
  {
310
- "marginTop": 4,
308
+ "marginTop": 2,
311
309
  },
312
310
  undefined,
313
311
  ],
314
312
  ]
315
313
  }
316
- themeFontWeight="semi-bold"
317
- themeIntent="body"
314
+ themeIntent="muted"
318
315
  themeIsItalic={false}
319
316
  >
320
317
  Alerts
@@ -354,14 +351,14 @@ exports[`BottomNavigation renders correctly 1`] = `
354
351
  style={
355
352
  [
356
353
  {
357
- "color": "#001f23",
354
+ "color": "#4d6265",
358
355
  "fontSize": 24,
359
356
  },
360
357
  undefined,
361
358
  ]
362
359
  }
363
360
  testID="hero-icon-user-outlined"
364
- themeIntent="text"
361
+ themeIntent="muted"
365
362
  themeSize="medium"
366
363
  />
367
364
  <Text
@@ -370,22 +367,21 @@ exports[`BottomNavigation renders correctly 1`] = `
370
367
  style={
371
368
  [
372
369
  {
373
- "color": "#001f23",
374
- "fontFamily": "BeVietnamPro-SemiBold",
375
- "fontSize": 12,
376
- "letterSpacing": 0.24,
377
- "lineHeight": 16,
370
+ "color": "#4d6265",
371
+ "fontFamily": "BeVietnamPro-Regular",
372
+ "fontSize": 10,
373
+ "letterSpacing": 0,
374
+ "lineHeight": 14,
378
375
  },
379
376
  [
380
377
  {
381
- "marginTop": 4,
378
+ "marginTop": 2,
382
379
  },
383
380
  undefined,
384
381
  ],
385
382
  ]
386
383
  }
387
- themeFontWeight="semi-bold"
388
- themeIntent="body"
384
+ themeIntent="muted"
389
385
  themeIsItalic={false}
390
386
  >
391
387
  Profile
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Text } from 'react-native';
3
- import { fireEvent } from '@testing-library/react-native';
3
+ import { act, fireEvent } from '@testing-library/react-native';
4
4
  import { SafeAreaProvider } from 'react-native-safe-area-context';
5
5
  import type { ComponentProps } from 'react';
6
6
  import renderWithTheme from '../../../testHelpers/renderWithTheme';
@@ -64,15 +64,24 @@ describe('BottomNavigation', () => {
64
64
 
65
65
  expect(toJSON()).toMatchSnapshot();
66
66
  expect(getByText('Home')).toBeDefined();
67
- fireEvent.press(getByText('Feed'));
68
- fireEvent.press(getByText('Alerts'));
69
- fireEvent.press(getByText('Profile'));
67
+
68
+ act(() => {
69
+ fireEvent.press(getByText('Feed'));
70
+ });
71
+
72
+ act(() => {
73
+ fireEvent.press(getByText('Alerts'));
74
+ });
75
+
76
+ act(() => {
77
+ fireEvent.press(getByText('Profile'));
78
+ });
70
79
 
71
80
  // All screens are rendered and component is not unmounted when switching screen.
72
- expect(getByText('Home Screen')).toBeDefined();
73
- expect(getByText('Feed Screen')).toBeDefined();
74
- expect(getByText('Alerts Screen')).toBeDefined();
75
- expect(getByText('Profile Screen')).toBeDefined();
81
+ expect(getByText('Home Screen', { hidden: true })).toBeDefined();
82
+ expect(getByText('Feed Screen', { hidden: true })).toBeDefined();
83
+ expect(getByText('Alerts Screen', { hidden: true })).toBeDefined();
84
+ expect(getByText('Profile Screen', { hidden: true })).toBeDefined();
76
85
  });
77
86
 
78
87
  it('renders correctly with renderActiveTabOnly is true', () => {
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { TouchableWithoutFeedback } from 'react-native';
3
3
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
4
- import type { ReactNode } from 'react';
4
+ import type { ReactElement, ReactNode } from 'react';
5
5
  import type { StyleProp, ViewStyle, ViewProps } from 'react-native';
6
6
  import Icon from '../Icon';
7
7
  import { isHeroIcon } from '../Icon/utils';
@@ -70,7 +70,7 @@ const BottomNavigation = ({
70
70
  selectedTabKey,
71
71
  tabs,
72
72
  ...nativeProps
73
- }: BottomNavigationProps): JSX.Element => {
73
+ }: BottomNavigationProps): ReactElement => {
74
74
  const insets = useSafeAreaInsets();
75
75
 
76
76
  /**
@@ -137,13 +137,12 @@ const BottomNavigation = ({
137
137
  <BottomBarItem>
138
138
  <Icon
139
139
  icon={active ? icon : inactiveIcon}
140
- intent={active ? 'primary' : 'text'}
140
+ intent={active ? 'primary' : 'muted'}
141
141
  testID={`hero-icon-${icon}`}
142
142
  />
143
143
  {!!title && (
144
144
  <StyledBottomBarText
145
- fontWeight="semi-bold"
146
- intent={active ? 'primary' : 'body'}
145
+ intent={active ? 'primary' : 'muted'}
147
146
  numberOfLines={1}
148
147
  >
149
148
  {title}
@@ -1,3 +1,4 @@
1
+ import type { ReactElement } from 'react';
1
2
  import React, { useContext, useCallback, forwardRef } from 'react';
2
3
  import type {
3
4
  NativeScrollEvent,
@@ -9,7 +10,7 @@ import type { BottomSheetContextType } from './BottomSheetContext';
9
10
  import BottomSheetContext from './BottomSheetContext';
10
11
 
11
12
  const BottomSheetScrollView = forwardRef<ScrollView, ScrollViewProps>(
12
- ({ scrollEventThrottle = 100, ...props }, ref): JSX.Element => {
13
+ ({ scrollEventThrottle = 100, ...props }, ref): ReactElement => {
13
14
  const { setInternalShowDivider } =
14
15
  useContext<BottomSheetContextType>(BottomSheetContext);
15
16
 
@@ -104,7 +104,7 @@ const BottomSheet = ({
104
104
  keyboardAvoidingViewProps = {},
105
105
  supportedOrientations = ['portrait'],
106
106
  variant = 'fixed',
107
- }: BottomSheetProps): JSX.Element => {
107
+ }: BottomSheetProps): ReactElement => {
108
108
  const { height } = Dimensions.get('window');
109
109
 
110
110
  // Internal state to control modal open/close timing with animation
@@ -1,4 +1,4 @@
1
- import type { ReactChild, ReactNode } from 'react';
1
+ import type { ReactChild, ReactElement, ReactNode } from 'react';
2
2
  import React, { useCallback, useMemo, useState } from 'react';
3
3
  import type { StyleProp, ViewStyle } from 'react-native';
4
4
  import type { Theme } from '../../theme';
@@ -188,7 +188,7 @@ const Button = ({
188
188
  testID,
189
189
  text,
190
190
  variant = 'filled',
191
- }: ButtonProps): JSX.Element => {
191
+ }: ButtonProps): ReactElement => {
192
192
  const isInlineText =
193
193
  variant === 'inline-text' || variant === 'inline-text-compact';
194
194
  const isIconButtonOnly = !text;
@@ -1,5 +1,6 @@
1
1
  import { fireEvent } from '@testing-library/react-native';
2
2
  import React from 'react';
3
+ import { Platform } from 'react-native';
3
4
  import Calendar from '..';
4
5
  import renderWithTheme from '../../../testHelpers/renderWithTheme';
5
6
  import { setOrientation } from '../../../testHelpers/utils';
@@ -121,10 +122,7 @@ describe('Calendar', () => {
121
122
  ${'ios'}
122
123
  ${'android'}
123
124
  `('renders correct picker on $platform', ({ platform: mockedPlatform }) => {
124
- jest.mock('react-native/Libraries/Utilities/Platform', () => ({
125
- OS: mockedPlatform,
126
- select: () => null,
127
- }));
125
+ Platform.OS = mockedPlatform;
128
126
 
129
127
  const { getByTestId, queryByText } = renderWithTheme(
130
128
  <Calendar
@@ -153,10 +151,7 @@ describe('Calendar', () => {
153
151
  `(
154
152
  'onToggleMonthPicker is called when toggling month year picker on $platform',
155
153
  ({ platform: mockedPlatform }) => {
156
- jest.mock('react-native/Libraries/Utilities/Platform', () => ({
157
- OS: mockedPlatform,
158
- select: () => null,
159
- }));
154
+ Platform.OS = mockedPlatform;
160
155
 
161
156
  const onToggleMonthPicker = jest.fn();
162
157
  const { getByTestId } = renderWithTheme(
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { ReactNode } from 'react';
2
+ import type { ReactElement, ReactNode } from 'react';
3
3
  import type { StyleProp, ViewStyle, ViewProps } from 'react-native';
4
4
  import { StyledDataCard, Indicator } from './StyledDataCard';
5
5
 
@@ -26,7 +26,7 @@ const DataCard = ({
26
26
  intent = 'info',
27
27
  children,
28
28
  ...nativeProps
29
- }: DataCardProps): JSX.Element => (
29
+ }: DataCardProps): ReactElement => (
30
30
  <StyledDataCard {...nativeProps}>
31
31
  <Indicator themeIntent={intent} testID="data-card-indicator" />
32
32
  {children}
@@ -1,4 +1,4 @@
1
- import type { ReactNode } from 'react';
1
+ import type { ReactElement, ReactNode } from 'react';
2
2
  import React from 'react';
3
3
  import type { StyleProp, ViewProps, ViewStyle } from 'react-native';
4
4
  import DataCard from './DataCard';
@@ -37,7 +37,7 @@ const Card = ({
37
37
  children,
38
38
  variant = 'basic',
39
39
  ...nativeProps
40
- }: CardProps): JSX.Element => {
40
+ }: CardProps): ReactElement => {
41
41
  return (
42
42
  <StyledCard {...nativeProps} themeIntent={intent} themeVariant={variant}>
43
43
  {children}
@@ -1,4 +1,4 @@
1
- import type { Dispatch, SetStateAction } from 'react';
1
+ import type { Dispatch, ReactElement, SetStateAction } from 'react';
2
2
  import React, { useCallback, useEffect, useRef, useState } from 'react';
3
3
  import type {
4
4
  StyleProp,
@@ -42,7 +42,7 @@ interface CarouselProps extends ViewProps {
42
42
  /**
43
43
  * Render action elements function.
44
44
  */
45
- renderActions?: (pageIndex: number) => JSX.Element;
45
+ renderActions?: (pageIndex: number) => ReactElement;
46
46
  /**
47
47
  * @deprecated will be removed in 9.0.0
48
48
  *
@@ -1,17 +1,11 @@
1
1
  import { fireEvent } from '@testing-library/react-native';
2
2
  import React, { useState } from 'react';
3
- import type { ModalProps } from 'react-native';
4
3
  import renderWithTheme from '../../../../testHelpers/renderWithTheme';
5
4
  import IOSDialog from '../IOSDialog';
6
5
  import { setOrientation } from '../../../../testHelpers/utils';
7
6
  import { Button } from '../../../..';
8
7
  import type { DatePickerDialogProps } from '../type';
9
8
 
10
- jest.mock('react-native/Libraries/Modal/Modal', () => {
11
- const Modal = jest.requireActual('react-native/Libraries/Modal/Modal');
12
- return (props: ModalProps) => <Modal {...props} />;
13
- });
14
-
15
9
  const IOSDialogExample = (
16
10
  props: Omit<DatePickerDialogProps, 'open' | 'onClose'>
17
11
  ) => {
@@ -1,6 +1,6 @@
1
1
  import { fireEvent } from '@testing-library/react-native';
2
2
  import React from 'react';
3
- import type { ModalProps } from 'react-native';
3
+ import { Platform } from 'react-native';
4
4
  import renderWithTheme from '../../../testHelpers/renderWithTheme';
5
5
  import DatePickerCalendar from '../DatePickerCalendar';
6
6
  import { setOrientation } from '../../../testHelpers/utils';
@@ -10,11 +10,6 @@ import { theme } from '../../..';
10
10
  import enAU from '../../../locales/en_AU';
11
11
  import enCA from '../../../locales/en_CA';
12
12
 
13
- jest.mock('react-native/Libraries/Modal/Modal', () => {
14
- const Modal = jest.requireActual('react-native/Libraries/Modal/Modal');
15
- return (props: ModalProps) => <Modal {...props} />;
16
- });
17
-
18
13
  describe('DatePickerCalendar', () => {
19
14
  it('renders correctly', () => {
20
15
  const onChange = jest.fn();
@@ -108,10 +103,7 @@ describe('DatePickerCalendar', () => {
108
103
  `(
109
104
  'renders month year picker when pressing on title',
110
105
  ({ platform: mockedPlatform }) => {
111
- jest.mock('react-native/Libraries/Utilities/Platform', () => ({
112
- OS: mockedPlatform,
113
- select: () => null,
114
- }));
106
+ Platform.OS = mockedPlatform;
115
107
 
116
108
  const { queryByText, getByText, getByTestId } = renderWithTheme(
117
109
  <DatePickerCalendar
@@ -10,12 +10,39 @@ import { theme } from '../../..';
10
10
 
11
11
  import enAU from '../../../locales/en_AU';
12
12
  import enCA from '../../../locales/en_CA';
13
+ import type { BottomSheetProps } from '../../BottomSheet';
13
14
 
14
15
  jest.mock('react-native/Libraries/Modal/Modal', () => {
15
16
  const Modal = jest.requireActual('react-native/Libraries/Modal/Modal');
16
17
  return (props: ModalProps) => <Modal {...props} />;
17
18
  });
18
19
 
20
+ jest.mock('../../BottomSheet', () => {
21
+ // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
22
+ const { View } = require('react-native');
23
+
24
+ const BottomSheet = ({
25
+ header,
26
+ open,
27
+ footer,
28
+ children,
29
+ testID,
30
+ }: BottomSheetProps) => {
31
+ if (!open) return null;
32
+ return (
33
+ <View testID={testID}>
34
+ {header && <View>{header}</View>}
35
+ {children}
36
+ {footer && <View>{footer}</View>}
37
+ </View>
38
+ );
39
+ };
40
+
41
+ BottomSheet.ScrollView = View;
42
+
43
+ return BottomSheet;
44
+ });
45
+
19
46
  describe('getDateValue', () => {
20
47
  describe('when value is less than minDate', () => {
21
48
  it('should return minDate', () => {