@hero-design/rn 8.24.0-alpha.1 → 8.25.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.
Files changed (295) hide show
  1. package/.turbo/turbo-build.log +9 -9
  2. package/.turbo/turbo-publish:npm.log +0 -9
  3. package/es/index.js +144 -166
  4. package/lib/index.js +144 -166
  5. package/package.json +5 -5
  6. package/src/components/Carousel/CardCarousel.tsx +23 -7
  7. package/src/components/Carousel/__tests__/CardCarousel.spec.tsx +177 -70
  8. package/src/components/Carousel/__tests__/__snapshots__/CardCarousel.spec.tsx.snap +294 -1
  9. package/src/components/Error/StyledError.tsx +2 -0
  10. package/src/components/Error/__tests__/__snapshots__/index.spec.tsx.snap +8 -0
  11. package/src/components/RichTextEditor/RichTextEditor.tsx +3 -4
  12. package/src/components/Spinner/AnimatedSpinner.tsx +2 -2
  13. package/src/components/Success/__tests__/index.spec.tsx +6 -0
  14. package/src/components/Success/index.tsx +19 -0
  15. package/src/components/Tabs/{ScrollableTabsV2/SceneView.tsx → SceneView.tsx} +2 -2
  16. package/src/components/Tabs/ScrollableTabs.tsx +54 -48
  17. package/src/components/Tabs/{ScrollableTabsV2/__tests__ → __tests__}/SceneView.spec.tsx +3 -3
  18. package/src/components/Tabs/__tests__/ScrollableTabs.spec.tsx +86 -28
  19. package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabs.spec.tsx.snap +1687 -49
  20. package/src/components/Tabs/__tests__/__snapshots__/index.spec.tsx.snap +1213 -29
  21. package/src/components/Tabs/__tests__/index.spec.tsx +58 -14
  22. package/src/components/Tabs/index.tsx +108 -102
  23. package/src/components/Tabs/useIsFocused.tsx +19 -0
  24. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +4 -0
  25. package/src/theme/components/error.ts +6 -1
  26. package/types/components/Accordion/AccordionItem.d.ts +0 -0
  27. package/types/components/Accordion/StyledAccordion.d.ts +0 -0
  28. package/types/components/Accordion/index.d.ts +0 -0
  29. package/types/components/Alert/StyledAlert.d.ts +0 -0
  30. package/types/components/Alert/index.d.ts +0 -0
  31. package/types/components/Attachment/StyledAttachment.d.ts +0 -0
  32. package/types/components/Attachment/index.d.ts +0 -0
  33. package/types/components/Avatar/Avatar.d.ts +0 -0
  34. package/types/components/Avatar/AvatarStack/StyledAvatarStack.d.ts +0 -0
  35. package/types/components/Avatar/AvatarStack/index.d.ts +0 -0
  36. package/types/components/Avatar/AvatarStack/utils.d.ts +0 -0
  37. package/types/components/Avatar/StyledAvatar.d.ts +0 -0
  38. package/types/components/Avatar/index.d.ts +0 -0
  39. package/types/components/Badge/Status.d.ts +0 -0
  40. package/types/components/Badge/StyledBadge.d.ts +0 -0
  41. package/types/components/Badge/index.d.ts +0 -0
  42. package/types/components/BottomNavigation/StyledBottomNavigation.d.ts +0 -0
  43. package/types/components/BottomNavigation/index.d.ts +0 -0
  44. package/types/components/BottomSheet/BottomSheetContext.d.ts +0 -0
  45. package/types/components/BottomSheet/Footer.d.ts +0 -0
  46. package/types/components/BottomSheet/Header.d.ts +0 -0
  47. package/types/components/BottomSheet/ScrollView.d.ts +0 -0
  48. package/types/components/BottomSheet/StyledBottomSheet.d.ts +0 -0
  49. package/types/components/BottomSheet/index.d.ts +0 -0
  50. package/types/components/Box/StyledBox.d.ts +0 -0
  51. package/types/components/Box/config.d.ts +0 -0
  52. package/types/components/Box/index.d.ts +0 -0
  53. package/types/components/Box/types.d.ts +0 -0
  54. package/types/components/Button/Button.d.ts +0 -0
  55. package/types/components/Button/IconButton.d.ts +0 -0
  56. package/types/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +0 -0
  57. package/types/components/Button/LoadingIndicator/index.d.ts +0 -0
  58. package/types/components/Button/StyledButton.d.ts +0 -0
  59. package/types/components/Button/UtilityButton/StyledUtilityButton.d.ts +0 -0
  60. package/types/components/Button/UtilityButton/index.d.ts +0 -0
  61. package/types/components/Button/index.d.ts +0 -0
  62. package/types/components/Calendar/CalendarRowItem.d.ts +0 -0
  63. package/types/components/Calendar/StyledCalendar.d.ts +0 -0
  64. package/types/components/Calendar/helpers.d.ts +0 -0
  65. package/types/components/Calendar/index.d.ts +0 -0
  66. package/types/components/Card/DataCard/StyledDataCard.d.ts +0 -0
  67. package/types/components/Card/DataCard/index.d.ts +0 -0
  68. package/types/components/Card/StyledCard.d.ts +0 -0
  69. package/types/components/Card/index.d.ts +0 -0
  70. package/types/components/Carousel/CardCarousel.d.ts +0 -0
  71. package/types/components/Carousel/CarouselItem.d.ts +0 -0
  72. package/types/components/Carousel/StyledCardCarousel.d.ts +0 -0
  73. package/types/components/Carousel/StyledCarousel.d.ts +0 -0
  74. package/types/components/Carousel/contants.d.ts +0 -0
  75. package/types/components/Carousel/index.d.ts +0 -0
  76. package/types/components/Carousel/types.d.ts +0 -0
  77. package/types/components/Checkbox/StyledCheckbox.d.ts +0 -0
  78. package/types/components/Checkbox/index.d.ts +0 -0
  79. package/types/components/Collapse/StyledCollapse.d.ts +0 -0
  80. package/types/components/Collapse/index.d.ts +0 -0
  81. package/types/components/ContentNavigator/StyledContentNavigator.d.ts +0 -0
  82. package/types/components/ContentNavigator/index.d.ts +0 -0
  83. package/types/components/DatePicker/DatePickerAndroid.d.ts +0 -0
  84. package/types/components/DatePicker/DatePickerCalendar.d.ts +0 -0
  85. package/types/components/DatePicker/DatePickerIOS.d.ts +0 -0
  86. package/types/components/DatePicker/StyledDatePicker.d.ts +0 -0
  87. package/types/components/DatePicker/index.d.ts +0 -0
  88. package/types/components/DatePicker/types.d.ts +0 -0
  89. package/types/components/Divider/StyledDivider.d.ts +0 -0
  90. package/types/components/Divider/index.d.ts +0 -0
  91. package/types/components/Drawer/DragableDrawer/helpers.d.ts +0 -0
  92. package/types/components/Drawer/DragableDrawer/index.d.ts +0 -0
  93. package/types/components/Drawer/StyledDrawer.d.ts +0 -0
  94. package/types/components/Drawer/index.d.ts +0 -0
  95. package/types/components/Empty/StyledEmpty.d.ts +0 -0
  96. package/types/components/Empty/index.d.ts +0 -0
  97. package/types/components/Error/StyledError.d.ts +0 -0
  98. package/types/components/Error/index.d.ts +0 -0
  99. package/types/components/FAB/ActionGroup/ActionItem.d.ts +0 -0
  100. package/types/components/FAB/ActionGroup/StyledActionGroup.d.ts +0 -0
  101. package/types/components/FAB/ActionGroup/StyledActionItem.d.ts +0 -0
  102. package/types/components/FAB/ActionGroup/index.d.ts +0 -0
  103. package/types/components/FAB/AnimatedFABIcon.d.ts +0 -0
  104. package/types/components/FAB/FAB.d.ts +0 -0
  105. package/types/components/FAB/StyledFAB.d.ts +0 -0
  106. package/types/components/FAB/index.d.ts +0 -0
  107. package/types/components/Icon/AnimatedIcon.d.ts +0 -0
  108. package/types/components/Icon/HeroIcon/index.d.ts +0 -0
  109. package/types/components/Icon/IconList.d.ts +0 -0
  110. package/types/components/Icon/index.d.ts +0 -0
  111. package/types/components/Icon/utils.d.ts +0 -0
  112. package/types/components/Image/index.d.ts +0 -0
  113. package/types/components/List/BasicListItem.d.ts +0 -0
  114. package/types/components/List/ListItem.d.ts +0 -0
  115. package/types/components/List/StyledBasicListItem.d.ts +0 -0
  116. package/types/components/List/StyledListItem.d.ts +0 -0
  117. package/types/components/List/index.d.ts +0 -0
  118. package/types/components/PageControl/StyledPageControl.d.ts +0 -0
  119. package/types/components/PageControl/index.d.ts +0 -0
  120. package/types/components/PinInput/PinCell.d.ts +0 -0
  121. package/types/components/PinInput/StyledPinInput.d.ts +0 -0
  122. package/types/components/PinInput/index.d.ts +0 -0
  123. package/types/components/Progress/ProgressBar.d.ts +0 -0
  124. package/types/components/Progress/ProgressCircle.d.ts +0 -0
  125. package/types/components/Progress/StyledProgressBar.d.ts +0 -0
  126. package/types/components/Progress/StyledProgressCircle.d.ts +0 -0
  127. package/types/components/Progress/__tests__/index.spec.d.ts +0 -0
  128. package/types/components/Progress/constants.d.ts +0 -0
  129. package/types/components/Progress/index.d.ts +0 -0
  130. package/types/components/Progress/types.d.ts +0 -0
  131. package/types/components/Radio/Radio.d.ts +0 -0
  132. package/types/components/Radio/RadioGroup.d.ts +0 -0
  133. package/types/components/Radio/StyledRadio.d.ts +0 -0
  134. package/types/components/Radio/index.d.ts +0 -0
  135. package/types/components/Radio/types.d.ts +0 -0
  136. package/types/components/RefreshControl/index.d.ts +0 -0
  137. package/types/components/RichTextEditor/EditorEvent.d.ts +0 -0
  138. package/types/components/RichTextEditor/EditorToolbar.d.ts +0 -0
  139. package/types/components/RichTextEditor/MentionList.d.ts +0 -0
  140. package/types/components/RichTextEditor/RichTextEditor.d.ts +0 -0
  141. package/types/components/RichTextEditor/StyledRichTextEditor.d.ts +0 -0
  142. package/types/components/RichTextEditor/StyledToolbar.d.ts +0 -0
  143. package/types/components/RichTextEditor/__mocks__/heroEditorApp.d.ts +0 -0
  144. package/types/components/RichTextEditor/constants.d.ts +0 -0
  145. package/types/components/RichTextEditor/heroEditorApp.d.ts +0 -0
  146. package/types/components/RichTextEditor/index.d.ts +0 -0
  147. package/types/components/RichTextEditor/types.d.ts +0 -0
  148. package/types/components/RichTextEditor/utils/events.d.ts +0 -0
  149. package/types/components/RichTextEditor/utils/rnWebView.d.ts +0 -0
  150. package/types/components/SectionHeading/StyledHeading.d.ts +0 -0
  151. package/types/components/SectionHeading/index.d.ts +0 -0
  152. package/types/components/Select/BaseOptionList.d.ts +0 -0
  153. package/types/components/Select/Footer.d.ts +0 -0
  154. package/types/components/Select/MultiSelect/Option.d.ts +0 -0
  155. package/types/components/Select/MultiSelect/OptionList.d.ts +0 -0
  156. package/types/components/Select/MultiSelect/index.d.ts +0 -0
  157. package/types/components/Select/SingleSelect/Option.d.ts +0 -0
  158. package/types/components/Select/SingleSelect/OptionList.d.ts +0 -0
  159. package/types/components/Select/SingleSelect/StyledSingleSelect.d.ts +0 -0
  160. package/types/components/Select/SingleSelect/index.d.ts +0 -0
  161. package/types/components/Select/StyledSelect.d.ts +0 -0
  162. package/types/components/Select/helpers.d.ts +0 -0
  163. package/types/components/Select/index.d.ts +0 -0
  164. package/types/components/Select/types.d.ts +0 -0
  165. package/types/components/Skeleton/StyledSkeleton.d.ts +0 -0
  166. package/types/components/Skeleton/index.d.ts +0 -0
  167. package/types/components/Slider/index.d.ts +0 -0
  168. package/types/components/Spinner/AnimatedSpinner.d.ts +0 -0
  169. package/types/components/Spinner/StyledSpinner.d.ts +0 -0
  170. package/types/components/Spinner/index.d.ts +0 -0
  171. package/types/components/Success/StyledSuccess.d.ts +0 -0
  172. package/types/components/Success/index.d.ts +8 -0
  173. package/types/components/Swipeable/StyledSwipeable.d.ts +0 -0
  174. package/types/components/Swipeable/SwipeableAction.d.ts +0 -0
  175. package/types/components/Swipeable/index.d.ts +0 -0
  176. package/types/components/Switch/SelectorSwitch/Option.d.ts +0 -0
  177. package/types/components/Switch/SelectorSwitch/StyledSelectorSwitch.d.ts +0 -0
  178. package/types/components/Switch/SelectorSwitch/index.d.ts +0 -0
  179. package/types/components/Switch/StyledSwitch.d.ts +0 -0
  180. package/types/components/Switch/index.d.ts +0 -0
  181. package/types/components/Tabs/ActiveTabIndicator.d.ts +0 -0
  182. package/types/components/Tabs/SceneView.d.ts +4 -3
  183. package/types/components/Tabs/ScrollableTabs.d.ts +0 -0
  184. package/types/components/Tabs/ScrollableTabsHeader.d.ts +0 -0
  185. package/types/components/Tabs/StyledScrollableTabs.d.ts +0 -0
  186. package/types/components/Tabs/StyledTabs.d.ts +0 -0
  187. package/types/components/Tabs/TabWithBadge.d.ts +0 -0
  188. package/types/components/Tabs/index.d.ts +1 -3
  189. package/types/components/Tabs/useIsFocused.d.ts +6 -0
  190. package/types/components/Tabs/utils.d.ts +0 -0
  191. package/types/components/Tag/StyledTag.d.ts +0 -0
  192. package/types/components/Tag/index.d.ts +0 -0
  193. package/types/components/TextInput/StyledTextInput.d.ts +0 -0
  194. package/types/components/TextInput/index.d.ts +0 -0
  195. package/types/components/TimePicker/StyledTimePicker.d.ts +0 -0
  196. package/types/components/TimePicker/TimePickerAndroid.d.ts +0 -0
  197. package/types/components/TimePicker/TimePickerIOS.d.ts +0 -0
  198. package/types/components/TimePicker/index.d.ts +0 -0
  199. package/types/components/TimePicker/types.d.ts +0 -0
  200. package/types/components/Toast/StyledToast.d.ts +0 -0
  201. package/types/components/Toast/Toast.d.ts +0 -0
  202. package/types/components/Toast/ToastContainer.d.ts +0 -0
  203. package/types/components/Toast/ToastContext.d.ts +0 -0
  204. package/types/components/Toast/ToastProvider.d.ts +0 -0
  205. package/types/components/Toast/index.d.ts +0 -0
  206. package/types/components/Toast/types.d.ts +0 -0
  207. package/types/components/Toolbar/StyledToolbar.d.ts +0 -0
  208. package/types/components/Toolbar/ToolbarGroup.d.ts +0 -0
  209. package/types/components/Toolbar/ToolbarItem.d.ts +0 -0
  210. package/types/components/Toolbar/index.d.ts +0 -0
  211. package/types/components/Typography/Text/StyledText.d.ts +0 -0
  212. package/types/components/Typography/Text/index.d.ts +0 -0
  213. package/types/components/Typography/index.d.ts +0 -0
  214. package/types/index.d.ts +0 -0
  215. package/types/testHelpers/renderWithTheme.d.ts +0 -0
  216. package/types/theme/ThemeProvider.d.ts +0 -0
  217. package/types/theme/ThemeSwitcher.d.ts +0 -0
  218. package/types/theme/components/accordion.d.ts +0 -0
  219. package/types/theme/components/alert.d.ts +0 -0
  220. package/types/theme/components/attachment.d.ts +0 -0
  221. package/types/theme/components/avatar.d.ts +0 -0
  222. package/types/theme/components/badge.d.ts +0 -0
  223. package/types/theme/components/bottomNavigation.d.ts +0 -0
  224. package/types/theme/components/bottomSheet.d.ts +0 -0
  225. package/types/theme/components/button.d.ts +0 -0
  226. package/types/theme/components/calendar.d.ts +0 -0
  227. package/types/theme/components/card.d.ts +0 -0
  228. package/types/theme/components/cardCarousel.d.ts +0 -0
  229. package/types/theme/components/carousel.d.ts +0 -0
  230. package/types/theme/components/checkbox.d.ts +0 -0
  231. package/types/theme/components/contentNavigator.d.ts +0 -0
  232. package/types/theme/components/datePicker.d.ts +0 -0
  233. package/types/theme/components/divider.d.ts +0 -0
  234. package/types/theme/components/drawer.d.ts +0 -0
  235. package/types/theme/components/empty.d.ts +0 -0
  236. package/types/theme/components/error.d.ts +4 -0
  237. package/types/theme/components/fab.d.ts +0 -0
  238. package/types/theme/components/icon.d.ts +0 -0
  239. package/types/theme/components/image.d.ts +0 -0
  240. package/types/theme/components/list.d.ts +0 -0
  241. package/types/theme/components/pageControl.d.ts +0 -0
  242. package/types/theme/components/pinInput.d.ts +0 -0
  243. package/types/theme/components/progress.d.ts +0 -0
  244. package/types/theme/components/radio.d.ts +0 -0
  245. package/types/theme/components/refreshControl.d.ts +0 -0
  246. package/types/theme/components/richTextEditor.d.ts +0 -0
  247. package/types/theme/components/sectionHeading.d.ts +0 -0
  248. package/types/theme/components/select.d.ts +0 -0
  249. package/types/theme/components/skeleton.d.ts +0 -0
  250. package/types/theme/components/slider.d.ts +0 -0
  251. package/types/theme/components/spinner.d.ts +0 -0
  252. package/types/theme/components/success.d.ts +0 -0
  253. package/types/theme/components/swipeable.d.ts +0 -0
  254. package/types/theme/components/switch.d.ts +0 -0
  255. package/types/theme/components/tabs.d.ts +0 -0
  256. package/types/theme/components/tag.d.ts +0 -0
  257. package/types/theme/components/textInput.d.ts +0 -0
  258. package/types/theme/components/timePicker.d.ts +0 -0
  259. package/types/theme/components/toast.d.ts +0 -0
  260. package/types/theme/components/toolbar.d.ts +0 -0
  261. package/types/theme/components/typography.d.ts +0 -0
  262. package/types/theme/getTheme.d.ts +0 -0
  263. package/types/theme/global/borders.d.ts +0 -0
  264. package/types/theme/global/colors/eBens.d.ts +0 -0
  265. package/types/theme/global/colors/global.d.ts +0 -0
  266. package/types/theme/global/colors/globalDark.d.ts +0 -0
  267. package/types/theme/global/colors/jobs.d.ts +0 -0
  268. package/types/theme/global/colors/swag.d.ts +0 -0
  269. package/types/theme/global/colors/swagDark.d.ts +0 -0
  270. package/types/theme/global/colors/types.d.ts +0 -0
  271. package/types/theme/global/colors/wallet.d.ts +0 -0
  272. package/types/theme/global/colors/work.d.ts +0 -0
  273. package/types/theme/global/index.d.ts +0 -0
  274. package/types/theme/global/scale.d.ts +0 -0
  275. package/types/theme/global/sizes.d.ts +0 -0
  276. package/types/theme/global/space.d.ts +0 -0
  277. package/types/theme/global/typography.d.ts +0 -0
  278. package/types/theme/index.d.ts +0 -0
  279. package/types/types.d.ts +0 -0
  280. package/types/utils/functions.d.ts +0 -0
  281. package/types/utils/helpers.d.ts +0 -0
  282. package/types/utils/hooks.d.ts +0 -0
  283. package/types/utils/scale.d.ts +0 -0
  284. package/.turbo/turbo-build:types.log +0 -2
  285. package/.turbo/turbo-lint.log +0 -146
  286. package/.turbo/turbo-test.log +0 -451
  287. package/.turbo/turbo-type-check.log +0 -1
  288. package/src/components/Tabs/ScrollableTabsV2/ScrollableTabsV2.tsx +0 -120
  289. package/src/components/Tabs/ScrollableTabsV2/__tests__/ScrollableTabsV2.spec.tsx +0 -166
  290. package/src/components/Tabs/ScrollableTabsV2/__tests__/__snapshots__/ScrollableTabsV2.spec.tsx.snap +0 -2497
  291. package/src/components/Tabs/ScrollableTabsV2/index.tsx +0 -5
  292. package/types/components/Tabs/ScrollableTabsV2/SceneView.d.ts +0 -10
  293. package/types/components/Tabs/ScrollableTabsV2/ScrollableTabsV2.d.ts +0 -9
  294. package/types/components/Tabs/ScrollableTabsV2/index.d.ts +0 -4
  295. /package/src/components/Tabs/{ScrollableTabsV2/__tests__ → __tests__}/__snapshots__/SceneView.spec.tsx.snap +0 -0
@@ -1,104 +1,211 @@
1
1
  import { waitFor } from '@testing-library/react-native';
2
2
  import React from 'react';
3
- import { FlatList } from 'react-native';
3
+ import { FlatList, Platform } from 'react-native';
4
4
  import { CardCarousel, CardCarouselHandles } from '../CardCarousel';
5
5
  import renderWithTheme from '../../../testHelpers/renderWithTheme';
6
6
  import Typography from '../../Typography';
7
7
 
8
8
  describe('CardCarousel', () => {
9
- it('should render correctly', () => {
10
- const wrapper = renderWithTheme(
11
- <CardCarousel
12
- testID="cardCarousel"
13
- style={{ width: 100, height: 100 }}
14
- items={[
15
- <Typography.Text> screen 1</Typography.Text>,
16
- <Typography.Text> screen 2</Typography.Text>,
17
- ]}
18
- />
19
- );
20
-
21
- expect(wrapper.toJSON()).toMatchSnapshot();
22
- expect(wrapper.queryAllByText('screen 1')).toHaveLength(1);
23
- expect(wrapper.queryAllByText('screen 2')).toHaveLength(1);
24
- expect(wrapper.queryAllByTestId('pageControl')).toHaveLength(1);
25
- });
26
-
27
- describe('autoPlay', () => {
28
- it('should call scrollToIndex 1', () => {
29
- jest.useFakeTimers();
30
- const carouselRef = React.createRef<
31
- CardCarouselHandles & {
32
- getFlatListRef: () => FlatList;
33
- }
34
- >();
9
+ describe('ios', () => {
10
+ beforeAll(() => {
11
+ Platform.OS = 'ios';
12
+ });
35
13
 
36
- renderWithTheme(
14
+ it('should render correctly on iOS', () => {
15
+ const wrapper = renderWithTheme(
37
16
  <CardCarousel
38
- ref={carouselRef}
39
- autoPlay
40
- autoPlayInterval={3000}
17
+ testID="cardCarousel"
18
+ style={{ width: 100, height: 100 }}
41
19
  items={[
42
20
  <Typography.Text> screen 1</Typography.Text>,
43
21
  <Typography.Text> screen 2</Typography.Text>,
44
22
  ]}
45
23
  />
46
24
  );
47
- const flatListRef = carouselRef.current!.getFlatListRef()!;
48
- const snapToIndexSpy = jest.spyOn(flatListRef, 'scrollToIndex');
49
- jest.advanceTimersByTime(3000);
50
- expect(snapToIndexSpy).toHaveBeenCalledWith({
51
- animated: true,
52
- index: 1,
53
- viewPosition: 0.5,
25
+
26
+ expect(wrapper.toJSON()).toMatchSnapshot();
27
+ expect(wrapper.queryAllByText('screen 1')).toHaveLength(1);
28
+ expect(wrapper.queryAllByText('screen 2')).toHaveLength(1);
29
+ expect(wrapper.queryAllByTestId('pageControl')).toHaveLength(1);
30
+ });
31
+
32
+ describe('autoPlay', () => {
33
+ it('should call scrollToIndex 1', () => {
34
+ jest.useFakeTimers();
35
+ const carouselRef = React.createRef<
36
+ CardCarouselHandles & {
37
+ getFlatListRef: () => FlatList;
38
+ }
39
+ >();
40
+
41
+ renderWithTheme(
42
+ <CardCarousel
43
+ ref={carouselRef}
44
+ autoPlay
45
+ autoPlayInterval={3000}
46
+ items={[
47
+ <Typography.Text> screen 1</Typography.Text>,
48
+ <Typography.Text> screen 2</Typography.Text>,
49
+ ]}
50
+ />
51
+ );
52
+ const flatListRef = carouselRef.current!.getFlatListRef()!;
53
+ const snapToIndexSpy = jest.spyOn(flatListRef, 'scrollToIndex');
54
+ jest.advanceTimersByTime(3000);
55
+ expect(snapToIndexSpy).toHaveBeenCalledWith({
56
+ animated: true,
57
+ index: 1,
58
+ viewPosition: 0.5,
59
+ });
60
+
61
+ jest.useRealTimers();
54
62
  });
63
+ });
55
64
 
56
- jest.useRealTimers();
65
+ describe('hidePageControl', () => {
66
+ const wrapper = renderWithTheme(
67
+ <CardCarousel
68
+ style={{ width: 100, height: 100 }}
69
+ hidePageControl
70
+ items={[
71
+ <Typography.Text> screen 1</Typography.Text>,
72
+ <Typography.Text> screen 2</Typography.Text>,
73
+ ]}
74
+ />
75
+ );
76
+ expect(wrapper.queryAllByTestId('pageControl')).toHaveLength(0);
57
77
  });
58
- });
59
78
 
60
- describe('hidePageControl', () => {
61
- const wrapper = renderWithTheme(
62
- <CardCarousel
63
- style={{ width: 100, height: 100 }}
64
- hidePageControl
65
- items={[
66
- <Typography.Text> screen 1</Typography.Text>,
67
- <Typography.Text> screen 2</Typography.Text>,
68
- ]}
69
- />
70
- );
71
- expect(wrapper.queryAllByTestId('pageControl')).toHaveLength(0);
79
+ describe('snapToIndex', () => {
80
+ it('should render correctly', () => {
81
+ const carouselRef = React.createRef<
82
+ CardCarouselHandles & {
83
+ getFlatListRef: () => FlatList;
84
+ }
85
+ >();
86
+
87
+ renderWithTheme(
88
+ <CardCarousel
89
+ ref={carouselRef}
90
+ items={[
91
+ <Typography.Text> screen 1</Typography.Text>,
92
+ <Typography.Text> screen 2</Typography.Text>,
93
+ <Typography.Text> screen 3</Typography.Text>,
94
+ ]}
95
+ />
96
+ );
97
+
98
+ const flatListRef = carouselRef.current!.getFlatListRef()!;
99
+ const snapToIndexSpy = jest.spyOn(flatListRef, 'scrollToIndex');
100
+ carouselRef.current?.snapToIndex(2);
101
+ waitFor(() => expect(snapToIndexSpy).toHaveBeenCalled());
102
+
103
+ expect(snapToIndexSpy).toHaveBeenCalledWith({
104
+ animated: true,
105
+ index: 2,
106
+ viewPosition: 0.5,
107
+ });
108
+ });
109
+ });
72
110
  });
111
+ describe('android', () => {
112
+ beforeAll(() => {
113
+ Platform.OS = 'android';
114
+ });
115
+ it('should render correctly on iOS', () => {
116
+ const wrapper = renderWithTheme(
117
+ <CardCarousel
118
+ testID="cardCarousel"
119
+ style={{ width: 100, height: 100 }}
120
+ items={[
121
+ <Typography.Text> screen 1</Typography.Text>,
122
+ <Typography.Text> screen 2</Typography.Text>,
123
+ ]}
124
+ />
125
+ );
73
126
 
74
- describe('snapToIndex', () => {
75
- it('should render correctly', () => {
76
- const carouselRef = React.createRef<
77
- CardCarouselHandles & {
78
- getFlatListRef: () => FlatList;
79
- }
80
- >();
127
+ expect(wrapper.toJSON()).toMatchSnapshot();
128
+ expect(wrapper.queryAllByText('screen 1')).toHaveLength(1);
129
+ expect(wrapper.queryAllByText('screen 2')).toHaveLength(1);
130
+ expect(wrapper.queryAllByTestId('pageControl')).toHaveLength(1);
131
+ });
132
+
133
+ describe('autoPlay', () => {
134
+ it('should call scrollToIndex 1', () => {
135
+ jest.useFakeTimers();
136
+ const carouselRef = React.createRef<
137
+ CardCarouselHandles & {
138
+ getFlatListRef: () => FlatList;
139
+ }
140
+ >();
141
+
142
+ renderWithTheme(
143
+ <CardCarousel
144
+ ref={carouselRef}
145
+ autoPlay
146
+ autoPlayInterval={3000}
147
+ items={[
148
+ <Typography.Text> screen 1</Typography.Text>,
149
+ <Typography.Text> screen 2</Typography.Text>,
150
+ ]}
151
+ />
152
+ );
153
+ const flatListRef = carouselRef.current!.getFlatListRef()!;
154
+ const snapToIndexSpy = jest.spyOn(flatListRef, 'scrollToIndex');
155
+ jest.advanceTimersByTime(3000);
156
+ expect(snapToIndexSpy).toHaveBeenCalledWith({
157
+ animated: true,
158
+ index: 1,
159
+ viewPosition: undefined,
160
+ });
81
161
 
82
- renderWithTheme(
162
+ jest.useRealTimers();
163
+ });
164
+ });
165
+
166
+ describe('hidePageControl', () => {
167
+ const wrapper = renderWithTheme(
83
168
  <CardCarousel
84
- ref={carouselRef}
169
+ style={{ width: 100, height: 100 }}
170
+ hidePageControl
85
171
  items={[
86
172
  <Typography.Text> screen 1</Typography.Text>,
87
173
  <Typography.Text> screen 2</Typography.Text>,
88
- <Typography.Text> screen 3</Typography.Text>,
89
174
  ]}
90
175
  />
91
176
  );
177
+ expect(wrapper.queryAllByTestId('pageControl')).toHaveLength(0);
178
+ });
179
+
180
+ describe('snapToIndex', () => {
181
+ it('should render correctly', () => {
182
+ const carouselRef = React.createRef<
183
+ CardCarouselHandles & {
184
+ getFlatListRef: () => FlatList;
185
+ }
186
+ >();
187
+
188
+ renderWithTheme(
189
+ <CardCarousel
190
+ ref={carouselRef}
191
+ items={[
192
+ <Typography.Text> screen 1</Typography.Text>,
193
+ <Typography.Text> screen 2</Typography.Text>,
194
+ <Typography.Text> screen 3</Typography.Text>,
195
+ ]}
196
+ />
197
+ );
92
198
 
93
- const flatListRef = carouselRef.current!.getFlatListRef()!;
94
- const snapToIndexSpy = jest.spyOn(flatListRef, 'scrollToIndex');
95
- carouselRef.current?.snapToIndex(2);
96
- waitFor(() => expect(snapToIndexSpy).toHaveBeenCalled());
199
+ const flatListRef = carouselRef.current!.getFlatListRef()!;
200
+ const snapToIndexSpy = jest.spyOn(flatListRef, 'scrollToIndex');
201
+ carouselRef.current?.snapToIndex(2);
202
+ waitFor(() => expect(snapToIndexSpy).toHaveBeenCalled());
97
203
 
98
- expect(snapToIndexSpy).toHaveBeenCalledWith({
99
- animated: true,
100
- index: 2,
101
- viewPosition: 0.5,
204
+ expect(snapToIndexSpy).toHaveBeenCalledWith({
205
+ animated: true,
206
+ index: 2,
207
+ viewPosition: undefined,
208
+ });
102
209
  });
103
210
  });
104
211
  });
@@ -1,6 +1,299 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`CardCarousel should render correctly 1`] = `
3
+ exports[`CardCarousel android should render correctly on iOS 1`] = `
4
+ <View
5
+ style={
6
+ Array [
7
+ Object {},
8
+ Object {
9
+ "height": 100,
10
+ "width": 100,
11
+ },
12
+ ]
13
+ }
14
+ testID="cardCarousel"
15
+ >
16
+ <RCTScrollView
17
+ bounces={false}
18
+ contentInset={
19
+ Object {
20
+ "bottom": 0,
21
+ "left": 24,
22
+ "right": 24,
23
+ "top": 0,
24
+ }
25
+ }
26
+ data={
27
+ Array [
28
+ <Text>
29
+ screen 1
30
+ </Text>,
31
+ <Text>
32
+ screen 2
33
+ </Text>,
34
+ ]
35
+ }
36
+ decelerationRate="fast"
37
+ getItem={[Function]}
38
+ getItemCount={[Function]}
39
+ getItemLayout={[Function]}
40
+ horizontal={true}
41
+ keyExtractor={[Function]}
42
+ onContentSizeChange={[Function]}
43
+ onLayout={[Function]}
44
+ onMomentumScrollBegin={[Function]}
45
+ onMomentumScrollEnd={[Function]}
46
+ onScroll={[Function]}
47
+ onScrollBeginDrag={[Function]}
48
+ onScrollEndDrag={[Function]}
49
+ onViewableItemsChanged={[Function]}
50
+ pagingEnabled={true}
51
+ removeClippedSubviews={true}
52
+ renderItem={[Function]}
53
+ renderToHardwareTextureAndroid={true}
54
+ scrollEventThrottle={32}
55
+ showsHorizontalScrollIndicator={false}
56
+ snapToAlignment="center"
57
+ snapToInterval={0}
58
+ stickyHeaderIndices={Array []}
59
+ viewabilityConfig={
60
+ Object {
61
+ "itemVisiblePercentThreshold": 80,
62
+ }
63
+ }
64
+ viewabilityConfigCallbackPairs={
65
+ Array [
66
+ Object {
67
+ "onViewableItemsChanged": [Function],
68
+ "viewabilityConfig": Object {
69
+ "itemVisiblePercentThreshold": 80,
70
+ },
71
+ },
72
+ ]
73
+ }
74
+ >
75
+ <View>
76
+ <View
77
+ style={
78
+ Array [
79
+ Object {
80
+ "flexDirection": "row",
81
+ },
82
+ null,
83
+ ]
84
+ }
85
+ >
86
+ <View
87
+ style={
88
+ Array [
89
+ Object {
90
+ "padding": 8,
91
+ },
92
+ Object {
93
+ "width": 0,
94
+ },
95
+ ]
96
+ }
97
+ >
98
+ <View
99
+ style={
100
+ Array [
101
+ Object {
102
+ "borderRadius": 8,
103
+ "elevation": 4,
104
+ "flex": 1,
105
+ "shadowColor": "#001f23",
106
+ "shadowOffset": Object {
107
+ "height": 2,
108
+ "width": 0,
109
+ },
110
+ "shadowOpacity": 0.12,
111
+ "shadowRadius": 8,
112
+ },
113
+ undefined,
114
+ ]
115
+ }
116
+ >
117
+ <View
118
+ style={
119
+ Array [
120
+ Object {
121
+ "borderRadius": 12,
122
+ "overflow": "hidden",
123
+ },
124
+ Array [
125
+ Object {
126
+ "borderRadius": 8,
127
+ "flex": 1,
128
+ "overflow": "hidden",
129
+ },
130
+ undefined,
131
+ ],
132
+ ]
133
+ }
134
+ >
135
+ <Text
136
+ allowFontScaling={false}
137
+ style={
138
+ Array [
139
+ Object {
140
+ "color": "#001f23",
141
+ "fontFamily": "BeVietnamPro-Regular",
142
+ "fontSize": 14,
143
+ "letterSpacing": 0.42,
144
+ "lineHeight": 22,
145
+ },
146
+ undefined,
147
+ ]
148
+ }
149
+ themeFontSize="medium"
150
+ themeFontWeight="regular"
151
+ themeIntent="body"
152
+ themeTypeface="neutral"
153
+ >
154
+ screen 1
155
+ </Text>
156
+ </View>
157
+ </View>
158
+ </View>
159
+ </View>
160
+ <View
161
+ style={
162
+ Array [
163
+ Object {
164
+ "flexDirection": "row",
165
+ },
166
+ null,
167
+ ]
168
+ }
169
+ >
170
+ <View
171
+ style={
172
+ Array [
173
+ Object {
174
+ "padding": 8,
175
+ },
176
+ Object {
177
+ "width": 0,
178
+ },
179
+ ]
180
+ }
181
+ >
182
+ <View
183
+ style={
184
+ Array [
185
+ Object {
186
+ "borderRadius": 8,
187
+ "elevation": 4,
188
+ "flex": 1,
189
+ "shadowColor": "#001f23",
190
+ "shadowOffset": Object {
191
+ "height": 2,
192
+ "width": 0,
193
+ },
194
+ "shadowOpacity": 0.12,
195
+ "shadowRadius": 8,
196
+ },
197
+ undefined,
198
+ ]
199
+ }
200
+ >
201
+ <View
202
+ style={
203
+ Array [
204
+ Object {
205
+ "borderRadius": 12,
206
+ "overflow": "hidden",
207
+ },
208
+ Array [
209
+ Object {
210
+ "borderRadius": 8,
211
+ "flex": 1,
212
+ "overflow": "hidden",
213
+ },
214
+ undefined,
215
+ ],
216
+ ]
217
+ }
218
+ >
219
+ <Text
220
+ allowFontScaling={false}
221
+ style={
222
+ Array [
223
+ Object {
224
+ "color": "#001f23",
225
+ "fontFamily": "BeVietnamPro-Regular",
226
+ "fontSize": 14,
227
+ "letterSpacing": 0.42,
228
+ "lineHeight": 22,
229
+ },
230
+ undefined,
231
+ ]
232
+ }
233
+ themeFontSize="medium"
234
+ themeFontWeight="regular"
235
+ themeIntent="body"
236
+ themeTypeface="neutral"
237
+ >
238
+ screen 2
239
+ </Text>
240
+ </View>
241
+ </View>
242
+ </View>
243
+ </View>
244
+ </View>
245
+ </RCTScrollView>
246
+ <View
247
+ style={
248
+ Array [
249
+ Object {
250
+ "alignItems": "center",
251
+ "flexDirection": "row",
252
+ },
253
+ Array [
254
+ Object {
255
+ "alignSelf": "center",
256
+ "marginTop": 16,
257
+ },
258
+ undefined,
259
+ ],
260
+ ]
261
+ }
262
+ testID="pageControl"
263
+ >
264
+ <View
265
+ collapsable={false}
266
+ style={
267
+ Object {
268
+ "backgroundColor": "#401960",
269
+ "borderRadius": 999,
270
+ "height": 8,
271
+ "marginHorizontal": 8,
272
+ "opacity": 1,
273
+ "width": 24,
274
+ }
275
+ }
276
+ testID="page-control-indicator0"
277
+ />
278
+ <View
279
+ collapsable={false}
280
+ style={
281
+ Object {
282
+ "backgroundColor": "#401960",
283
+ "borderRadius": 999,
284
+ "height": 8,
285
+ "marginHorizontal": 8,
286
+ "opacity": 0.5,
287
+ "width": 8,
288
+ }
289
+ }
290
+ testID="page-control-indicator1"
291
+ />
292
+ </View>
293
+ </View>
294
+ `;
295
+
296
+ exports[`CardCarousel ios should render correctly on iOS 1`] = `
4
297
  <View
5
298
  style={
6
299
  Array [
@@ -68,6 +68,7 @@ const StyledErrorTitle = styled(Typography.Text)(({ theme }) => ({
68
68
  textAlign: 'center',
69
69
  marginBottom: theme.__hd__.error.space.titleMarginBottom,
70
70
  color: theme.__hd__.error.colors.title,
71
+ lineHeight: theme.__hd__.error.lineHeight.title,
71
72
  }));
72
73
 
73
74
  const StyledErrorDescription = styled(Typography.Text)(({ theme }) => ({
@@ -75,6 +76,7 @@ const StyledErrorDescription = styled(Typography.Text)(({ theme }) => ({
75
76
  fontSize: theme.__hd__.error.fontSizes.description,
76
77
  textAlign: 'center',
77
78
  color: theme.__hd__.error.colors.description,
79
+ lineHeight: theme.__hd__.error.lineHeight.description,
78
80
  }));
79
81
 
80
82
  export {
@@ -77,6 +77,7 @@ exports[`Error renders error screen with custom image element correctly 1`] = `
77
77
  "color": "#001f23",
78
78
  "fontFamily": "RebondGrotesque-SemiBold",
79
79
  "fontSize": 24,
80
+ "lineHeight": 32,
80
81
  "marginBottom": 8,
81
82
  "textAlign": "center",
82
83
  },
@@ -107,6 +108,7 @@ exports[`Error renders error screen with custom image element correctly 1`] = `
107
108
  "color": "#4d6265",
108
109
  "fontFamily": "RebondGrotesque",
109
110
  "fontSize": 18,
111
+ "lineHeight": 26,
110
112
  "textAlign": "center",
111
113
  },
112
114
  undefined,
@@ -209,6 +211,7 @@ exports[`Error renders error screen with image correctly 1`] = `
209
211
  "color": "#001f23",
210
212
  "fontFamily": "RebondGrotesque-SemiBold",
211
213
  "fontSize": 24,
214
+ "lineHeight": 32,
212
215
  "marginBottom": 8,
213
216
  "textAlign": "center",
214
217
  },
@@ -239,6 +242,7 @@ exports[`Error renders error screen with image correctly 1`] = `
239
242
  "color": "#4d6265",
240
243
  "fontFamily": "RebondGrotesque",
241
244
  "fontSize": 18,
245
+ "lineHeight": 26,
242
246
  "textAlign": "center",
243
247
  },
244
248
  undefined,
@@ -357,6 +361,7 @@ exports[`Error renders full screen error page correctly 1`] = `
357
361
  "color": "#001f23",
358
362
  "fontFamily": "RebondGrotesque-SemiBold",
359
363
  "fontSize": 24,
364
+ "lineHeight": 32,
360
365
  "marginBottom": 8,
361
366
  "textAlign": "center",
362
367
  },
@@ -387,6 +392,7 @@ exports[`Error renders full screen error page correctly 1`] = `
387
392
  "color": "#4d6265",
388
393
  "fontFamily": "RebondGrotesque",
389
394
  "fontSize": 18,
395
+ "lineHeight": 26,
390
396
  "textAlign": "center",
391
397
  },
392
398
  undefined,
@@ -451,6 +457,7 @@ exports[`Error renders title only correctly 1`] = `
451
457
  "color": "#001f23",
452
458
  "fontFamily": "RebondGrotesque-SemiBold",
453
459
  "fontSize": 24,
460
+ "lineHeight": 32,
454
461
  "marginBottom": 8,
455
462
  "textAlign": "center",
456
463
  },
@@ -481,6 +488,7 @@ exports[`Error renders title only correctly 1`] = `
481
488
  "color": "#4d6265",
482
489
  "fontFamily": "RebondGrotesque",
483
490
  "fontSize": 18,
491
+ "lineHeight": 26,
484
492
  "textAlign": "center",
485
493
  },
486
494
  undefined,
@@ -10,7 +10,7 @@ import React, {
10
10
  useState,
11
11
  } from 'react';
12
12
 
13
- import { Keyboard, TouchableWithoutFeedback } from 'react-native';
13
+ import { TouchableWithoutFeedback } from 'react-native';
14
14
  import { WebView } from 'react-native-webview';
15
15
  import type { ComponentType, ReactElement, Ref } from 'react';
16
16
  import type { StyleProp, ViewStyle } from 'react-native';
@@ -207,11 +207,10 @@ const RichTextEditor: ComponentType<RichTextEditorProps> = ({
207
207
  }, []);
208
208
 
209
209
  const requestBlur = useCallback(() => {
210
- if (webview.current) {
210
+ if (webview.current && isFocused) {
211
211
  requestBlurEditor(webview.current);
212
- Keyboard.dismiss();
213
212
  }
214
- }, []);
213
+ }, [isFocused]);
215
214
 
216
215
  useImperativeHandle(forwardedRef, () => ({ requestBlur }), [requestBlur]);
217
216
 
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useRef } from 'react';
2
- import { Animated, Easing, StyleSheet } from 'react-native';
2
+ import { Animated, Easing, Platform, StyleSheet } from 'react-native';
3
3
 
4
4
  import { StyledSpinnerDot, StyledSpinnerRow } from './StyledSpinner';
5
5
 
@@ -22,7 +22,7 @@ const AnimatedSpinner = ({
22
22
  toValue: 1,
23
23
  duration: 1200,
24
24
  easing: Easing.linear,
25
- useNativeDriver: true,
25
+ useNativeDriver: Platform.OS !== 'web',
26
26
  })
27
27
  );
28
28