@jobber/components-native 0.84.4-JOB-134681-8086ad4.25 → 0.84.4-JOB-138679-b1552ab.68

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 (278) hide show
  1. package/dist/package.json +23 -14
  2. package/dist/src/ActionItem/ActionItemGroup.js +1 -1
  3. package/dist/src/AutoLink/components/Link/Link.js +1 -1
  4. package/dist/src/Banner/Banner.js +2 -0
  5. package/dist/src/Banner/components/BannerIcon/BannerIcon.style.js +3 -0
  6. package/dist/src/BottomSheet/BottomSheet.js +2 -2
  7. package/dist/src/Button/components/InternalButtonLoading/InternalButtonLoading.js +0 -1
  8. package/dist/src/ButtonGroup/ButtonGroup.js +1 -1
  9. package/dist/src/ContentOverlay/ContentOverlay.js +5 -7
  10. package/dist/src/ContentOverlay/UNSAFE_WrappedModalize.js +23 -0
  11. package/dist/src/ErrorMessageWrapper/context/ErrorMessageProvider.js +1 -1
  12. package/dist/src/Form/Form.js +5 -2
  13. package/dist/src/Form/components/FormCache/FormCache.js +1 -0
  14. package/dist/src/Form/components/FormMessageBanner/FormMessageBanner.js +1 -1
  15. package/dist/src/Form/context/AtlantisFormContext.js +1 -0
  16. package/dist/src/Form/hooks/useInternalForm.js +6 -3
  17. package/dist/src/FormatFile/components/MediaView/MediaView.js +22 -5
  18. package/dist/src/FormatFile/utils/createUseCreateThumbnail.js +1 -1
  19. package/dist/src/InputCurrency/InputCurrency.js +42 -30
  20. package/dist/src/InputDate/InputDate.js +2 -2
  21. package/dist/src/InputEmail/InputEmail.js +12 -4
  22. package/dist/src/InputFieldWrapper/InputFieldWrapper.js +14 -12
  23. package/dist/src/InputFieldWrapper/InputFieldWrapper.style.js +1 -1
  24. package/dist/src/InputFieldWrapper/components/Prefix/Prefix.js +5 -2
  25. package/dist/src/InputFieldWrapper/components/Suffix/Suffix.js +5 -2
  26. package/dist/src/InputNumber/InputNumber.js +10 -4
  27. package/dist/src/InputPressable/InputPressable.js +20 -8
  28. package/dist/src/InputPressable/InputPressable.style.js +3 -0
  29. package/dist/src/InputSearch/InputSearch.js +1 -1
  30. package/dist/src/InputText/InputText.js +22 -11
  31. package/dist/src/InputText/InputText.style.js +4 -0
  32. package/dist/src/InputTime/InputTime.js +2 -2
  33. package/dist/src/Menu/Menu.js +2 -2
  34. package/dist/src/Select/Select.style.js +1 -0
  35. package/dist/src/Select/components/SelectPressable/SelectPressable.js +1 -1
  36. package/dist/src/Switch/components/BaseSwitch/BaseSwitch.js +7 -1
  37. package/dist/src/Typography/Typography.js +16 -5
  38. package/dist/src/hooks/useAtlantisI18n/locales/en.json +1 -0
  39. package/dist/src/hooks/useAtlantisI18n/locales/es.json +1 -0
  40. package/dist/src/hooks/useFormController.js +5 -14
  41. package/dist/tsconfig.build.json +7 -0
  42. package/dist/tsconfig.build.tsbuildinfo +1 -0
  43. package/dist/tsconfig.json +4 -6
  44. package/dist/types/src/ActionItem/ActionItem.d.ts +2 -1
  45. package/dist/types/src/ActionItem/ActionItemGroup.d.ts +2 -1
  46. package/dist/types/src/ActionItem/components/ActionItemContainer.d.ts +2 -1
  47. package/dist/types/src/ActionLabel/ActionLabel.d.ts +4 -3
  48. package/dist/types/src/ActivityIndicator/ActivityIndicator.d.ts +2 -1
  49. package/dist/types/src/AutoLink/AutoLink.d.ts +2 -1
  50. package/dist/types/src/AutoLink/components/ComposeTextWithLinks/ComposeTextWithLinks.d.ts +2 -1
  51. package/dist/types/src/AutoLink/components/Link/Link.d.ts +2 -1
  52. package/dist/types/src/Banner/Banner.d.ts +2 -1
  53. package/dist/types/src/Banner/components/BannerIcon/BannerIcon.d.ts +2 -1
  54. package/dist/types/src/Banner/components/BannerIcon/BannerIcon.style.d.ts +3 -0
  55. package/dist/types/src/Banner/types.d.ts +1 -1
  56. package/dist/types/src/BottomSheet/BottomSheet.d.ts +1 -1
  57. package/dist/types/src/BottomSheet/components/BottomSheetOption/BottomSheetOption.d.ts +2 -1
  58. package/dist/types/src/Button/Button.d.ts +2 -1
  59. package/dist/types/src/Button/components/InternalButtonLoading/InternalButtonLoading.d.ts +1 -1
  60. package/dist/types/src/ButtonGroup/ButtonGroup.d.ts +2 -1
  61. package/dist/types/src/ButtonGroup/ButtonGroupAction.d.ts +4 -3
  62. package/dist/types/src/ButtonGroup/components/SecondaryActionSheet/SecondaryActionSheet.d.ts +3 -2
  63. package/dist/types/src/Card/Card.d.ts +2 -1
  64. package/dist/types/src/Card/components/InternalCardHeader.d.ts +2 -1
  65. package/dist/types/src/Checkbox/Checkbox.d.ts +2 -1
  66. package/dist/types/src/Checkbox/CheckboxGroup.d.ts +2 -1
  67. package/dist/types/src/Chip/Chip.d.ts +2 -1
  68. package/dist/types/src/Content/Content.d.ts +2 -1
  69. package/dist/types/src/ContentOverlay/ContentOverlay.d.ts +1 -1
  70. package/dist/types/src/ContentOverlay/UNSAFE_WrappedModalize.d.ts +3 -0
  71. package/dist/types/src/Disclosure/Disclosure.d.ts +1 -1
  72. package/dist/types/src/Divider/Divider.d.ts +2 -1
  73. package/dist/types/src/EmptyState/EmptyState.d.ts +2 -1
  74. package/dist/types/src/ErrorMessageWrapper/ErrorMessageWrapper.d.ts +2 -1
  75. package/dist/types/src/ErrorMessageWrapper/context/ErrorMessageProvider.d.ts +2 -1
  76. package/dist/types/src/ErrorMessageWrapper/context/types.d.ts +1 -1
  77. package/dist/types/src/Flex/Flex.d.ts +2 -1
  78. package/dist/types/src/Form/Form.d.ts +2 -1
  79. package/dist/types/src/Form/components/FormActionBar/FormActionBar.d.ts +3 -2
  80. package/dist/types/src/Form/components/FormBody/FormBody.d.ts +3 -2
  81. package/dist/types/src/Form/components/FormCache/FormCache.d.ts +4 -3
  82. package/dist/types/src/Form/components/FormErrorBanner/FormErrorBanner.d.ts +2 -1
  83. package/dist/types/src/Form/components/FormMask/FormMask.d.ts +2 -1
  84. package/dist/types/src/Form/components/FormMessage/FormMessage.d.ts +2 -1
  85. package/dist/types/src/Form/components/FormMessage/components/InternalFormMessage/InternalFormMessage.d.ts +2 -1
  86. package/dist/types/src/Form/components/FormMessageBanner/FormMessageBanner.d.ts +2 -1
  87. package/dist/types/src/Form/components/FormSaveButton/FormSaveButton.d.ts +2 -1
  88. package/dist/types/src/Form/context/AtlantisFormContext.d.ts +2 -1
  89. package/dist/types/src/Form/context/types.d.ts +3 -2
  90. package/dist/types/src/Form/hooks/useFormViewRefs.d.ts +2 -2
  91. package/dist/types/src/Form/hooks/useInternalForm.d.ts +5 -5
  92. package/dist/types/src/Form/types.d.ts +13 -7
  93. package/dist/types/src/FormField/FormField.d.ts +1 -1
  94. package/dist/types/src/FormatFile/FormatFile.d.ts +2 -1
  95. package/dist/types/src/FormatFile/components/ErrorIcon/ErrorIcon.d.ts +2 -1
  96. package/dist/types/src/FormatFile/components/FileView/FileView.d.ts +2 -1
  97. package/dist/types/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.d.ts +3 -2
  98. package/dist/types/src/FormatFile/components/MediaView/MediaView.d.ts +2 -1
  99. package/dist/types/src/FormatFile/components/ProgressBar/ProgressBar.d.ts +2 -1
  100. package/dist/types/src/Heading/Heading.d.ts +4 -3
  101. package/dist/types/src/Icon/Icon.d.ts +2 -1
  102. package/dist/types/src/IconButton/IconButton.d.ts +1 -1
  103. package/dist/types/src/InputCurrency/InputCurrency.d.ts +2 -1
  104. package/dist/types/src/InputDate/InputDate.d.ts +4 -2
  105. package/dist/types/src/InputFieldWrapper/InputFieldWrapper.d.ts +9 -2
  106. package/dist/types/src/InputFieldWrapper/InputFieldWrapper.style.d.ts +1 -1
  107. package/dist/types/src/InputFieldWrapper/components/ClearAction/ClearAction.d.ts +2 -1
  108. package/dist/types/src/InputFieldWrapper/components/Prefix/Prefix.d.ts +4 -4
  109. package/dist/types/src/InputFieldWrapper/components/Suffix/Suffix.d.ts +4 -4
  110. package/dist/types/src/InputPressable/InputPressable.d.ts +9 -1
  111. package/dist/types/src/InputPressable/InputPressable.style.d.ts +3 -0
  112. package/dist/types/src/InputSearch/InputSearch.d.ts +1 -1
  113. package/dist/types/src/InputSearch/components/FilterButton.d.ts +2 -1
  114. package/dist/types/src/InputText/InputText.d.ts +10 -2
  115. package/dist/types/src/InputText/InputText.style.d.ts +4 -0
  116. package/dist/types/src/InputText/context/InputAccessoriesProvider.d.ts +2 -1
  117. package/dist/types/src/InputTime/InputTime.d.ts +4 -2
  118. package/dist/types/src/Menu/Menu.d.ts +2 -1
  119. package/dist/types/src/Menu/components/MenuOption/MenuOption.d.ts +2 -1
  120. package/dist/types/src/Menu/components/Overlay/Overlay.d.ts +2 -1
  121. package/dist/types/src/Menu/types.d.ts +6 -1
  122. package/dist/types/src/ProgressBar/ProgressBar.d.ts +2 -1
  123. package/dist/types/src/ProgressBar/ProgressBarInner.d.ts +2 -1
  124. package/dist/types/src/Select/Select.d.ts +3 -2
  125. package/dist/types/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.d.ts +2 -1
  126. package/dist/types/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.ios.d.ts +2 -1
  127. package/dist/types/src/Select/components/SelectInternalPicker/SelectInternalPicker.d.ts +2 -1
  128. package/dist/types/src/Select/components/SelectPressable/SelectPressable.d.ts +2 -1
  129. package/dist/types/src/StatusLabel/StatusLabel.d.ts +2 -1
  130. package/dist/types/src/Switch/Switch.d.ts +2 -1
  131. package/dist/types/src/Switch/components/BaseSwitch/BaseSwitch.d.ts +2 -1
  132. package/dist/types/src/Text/Text.d.ts +4 -3
  133. package/dist/types/src/TextList/TextList.d.ts +2 -1
  134. package/dist/types/src/ThumbnailList/ThumbnailList.d.ts +2 -1
  135. package/dist/types/src/Toast/Toast.d.ts +2 -1
  136. package/dist/types/src/Typography/Typography.d.ts +3 -3
  137. package/dist/types/src/Typography/TypographyGestureDetector.d.ts +2 -1
  138. package/dist/types/src/utils/test/MockSafeAreaProvider.d.ts +1 -1
  139. package/package.json +23 -14
  140. package/src/ActionItem/ActionItem.tsx +1 -1
  141. package/src/ActionItem/ActionItemGroup.tsx +1 -3
  142. package/src/ActionItem/components/ActionItemContainer.tsx +1 -1
  143. package/src/ActionLabel/ActionLabel.test.tsx +12 -0
  144. package/src/ActionLabel/ActionLabel.tsx +3 -3
  145. package/src/ActionLabel/__snapshots__/ActionLabel.test.tsx.snap +66 -0
  146. package/src/ActivityIndicator/ActivityIndicator.tsx +1 -3
  147. package/src/AtlantisContext/AtlantisContext.test.tsx +1 -1
  148. package/src/AtlantisThemeContext/AtlantisThemeContext.test.tsx +5 -5
  149. package/src/AutoLink/AutoLink.test.tsx +2 -4
  150. package/src/AutoLink/AutoLink.tsx +1 -1
  151. package/src/AutoLink/components/ComposeTextWithLinks/ComposeTextWithLinks.tsx +1 -1
  152. package/src/AutoLink/components/Link/Link.tsx +1 -5
  153. package/src/Banner/Banner.test.tsx +12 -0
  154. package/src/Banner/Banner.tsx +4 -2
  155. package/src/Banner/components/BannerIcon/BannerIcon.style.ts +3 -0
  156. package/src/Banner/components/BannerIcon/BannerIcon.tsx +1 -1
  157. package/src/Banner/types.ts +1 -1
  158. package/src/BottomSheet/BottomSheet.test.tsx +17 -17
  159. package/src/BottomSheet/BottomSheet.tsx +4 -3
  160. package/src/BottomSheet/components/BottomSheetOption/BottomSheetOption.tsx +1 -1
  161. package/src/Button/Button.tsx +1 -1
  162. package/src/Button/components/InternalButtonLoading/InternalButtonLoading.tsx +1 -2
  163. package/src/ButtonGroup/ButtonGroup.test.tsx +13 -11
  164. package/src/ButtonGroup/ButtonGroup.tsx +2 -2
  165. package/src/ButtonGroup/ButtonGroupAction.tsx +4 -4
  166. package/src/ButtonGroup/components/SecondaryActionSheet/SecondaryActionSheet.tsx +2 -2
  167. package/src/Card/Card.tsx +1 -1
  168. package/src/Card/components/InternalCardHeader.tsx +1 -1
  169. package/src/Checkbox/Checkbox.tsx +2 -2
  170. package/src/Checkbox/CheckboxGroup.test.tsx +3 -7
  171. package/src/Checkbox/CheckboxGroup.tsx +2 -2
  172. package/src/Chip/Chip.tsx +1 -1
  173. package/src/Content/Content.tsx +1 -1
  174. package/src/ContentOverlay/ContentOverlay.test.tsx +34 -27
  175. package/src/ContentOverlay/ContentOverlay.tsx +7 -7
  176. package/src/ContentOverlay/UNSAFE_WrappedModalize.tsx +41 -0
  177. package/src/ContentOverlay/hooks/useKeyboardVisibility.test.ts +7 -7
  178. package/src/ContentOverlay/hooks/useViewLayoutHeight.test.ts +1 -1
  179. package/src/Disclosure/Disclosure.tsx +1 -1
  180. package/src/Divider/Divider.tsx +1 -1
  181. package/src/EmptyState/EmptyState.test.tsx +29 -42
  182. package/src/EmptyState/EmptyState.tsx +1 -1
  183. package/src/ErrorMessageWrapper/ErrorMessageWrapper.tsx +1 -1
  184. package/src/ErrorMessageWrapper/context/ErrorMessageProvider.tsx +3 -5
  185. package/src/ErrorMessageWrapper/context/types.ts +1 -1
  186. package/src/Flex/Flex.tsx +2 -2
  187. package/src/Form/Form.test.tsx +145 -2
  188. package/src/Form/Form.tsx +8 -1
  189. package/src/Form/components/FormActionBar/FormActionBar.tsx +3 -3
  190. package/src/Form/components/FormBody/FormBody.tsx +3 -3
  191. package/src/Form/components/FormCache/FormCache.tsx +5 -4
  192. package/src/Form/components/FormErrorBanner/FormErrorBanner.tsx +1 -1
  193. package/src/Form/components/FormMask/FormMask.tsx +1 -1
  194. package/src/Form/components/FormMessage/FormMessage.test.tsx +40 -27
  195. package/src/Form/components/FormMessage/FormMessage.tsx +1 -1
  196. package/src/Form/components/FormMessage/components/InternalFormMessage/InternalFormMessage.tsx +1 -1
  197. package/src/Form/components/FormMessageBanner/FormMessageBanner.tsx +1 -3
  198. package/src/Form/components/FormSaveButton/FormSaveButton.test.tsx +2 -2
  199. package/src/Form/components/FormSaveButton/FormSaveButton.tsx +1 -1
  200. package/src/Form/context/AtlantisFormContext.test.tsx +1 -1
  201. package/src/Form/context/AtlantisFormContext.tsx +1 -0
  202. package/src/Form/context/types.ts +3 -2
  203. package/src/Form/hooks/useFormViewRefs.ts +4 -5
  204. package/src/Form/hooks/useInternalForm.ts +12 -4
  205. package/src/Form/hooks/useScrollToError/useScrollToError.test.tsx +2 -1
  206. package/src/Form/types.ts +14 -8
  207. package/src/FormField/FormField.tsx +1 -1
  208. package/src/FormatFile/FormatFile.test.tsx +21 -21
  209. package/src/FormatFile/FormatFile.tsx +3 -3
  210. package/src/FormatFile/components/ErrorIcon/ErrorIcon.tsx +1 -1
  211. package/src/FormatFile/components/FileView/FileView.tsx +1 -1
  212. package/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.test.tsx +14 -14
  213. package/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.tsx +2 -2
  214. package/src/FormatFile/components/MediaView/MediaView.test.tsx +283 -0
  215. package/src/FormatFile/components/MediaView/MediaView.tsx +28 -7
  216. package/src/FormatFile/components/ProgressBar/ProgressBar.tsx +1 -1
  217. package/src/FormatFile/utils/createUseCreateThumbnail.ts +1 -1
  218. package/src/Glimmer/Glimmer.test.tsx +2 -2
  219. package/src/Heading/Heading.test.tsx +13 -0
  220. package/src/Heading/Heading.tsx +3 -3
  221. package/src/Heading/__snapshots__/Heading.test.tsx.snap +65 -0
  222. package/src/Icon/Icon.tsx +1 -1
  223. package/src/Icon/__snapshots__/Icon.test.tsx.snap +7 -0
  224. package/src/IconButton/IconButton.tsx +1 -1
  225. package/src/InputCurrency/InputCurrency.tsx +72 -58
  226. package/src/InputDate/InputDate.tsx +7 -3
  227. package/src/InputEmail/InputEmail.tsx +15 -8
  228. package/src/InputFieldWrapper/InputFieldWrapper.style.ts +1 -1
  229. package/src/InputFieldWrapper/InputFieldWrapper.test.tsx +48 -1
  230. package/src/InputFieldWrapper/InputFieldWrapper.tsx +39 -29
  231. package/src/InputFieldWrapper/components/ClearAction/ClearAction.tsx +1 -1
  232. package/src/InputFieldWrapper/components/Prefix/Prefix.test.tsx +8 -16
  233. package/src/InputFieldWrapper/components/Prefix/Prefix.tsx +8 -6
  234. package/src/InputFieldWrapper/components/Suffix/Suffix.test.tsx +2 -4
  235. package/src/InputFieldWrapper/components/Suffix/Suffix.tsx +8 -6
  236. package/src/InputNumber/InputNumber.tsx +11 -7
  237. package/src/InputPassword/InputPassword.tsx +1 -1
  238. package/src/InputPressable/InputPressable.style.ts +4 -0
  239. package/src/InputPressable/InputPressable.test.tsx +75 -1
  240. package/src/InputPressable/InputPressable.tsx +34 -8
  241. package/src/InputSearch/InputSearch.tsx +2 -1
  242. package/src/InputSearch/components/FilterButton.tsx +1 -1
  243. package/src/InputText/InputText.style.ts +5 -0
  244. package/src/InputText/InputText.test.tsx +75 -0
  245. package/src/InputText/InputText.tsx +34 -17
  246. package/src/InputText/context/InputAccessoriesProvider.tsx +1 -1
  247. package/src/InputTime/InputTime.tsx +7 -3
  248. package/src/Menu/Menu.tsx +3 -3
  249. package/src/Menu/components/MenuOption/MenuOption.tsx +1 -1
  250. package/src/Menu/components/Overlay/Overlay.tsx +1 -1
  251. package/src/Menu/types.ts +7 -1
  252. package/src/ProgressBar/ProgressBar.tsx +1 -1
  253. package/src/ProgressBar/ProgressBarInner.tsx +1 -1
  254. package/src/Select/Select.style.ts +1 -0
  255. package/src/Select/Select.tsx +2 -2
  256. package/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.ios.tsx +1 -1
  257. package/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.tsx +1 -1
  258. package/src/Select/components/SelectInternalPicker/SelectInternalPicker.tsx +1 -1
  259. package/src/Select/components/SelectPressable/SelectPressable.tsx +1 -4
  260. package/src/StatusLabel/StatusLabel.tsx +1 -1
  261. package/src/Switch/Switch.tsx +1 -1
  262. package/src/Switch/components/BaseSwitch/BaseSwitch.tsx +8 -2
  263. package/src/Text/Text.test.tsx +10 -0
  264. package/src/Text/Text.tsx +3 -3
  265. package/src/Text/__snapshots__/Text.test.tsx.snap +66 -0
  266. package/src/TextList/TextList.tsx +1 -1
  267. package/src/ThumbnailList/ThumbnailList.test.tsx +5 -5
  268. package/src/ThumbnailList/ThumbnailList.tsx +1 -1
  269. package/src/Toast/Toast.tsx +2 -2
  270. package/src/Typography/Typography.test.tsx +61 -0
  271. package/src/Typography/Typography.tsx +25 -9
  272. package/src/Typography/TypographyGestureDetector.tsx +1 -3
  273. package/src/Typography/__snapshots__/Typography.test.tsx.snap +222 -0
  274. package/src/hooks/useAtlantisI18n/locales/en.json +1 -0
  275. package/src/hooks/useAtlantisI18n/locales/es.json +1 -0
  276. package/src/hooks/useFormController.ts +6 -13
  277. package/src/utils/test/MockSafeAreaProvider.tsx +1 -1
  278. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
- import { fireEvent, render } from "@testing-library/react-native";
2
+ import { fireEvent, render, screen } from "@testing-library/react-native";
3
+ import { Path } from "react-native-svg";
3
4
  import type { EmptyStateProps } from "./EmptyState";
4
5
  import { EmptyState } from "./EmptyState";
5
- import * as IconComponent from "../Icon/Icon";
6
6
 
7
7
  const primaryOnPress = jest.fn();
8
8
  const secondaryOnPress = jest.fn();
@@ -27,83 +27,70 @@ const component = (overrideProps?: Partial<EmptyStateProps>) => {
27
27
  ...overrideProps,
28
28
  };
29
29
 
30
- return render(<EmptyState {...props} />);
30
+ render(<EmptyState {...props} />);
31
31
  };
32
32
 
33
- const iconSpy = jest.spyOn(IconComponent, "Icon");
34
-
35
- afterEach(() => jest.clearAllMocks());
36
-
37
33
  describe("EmptyState", () => {
38
34
  it("renders the title", () => {
39
- const { getByText } = component();
35
+ component();
40
36
 
41
- expect(getByText(defaultProps.title)).toBeDefined();
37
+ expect(screen.getByText(defaultProps.title)).toBeDefined();
42
38
  });
43
39
 
44
40
  it("renders the description", () => {
45
- const { getByText } = component();
46
-
47
- expect(getByText(defaultProps.description)).toBeDefined();
48
- });
49
-
50
- it("renders the icon", () => {
51
- const { getByTestId } = component();
41
+ component();
52
42
 
53
- expect(getByTestId(defaultProps.icon)).toBeDefined();
43
+ expect(screen.getByText(defaultProps.description)).toBeDefined();
54
44
  });
55
45
 
56
- it("calls icon with correct default params", () => {
46
+ it("renders the icon with default color and large size", () => {
57
47
  component();
58
-
59
- expect(iconSpy).toHaveBeenCalledWith(
60
- {
61
- color: "blue",
62
- name: defaultProps.icon,
63
- size: "large",
64
- },
65
- {},
48
+ const icon = screen.getByTestId(defaultProps.icon);
49
+ const path = icon.findByType(Path);
50
+ expect(path.props.fill).toBe("hsl(197, 90%, 12%)");
51
+ expect(icon.props.style).toEqual(
52
+ expect.arrayContaining([
53
+ expect.objectContaining({
54
+ width: 32,
55
+ height: 32,
56
+ }),
57
+ ]),
66
58
  );
67
59
  });
68
60
 
69
- it("calls icon with correct params", () => {
70
- component({ iconColor: "greyBlue", icon: "link" });
61
+ it("renders the correct icon color when specified", async () => {
62
+ component({ iconColor: "warning" });
71
63
 
72
- expect(iconSpy).toHaveBeenCalledWith(
73
- {
74
- color: "greyBlue",
75
- name: "link",
76
- size: "large",
77
- },
78
- {},
79
- );
64
+ const icon = screen.getByTestId(defaultProps.icon);
65
+ const pathElement = icon.findByType(Path);
66
+ expect(pathElement.props.fill).toBe("hsl(51, 64%, 49%)");
80
67
  });
81
68
 
82
69
  it("renders the primary action and allows users to interact with it by clicking", () => {
83
- const { getByLabelText } = component();
70
+ component();
84
71
 
85
- const button = getByLabelText(defaultProps.primaryAction.label);
72
+ const button = screen.getByLabelText(defaultProps.primaryAction.label);
86
73
  expect(button).toBeDefined();
87
74
  fireEvent.press(button);
88
75
  expect(primaryOnPress).toHaveBeenCalledTimes(1);
89
76
  });
90
77
 
91
78
  it("renders the secondary action and allows users to interact with it by clicking", () => {
92
- const { getByLabelText } = component();
79
+ component();
93
80
 
94
- const button = getByLabelText(defaultProps.secondaryAction.label);
81
+ const button = screen.getByLabelText(defaultProps.secondaryAction.label);
95
82
  expect(button).toBeDefined();
96
83
  fireEvent.press(button);
97
84
  expect(secondaryOnPress).toHaveBeenCalledTimes(1);
98
85
  });
99
86
 
100
87
  it("does render buttons if neither primary nor secondary action is passed in", () => {
101
- const { queryAllByRole } = component({
88
+ component({
102
89
  description: "No buttons",
103
90
  primaryAction: undefined,
104
91
  secondaryAction: undefined,
105
92
  });
106
93
 
107
- expect(queryAllByRole("button")).toHaveLength(0);
94
+ expect(screen.queryAllByRole("button")).toHaveLength(0);
108
95
  });
109
96
  });
@@ -65,7 +65,7 @@ export function EmptyState({
65
65
  primaryAction,
66
66
  secondaryAction,
67
67
  iconColor = "blue",
68
- }: EmptyStateProps): JSX.Element {
68
+ }: EmptyStateProps) {
69
69
  const styles = useStyles();
70
70
 
71
71
  return (
@@ -34,7 +34,7 @@ export function ErrorMessageWrapper({
34
34
  message,
35
35
  wrapFor = "default",
36
36
  children,
37
- }: ErrorMessageWrapperProps): JSX.Element {
37
+ }: ErrorMessageWrapperProps) {
38
38
  const errorMessageContext = useErrorMessageContext();
39
39
  const register = errorMessageContext?.register;
40
40
  const unregister = errorMessageContext?.unregister;
@@ -13,9 +13,7 @@ interface ErrorMessageProviderProps {
13
13
  readonly children: ReactNode;
14
14
  }
15
15
 
16
- export function ErrorMessageProvider({
17
- children,
18
- }: ErrorMessageProviderProps): JSX.Element {
16
+ export function ErrorMessageProvider({ children }: ErrorMessageProviderProps) {
19
17
  const [elements, setElements] = useState<
20
18
  ErrorMessageContextProps["elements"]
21
19
  >({});
@@ -51,13 +49,13 @@ export function ErrorMessageProvider({
51
49
  }
52
50
  }
53
51
 
54
- function getMeasure(ref: RefObject<View>) {
52
+ function getMeasure(ref: RefObject<View | null>) {
55
53
  return function measure(...args: Parameters<NativeMethods["measureLayout"]>) {
56
54
  ref.current?.measureLayout(...args);
57
55
  };
58
56
  }
59
57
 
60
- function getAccessibilityFocus(ref: RefObject<View>) {
58
+ function getAccessibilityFocus(ref: RefObject<View | null>) {
61
59
  return function accessibilityFocus() {
62
60
  const reactTag = findNodeHandle(ref.current);
63
61
  reactTag &&
@@ -50,7 +50,7 @@ type ElementID = Element["id"];
50
50
  export interface ErrorMessageContextRegisterParams {
51
51
  readonly id: ElementID;
52
52
  readonly hasErrorMessage: Methods["hasErrorMessage"];
53
- readonly ref: RefObject<View>;
53
+ readonly ref: RefObject<View | null>;
54
54
  }
55
55
 
56
56
  export interface ErrorMessageContextProps {
package/src/Flex/Flex.tsx CHANGED
@@ -11,7 +11,7 @@ export function Flex({
11
11
  align = "center",
12
12
  gap = "base",
13
13
  children,
14
- }: PropsWithChildren<FlexProps>): JSX.Element {
14
+ }: PropsWithChildren<FlexProps>) {
15
15
  if (template.length === 1) {
16
16
  console.warn("Please use <Content /> component for a stacked layout");
17
17
  }
@@ -54,7 +54,7 @@ function Row({
54
54
  align = "center",
55
55
  gap = "base",
56
56
  children,
57
- }: PropsWithChildren<FlexProps>): JSX.Element {
57
+ }: PropsWithChildren<FlexProps>) {
58
58
  return (
59
59
  <View testID="ATL-Flex-Row" style={[styles.row, { alignItems: align }]}>
60
60
  {Children.map(children, (child, index) => (
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React, { type ReactElement } from "react";
2
2
  import { act, fireEvent, render, waitFor } from "@testing-library/react-native";
3
3
  import { Alert, Keyboard } from "react-native";
4
4
  import { Host } from "react-native-portalize";
@@ -94,7 +94,7 @@ interface FormTestProps {
94
94
  onSubmit: () => void,
95
95
  label: string | undefined,
96
96
  isSubmitting: boolean,
97
- ) => JSX.Element;
97
+ ) => ReactElement;
98
98
  readonly initialLoading?: boolean;
99
99
  readonly initialValues?: FormFields;
100
100
  readonly bannerMessages?: FormBannerMessage[];
@@ -104,6 +104,7 @@ interface FormTestProps {
104
104
  readonly onBeforeSubmit?: jest.Mock;
105
105
  readonly renderFooter?: React.ReactNode;
106
106
  readonly saveButtonOffset?: number;
107
+ readonly UNSAFE_allowDiscardLocalCacheWhenOffline?: boolean;
107
108
  }
108
109
 
109
110
  function FormTest(props: FormTestProps) {
@@ -125,6 +126,7 @@ function MockForm({
125
126
  localCacheId,
126
127
  renderFooter,
127
128
  saveButtonOffset,
129
+ UNSAFE_allowDiscardLocalCacheWhenOffline = false,
128
130
  }: FormTestProps) {
129
131
  const formErrors: FormBannerErrors = {};
130
132
 
@@ -154,6 +156,9 @@ function MockForm({
154
156
  onBeforeSubmit={onBeforeSubmit}
155
157
  renderFooter={renderFooter}
156
158
  saveButtonOffset={saveButtonOffset}
159
+ UNSAFE_allowDiscardLocalCacheWhenOffline={
160
+ UNSAFE_allowDiscardLocalCacheWhenOffline
161
+ }
157
162
  >
158
163
  <InputText
159
164
  name={testInputTextName}
@@ -561,4 +566,142 @@ describe("Form", () => {
561
566
  expect(queryByTestId("ATL-FormSafeArea")).toBeNull();
562
567
  });
563
568
  });
569
+
570
+ describe("Leaving the form", () => {
571
+ let mockUseConfirmBeforeBack: jest.Mock;
572
+ let mockRemoveLocalCache: jest.Mock;
573
+ const atlantisContextSpy = jest.spyOn(
574
+ atlantisContext,
575
+ "useAtlantisContext",
576
+ );
577
+
578
+ beforeEach(() => {
579
+ mockUseConfirmBeforeBack = jest
580
+ .fn()
581
+ .mockReturnValue({ current: jest.fn() });
582
+ mockRemoveLocalCache = jest.fn();
583
+
584
+ jest
585
+ .spyOn(
586
+ require("../Form/context/AtlantisFormContext"),
587
+ "useAtlantisFormContext",
588
+ )
589
+ .mockReturnValue({
590
+ useConfirmBeforeBack: mockUseConfirmBeforeBack,
591
+ useInternalFormLocalCache: () => ({
592
+ setLocalCache: jest.fn(),
593
+ removeLocalCache: mockRemoveLocalCache,
594
+ }),
595
+ edgeToEdgeEnabled: false,
596
+ });
597
+ });
598
+
599
+ afterEach(() => {
600
+ jest.restoreAllMocks();
601
+ });
602
+
603
+ describe("when UNSAFE_allowDiscardLocalCacheWhenOffline is false", () => {
604
+ it("should NOT pass onAcceptEvent when offline", () => {
605
+ atlantisContextSpy.mockReturnValue({
606
+ ...atlantisContextDefaultValues,
607
+ isOnline: false,
608
+ });
609
+
610
+ render(
611
+ <FormTest
612
+ onSubmit={onSubmitMock}
613
+ UNSAFE_allowDiscardLocalCacheWhenOffline={false}
614
+ localCacheKey="testCacheKey"
615
+ />,
616
+ );
617
+
618
+ expect(mockUseConfirmBeforeBack).toHaveBeenCalled();
619
+ const callArgs = mockUseConfirmBeforeBack.mock.calls[0][0];
620
+ expect(callArgs.onAcceptEvent).toBeUndefined();
621
+ expect(callArgs.showLostProgressMessage).toBe(false);
622
+ });
623
+
624
+ it("should pass onAcceptEvent when online", () => {
625
+ atlantisContextSpy.mockReturnValue({
626
+ ...atlantisContextDefaultValues,
627
+ isOnline: true,
628
+ });
629
+
630
+ render(
631
+ <FormTest
632
+ onSubmit={onSubmitMock}
633
+ UNSAFE_allowDiscardLocalCacheWhenOffline={false}
634
+ localCacheKey="testCacheKey"
635
+ />,
636
+ );
637
+
638
+ expect(mockUseConfirmBeforeBack).toHaveBeenCalled();
639
+ const callArgs = mockUseConfirmBeforeBack.mock.calls[0][0];
640
+ expect(callArgs.onAcceptEvent).toBe(mockRemoveLocalCache);
641
+ expect(callArgs.showLostProgressMessage).toBe(true);
642
+ });
643
+ });
644
+
645
+ describe("when UNSAFE_allowDiscardLocalCacheWhenOffline is true", () => {
646
+ it("should pass onAcceptEvent when offline", () => {
647
+ atlantisContextSpy.mockReturnValue({
648
+ ...atlantisContextDefaultValues,
649
+ isOnline: false,
650
+ });
651
+
652
+ render(
653
+ <FormTest
654
+ onSubmit={onSubmitMock}
655
+ UNSAFE_allowDiscardLocalCacheWhenOffline={true}
656
+ localCacheKey="testCacheKey"
657
+ />,
658
+ );
659
+
660
+ expect(mockUseConfirmBeforeBack).toHaveBeenCalled();
661
+ const callArgs = mockUseConfirmBeforeBack.mock.calls[0][0];
662
+ expect(callArgs.onAcceptEvent).toBe(mockRemoveLocalCache);
663
+ expect(callArgs.showLostProgressMessage).toBe(true);
664
+ });
665
+
666
+ it("should pass onAcceptEvent when online", () => {
667
+ atlantisContextSpy.mockReturnValue({
668
+ ...atlantisContextDefaultValues,
669
+ isOnline: true,
670
+ });
671
+
672
+ render(
673
+ <FormTest
674
+ onSubmit={onSubmitMock}
675
+ UNSAFE_allowDiscardLocalCacheWhenOffline={true}
676
+ localCacheKey="testCacheKey"
677
+ />,
678
+ );
679
+
680
+ expect(mockUseConfirmBeforeBack).toHaveBeenCalled();
681
+ const callArgs = mockUseConfirmBeforeBack.mock.calls[0][0];
682
+ expect(callArgs.onAcceptEvent).toBe(mockRemoveLocalCache);
683
+ expect(callArgs.showLostProgressMessage).toBe(true);
684
+ });
685
+ });
686
+
687
+ describe("without localCacheKey", () => {
688
+ it("should always show lost progress message when no cache key is provided", () => {
689
+ atlantisContextSpy.mockReturnValue({
690
+ ...atlantisContextDefaultValues,
691
+ isOnline: false,
692
+ });
693
+
694
+ render(
695
+ <FormTest
696
+ onSubmit={onSubmitMock}
697
+ UNSAFE_allowDiscardLocalCacheWhenOffline={false}
698
+ />,
699
+ );
700
+
701
+ expect(mockUseConfirmBeforeBack).toHaveBeenCalled();
702
+ const callArgs = mockUseConfirmBeforeBack.mock.calls[0][0];
703
+ expect(callArgs.showLostProgressMessage).toBe(true);
704
+ });
705
+ });
706
+ });
564
707
  });
package/src/Form/Form.tsx CHANGED
@@ -26,6 +26,7 @@ import { useScrollToError } from "./hooks/useScrollToError";
26
26
  import { FormSaveButton } from "./components/FormSaveButton";
27
27
  import { useSaveButtonPosition } from "./hooks/useSaveButtonPosition";
28
28
  import { FormCache } from "./components/FormCache/FormCache";
29
+ import { useAtlantisFormContext } from "./context/AtlantisFormContext";
29
30
  import { InputAccessoriesProvider } from "../InputText";
30
31
  import { tokens } from "../utils/design";
31
32
  import { ErrorMessageProvider } from "../ErrorMessageWrapper";
@@ -33,7 +34,7 @@ import { ErrorMessageProvider } from "../ErrorMessageWrapper";
33
34
  export function Form<T extends FieldValues, S>({
34
35
  initialLoading,
35
36
  ...rest
36
- }: FormProps<T, S>): JSX.Element {
37
+ }: FormProps<T, S>) {
37
38
  const child = initialLoading ? <FormMask /> : <InternalForm {...rest} />;
38
39
 
39
40
  return (
@@ -65,6 +66,7 @@ function InternalForm<T extends FieldValues, S>({
65
66
  saveButtonOffset,
66
67
  showStickySaveButton = false,
67
68
  renderFooter,
69
+ UNSAFE_allowDiscardLocalCacheWhenOffline,
68
70
  }: InternalFormProps<T, S>) {
69
71
  const { scrollViewRef, bottomViewRef, scrollToTop } = useFormViewRefs();
70
72
  const [saveButtonHeight, setSaveButtonHeight] = useState(0);
@@ -86,6 +88,7 @@ function InternalForm<T extends FieldValues, S>({
86
88
  scrollViewRef,
87
89
  saveButtonHeight,
88
90
  messageBannerHeight,
91
+ UNSAFE_allowDiscardLocalCacheWhenOffline,
89
92
  });
90
93
  const { windowHeight, headerHeight } = useScreenInformation();
91
94
  const [keyboardHeight, setKeyboardHeight] = useState(0);
@@ -134,6 +137,8 @@ function InternalForm<T extends FieldValues, S>({
134
137
 
135
138
  const styles = useStyles();
136
139
 
140
+ const { edgeToEdgeEnabled } = useAtlantisFormContext();
141
+
137
142
  return (
138
143
  <FormProvider {...formMethods}>
139
144
  <>
@@ -161,6 +166,7 @@ function InternalForm<T extends FieldValues, S>({
161
166
  <KeyboardAwareScrollView
162
167
  enableResetScrollToCoords={false}
163
168
  enableAutomaticScroll={true}
169
+ enableOnAndroid={edgeToEdgeEnabled}
164
170
  keyboardOpeningTime={
165
171
  Platform.OS === "ios" ? tokens["timing-slowest"] : 0
166
172
  }
@@ -168,6 +174,7 @@ function InternalForm<T extends FieldValues, S>({
168
174
  ref={scrollViewRef}
169
175
  {...keyboardProps}
170
176
  extraHeight={headerHeight}
177
+ extraScrollHeight={edgeToEdgeEnabled ? tokens["space-large"] : 0}
171
178
  contentContainerStyle={
172
179
  !keyboardHeight && styles.scrollContentContainer
173
180
  }
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React, { type ReactElement } from "react";
2
2
  import type { LayoutChangeEvent } from "react-native";
3
3
  import { StyleSheet } from "react-native";
4
4
  import Reanimated from "react-native-reanimated";
@@ -18,7 +18,7 @@ export interface FormActionBarProps {
18
18
  onSubmit: () => void,
19
19
  label: string | undefined,
20
20
  isSubmitting: boolean,
21
- ) => JSX.Element;
21
+ ) => ReactElement;
22
22
  readonly secondaryActions?: SecondaryActionProp[];
23
23
  readonly setSecondaryActionLoading?: (bool: boolean) => void;
24
24
  }
@@ -32,7 +32,7 @@ export function FormActionBar({
32
32
  setSaveButtonHeight,
33
33
  secondaryActions,
34
34
  setSecondaryActionLoading,
35
- }: FormActionBarProps): JSX.Element {
35
+ }: FormActionBarProps) {
36
36
  const styles = useStyles();
37
37
 
38
38
  const buttonStyle = StyleSheet.flatten([
@@ -1,4 +1,4 @@
1
- import React, { useMemo } from "react";
1
+ import React, { type ReactElement, useMemo } from "react";
2
2
  import { View } from "react-native";
3
3
  import { useStyles } from "./FormBody.style";
4
4
  import { useScreenInformation } from "../../hooks/useScreenInformation";
@@ -7,7 +7,7 @@ import { FormActionBar } from "../FormActionBar";
7
7
  import { tokens } from "../../../utils/design";
8
8
 
9
9
  interface FormBodyProps extends FormActionBarProps {
10
- readonly children: JSX.Element;
10
+ readonly children: ReactElement;
11
11
  readonly shouldRenderActionBar?: boolean;
12
12
  readonly saveButtonOffset?: number;
13
13
  }
@@ -24,7 +24,7 @@ export function FormBody({
24
24
  setSecondaryActionLoading,
25
25
  setSaveButtonHeight,
26
26
  saveButtonOffset,
27
- }: FormBodyProps): JSX.Element {
27
+ }: FormBodyProps) {
28
28
  const paddingBottom = useBottomPadding();
29
29
  const fullViewPadding = useMemo(() => ({ paddingBottom }), [paddingBottom]);
30
30
  const styles = useStyles();
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useMemo } from "react";
2
- import type { FieldValues } from "react-hook-form";
2
+ import type { DeepPartial, FieldValues } from "react-hook-form";
3
3
  import { useFormContext, useWatch } from "react-hook-form";
4
4
  import omit from "lodash/omit";
5
5
 
@@ -7,18 +7,18 @@ interface FormCacheProps<T extends FieldValues> {
7
7
  readonly localCacheId?: string | string[];
8
8
  readonly localCacheKey?: string;
9
9
  readonly localCacheExclude?: string[];
10
- readonly setLocalCache: (data: T) => void;
10
+ readonly setLocalCache: (data: DeepPartial<T>) => void;
11
11
  }
12
12
 
13
13
  export function FormCache<T extends FieldValues>({
14
14
  localCacheExclude,
15
15
  localCacheKey,
16
16
  setLocalCache,
17
- }: FormCacheProps<T>): JSX.Element {
17
+ }: FormCacheProps<T>) {
18
18
  const { control, formState } = useFormContext<T>();
19
19
  const { isDirty } = formState;
20
20
 
21
- const formData = useWatch<T>({ control });
21
+ const formData = useWatch({ control });
22
22
  const shouldExclude = useMemo(() => {
23
23
  return Array.isArray(localCacheExclude) && localCacheExclude.length > 0;
24
24
  }, [localCacheExclude]);
@@ -46,5 +46,6 @@ export function FormCache<T extends FieldValues>({
46
46
  }
47
47
  }, [formData, isDirty, localCacheExclude, setLocalCache, shouldExclude]);
48
48
 
49
+ // eslint-disable-next-line react/jsx-no-useless-fragment
49
50
  return <></>;
50
51
  }
@@ -6,7 +6,7 @@ import { useAtlantisI18n } from "../../../hooks/useAtlantisI18n";
6
6
  export function FormErrorBanner({
7
7
  networkError,
8
8
  bannerError,
9
- }: FormBannerErrors): JSX.Element {
9
+ }: FormBannerErrors) {
10
10
  const { t } = useAtlantisI18n();
11
11
 
12
12
  if (networkError) {
@@ -4,7 +4,7 @@ import { useStyles } from "./FormMask.style";
4
4
  import { ActivityIndicator } from "../../../ActivityIndicator";
5
5
  import { useAtlantisI18n } from "../../../hooks/useAtlantisI18n";
6
6
 
7
- export function FormMask(): JSX.Element {
7
+ export function FormMask() {
8
8
  const { t } = useAtlantisI18n();
9
9
  const styles = useStyles();
10
10
 
@@ -1,30 +1,41 @@
1
1
  import React from "react";
2
- import { fireEvent, render } from "@testing-library/react-native";
2
+ import {
3
+ fireEvent,
4
+ render,
5
+ screen,
6
+ waitFor,
7
+ } from "@testing-library/react-native";
3
8
  import { FormMessage } from ".";
4
9
 
5
10
  describe("FormMessage", () => {
6
11
  it("should render null when there are no message to show", () => {
7
- const view = render(<FormMessage />);
8
- expect(view.toJSON()).toMatchInlineSnapshot(`null`);
12
+ render(<FormMessage />);
13
+ expect(screen.toJSON()).toMatchInlineSnapshot(`null`);
9
14
  });
10
15
 
11
- it("should show the message", () => {
12
- const { getByText } = render(<FormMessage />);
16
+ it("should show the message", async () => {
17
+ render(<FormMessage />);
13
18
 
14
19
  const description = "🔥";
15
20
  FormMessage.show({ description });
16
- expect(getByText(description)).toBeDefined();
21
+ await waitFor(() => {
22
+ expect(screen.getByText(description)).toBeDefined();
23
+ });
17
24
  });
18
25
 
19
- it("should close the message", () => {
20
- const { getByText, queryByText } = render(<FormMessage />);
26
+ it("should close the message", async () => {
27
+ render(<FormMessage />);
21
28
 
22
29
  const description = "🌚";
23
30
  FormMessage.show({ description });
24
- expect(getByText(description)).toBeDefined();
31
+ await waitFor(() => {
32
+ expect(screen.getByText(description)).toBeDefined();
33
+ });
25
34
 
26
35
  FormMessage.close();
27
- expect(queryByText(description)).toBeNull();
36
+ await waitFor(() => {
37
+ expect(screen.queryByText(description)).toBeNull();
38
+ });
28
39
  });
29
40
 
30
41
  describe("Opening another message through a message", () => {
@@ -40,33 +51,35 @@ describe("FormMessage", () => {
40
51
  },
41
52
  });
42
53
 
43
- it("should show the most recent message", () => {
44
- const { getByText, queryByText, getByLabelText } = render(
45
- <FormMessage />,
46
- );
54
+ it("should show the most recent message", async () => {
55
+ render(<FormMessage />);
47
56
 
48
57
  showMessage();
49
58
 
50
- expect(getByText(firstMessage)).toBeDefined();
51
- expect(queryByText(secondMessage)).toBeNull();
59
+ await waitFor(() => {
60
+ expect(screen.getByText(firstMessage)).toBeDefined();
61
+ });
62
+ expect(screen.queryByText(secondMessage)).toBeNull();
52
63
 
53
- fireEvent.press(getByLabelText("Click me"));
64
+ fireEvent.press(screen.getByLabelText("Click me"));
54
65
 
55
- expect(getByText(secondMessage)).toBeDefined();
56
- expect(queryByText(firstMessage)).toBeNull();
66
+ expect(screen.getByText(secondMessage)).toBeDefined();
67
+ expect(screen.queryByText(firstMessage)).toBeNull();
57
68
  });
58
69
 
59
- it("should close the most recent message", () => {
60
- const { getByText, queryByText, getByLabelText } = render(
61
- <FormMessage />,
62
- );
70
+ it("should close the most recent message", async () => {
71
+ render(<FormMessage />);
63
72
 
64
73
  showMessage();
65
- fireEvent.press(getByLabelText("Click me"));
74
+ await waitFor(() => {
75
+ expect(screen.getByText("Click me")).toBeDefined();
76
+ });
77
+ fireEvent.press(screen.getByLabelText("Click me"));
66
78
  FormMessage.close();
67
-
68
- expect(getByText(firstMessage)).toBeDefined();
69
- expect(queryByText(secondMessage)).toBeNull();
79
+ await waitFor(() => {
80
+ expect(screen.getByText(firstMessage)).toBeDefined();
81
+ });
82
+ expect(screen.queryByText(secondMessage)).toBeNull();
70
83
  });
71
84
  });
72
85
  });
@@ -17,7 +17,7 @@ let close: (() => void) | undefined;
17
17
  * message to the user. Use `FormMessage.close()` to close the most
18
18
  * recent message.
19
19
  */
20
- export const FormMessage = (): JSX.Element => {
20
+ export const FormMessage = () => {
21
21
  const [data, setData] = useState<FormMessageData[]>([]);
22
22
 
23
23
  open = useCallback(
@@ -15,7 +15,7 @@ interface FormMessageProps {
15
15
  export function InternalFormMessage({
16
16
  data,
17
17
  onRequestClose,
18
- }: FormMessageProps): JSX.Element {
18
+ }: FormMessageProps) {
19
19
  const { t } = useAtlantisI18n();
20
20
  const styles = useStyles();
21
21
  const emptyStateData: EmptyStateProps = useMemo(() => {
@@ -8,9 +8,7 @@ interface FormMessageBannerProps {
8
8
  readonly bannerMessages?: FormBannerMessage[];
9
9
  }
10
10
 
11
- export function FormMessageBanner({
12
- bannerMessages,
13
- }: FormMessageBannerProps): JSX.Element {
11
+ export function FormMessageBanner({ bannerMessages }: FormMessageBannerProps) {
14
12
  return (
15
13
  <>
16
14
  {bannerMessages?.map((message, index) => (