@terreno/ui 57.20.0 → 58.0.0-beta.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.
- package/.ai/guidelines/core.md +1 -1
- package/CHANGELOG.md +93 -0
- package/dist/ActionSheet.d.ts +9 -9
- package/dist/ActionSheet.d.ts.map +1 -1
- package/dist/ActionSheet.js +11 -4
- package/dist/ActionSheet.js.map +1 -1
- package/dist/AnnouncementNavigator.d.ts +7 -1
- package/dist/AnnouncementNavigator.d.ts.map +1 -1
- package/dist/AnnouncementNavigator.js +15 -16
- package/dist/AnnouncementNavigator.js.map +1 -1
- package/dist/Avatar.d.ts.map +1 -1
- package/dist/Avatar.js +1 -1
- package/dist/Avatar.js.map +1 -1
- package/dist/Box.d.ts.map +1 -1
- package/dist/Box.js +3 -1
- package/dist/Box.js.map +1 -1
- package/dist/Common.d.ts +71 -39
- package/dist/Common.d.ts.map +1 -1
- package/dist/Common.js.map +1 -1
- package/dist/ConsentFormScreen.d.ts.map +1 -1
- package/dist/ConsentFormScreen.js.map +1 -1
- package/dist/ConsentNavigator.d.ts +5 -3
- package/dist/ConsentNavigator.d.ts.map +1 -1
- package/dist/ConsentNavigator.js +4 -4
- package/dist/ConsentNavigator.js.map +1 -1
- package/dist/CustomSelectField.js.map +1 -1
- package/dist/DataTable.d.ts.map +1 -1
- package/dist/DataTable.js +37 -12
- package/dist/DataTable.js.map +1 -1
- package/dist/DateTimeField.js +6 -6
- package/dist/DateTimeField.js.map +1 -1
- package/dist/DropdownPanel.d.ts +0 -5
- package/dist/DropdownPanel.d.ts.map +1 -1
- package/dist/DropdownPanel.js +0 -5
- package/dist/DropdownPanel.js.map +1 -1
- package/dist/FilterAccordion.d.ts.map +1 -1
- package/dist/FilterAccordion.js.map +1 -1
- package/dist/FilterBoolean.d.ts.map +1 -1
- package/dist/FilterBoolean.js.map +1 -1
- package/dist/FilterSelectMenu.js +1 -1
- package/dist/FilterSelectMenu.js.map +1 -1
- package/dist/GPTChat.d.ts.map +1 -1
- package/dist/GPTChat.js.map +1 -1
- package/dist/Heading.d.ts.map +1 -1
- package/dist/Heading.js +6 -12
- package/dist/Heading.js.map +1 -1
- package/dist/HeightField.d.ts.map +1 -1
- package/dist/HeightField.js +9 -9
- package/dist/HeightField.js.map +1 -1
- package/dist/Hyperlink.d.ts.map +1 -1
- package/dist/Hyperlink.js +6 -1
- package/dist/Hyperlink.js.map +1 -1
- package/dist/Image.d.ts +1 -1
- package/dist/MarkdownEditorField.d.ts.map +1 -1
- package/dist/MarkdownEditorField.js +1 -1
- package/dist/MarkdownEditorField.js.map +1 -1
- package/dist/OfflineBanner.d.ts +3 -2
- package/dist/OfflineBanner.d.ts.map +1 -1
- package/dist/OfflineBanner.js +3 -2
- package/dist/OfflineBanner.js.map +1 -1
- package/dist/OtpField.d.ts.map +1 -1
- package/dist/OtpField.js +4 -4
- package/dist/OtpField.js.map +1 -1
- package/dist/PickerSelect.d.ts +4 -4
- package/dist/PickerSelect.d.ts.map +1 -1
- package/dist/PickerSelect.js +9 -9
- package/dist/PickerSelect.js.map +1 -1
- package/dist/ProvisionalConsentSigner.d.ts +3 -2
- package/dist/ProvisionalConsentSigner.d.ts.map +1 -1
- package/dist/ProvisionalConsentSigner.js +2 -2
- package/dist/ProvisionalConsentSigner.js.map +1 -1
- package/dist/SidebarNavigation.js +2 -2
- package/dist/SidebarNavigation.js.map +1 -1
- package/dist/SidebarNavigation.native.js +2 -2
- package/dist/SidebarNavigation.native.js.map +1 -1
- package/dist/Skeleton.js.map +1 -1
- package/dist/TapToEdit.d.ts +1 -1
- package/dist/TapToEdit.d.ts.map +1 -1
- package/dist/TapToEdit.js.map +1 -1
- package/dist/Text.d.ts.map +1 -1
- package/dist/Text.js +27 -50
- package/dist/Text.js.map +1 -1
- package/dist/TextField.d.ts.map +1 -1
- package/dist/TextField.js +4 -4
- package/dist/TextField.js.map +1 -1
- package/dist/Theme.d.ts.map +1 -1
- package/dist/Theme.js +16 -0
- package/dist/Theme.js.map +1 -1
- package/dist/ThumbsUpDownFeedback.d.ts.map +1 -1
- package/dist/ThumbsUpDownFeedback.js.map +1 -1
- package/dist/ToastNotifications.d.ts.map +1 -1
- package/dist/ToastNotifications.js.map +1 -1
- package/dist/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip.js.map +1 -1
- package/dist/Unifier.d.ts +1 -1
- package/dist/WebAddressAutocomplete.js.map +1 -1
- package/dist/WebDropdownMenu.d.ts +3 -3
- package/dist/WebDropdownMenu.d.ts.map +1 -1
- package/dist/WebDropdownMenu.js +1 -1
- package/dist/WebDropdownMenu.js.map +1 -1
- package/dist/announcementPlatform.d.ts +5 -0
- package/dist/announcementPlatform.d.ts.map +1 -1
- package/dist/announcementPlatform.js +9 -0
- package/dist/announcementPlatform.js.map +1 -1
- package/dist/asks/AskCard.d.ts +2 -2
- package/dist/asks/AskCard.d.ts.map +1 -1
- package/dist/dataTableColumnWidths.d.ts +76 -0
- package/dist/dataTableColumnWidths.d.ts.map +1 -0
- package/dist/dataTableColumnWidths.js +181 -0
- package/dist/dataTableColumnWidths.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/login/LoginScreen.js.map +1 -1
- package/dist/requestClient.d.ts +71 -0
- package/dist/requestClient.d.ts.map +1 -0
- package/dist/requestClient.js +139 -0
- package/dist/requestClient.js.map +1 -0
- package/dist/security/PasswordCard.d.ts.map +1 -1
- package/dist/security/PasswordCard.js.map +1 -1
- package/dist/security/TwoFactorSettingsCard.d.ts.map +1 -1
- package/dist/security/TwoFactorSettingsCard.js +1 -1
- package/dist/security/TwoFactorSettingsCard.js.map +1 -1
- package/dist/signUp/SignUpScreen.js.map +1 -1
- package/dist/table/Table.d.ts.map +1 -1
- package/dist/table/Table.js.map +1 -1
- package/dist/table/TableTitle.d.ts.map +1 -1
- package/dist/table/TableTitle.js +2 -1
- package/dist/table/TableTitle.js.map +1 -1
- package/dist/textFontSizes.d.ts +12 -0
- package/dist/textFontSizes.d.ts.map +1 -0
- package/dist/textFontSizes.js +21 -0
- package/dist/textFontSizes.js.map +1 -0
- package/dist/useAcknowledgeAnnouncement.d.ts +8 -63
- package/dist/useAcknowledgeAnnouncement.d.ts.map +1 -1
- package/dist/useAcknowledgeAnnouncement.js +31 -80
- package/dist/useAcknowledgeAnnouncement.js.map +1 -1
- package/dist/useAnnouncements.d.ts +14 -47
- package/dist/useAnnouncements.d.ts.map +1 -1
- package/dist/useAnnouncements.js +30 -57
- package/dist/useAnnouncements.js.map +1 -1
- package/dist/useConsentForms.d.ts +6 -38
- package/dist/useConsentForms.d.ts.map +1 -1
- package/dist/useConsentForms.js +25 -48
- package/dist/useConsentForms.js.map +1 -1
- package/dist/useProvisionalConsent.d.ts +7 -58
- package/dist/useProvisionalConsent.d.ts.map +1 -1
- package/dist/useProvisionalConsent.js +57 -67
- package/dist/useProvisionalConsent.js.map +1 -1
- package/dist/useSubmitConsent.d.ts +9 -39
- package/dist/useSubmitConsent.d.ts.map +1 -1
- package/dist/useSubmitConsent.js +10 -39
- package/dist/useSubmitConsent.js.map +1 -1
- package/package.json +40 -38
- package/src/ActionSheet.test.tsx +13 -13
- package/src/ActionSheet.tsx +18 -5
- package/src/AddressField.test.tsx +9 -3
- package/src/AnnouncementNavigator.test.tsx +219 -319
- package/src/AnnouncementNavigator.tsx +25 -20
- package/src/Avatar.tsx +2 -9
- package/src/Badge.test.tsx +1 -1
- package/src/Banner.test.tsx +0 -1
- package/src/Box.test.tsx +85 -77
- package/src/Box.tsx +4 -2
- package/src/Button.test.tsx +11 -6
- package/src/Card.test.tsx +2 -2
- package/src/Common.ts +79 -44
- package/src/ConflictSheet.test.tsx +5 -5
- package/src/ConsentFormScreen.test.tsx +3 -1
- package/src/ConsentFormScreen.tsx +2 -1
- package/src/ConsentNavigator.test.tsx +166 -243
- package/src/ConsentNavigator.tsx +9 -13
- package/src/CustomSelectField.test.tsx +16 -4
- package/src/CustomSelectField.tsx +3 -3
- package/src/DataTable.test.tsx +73 -5
- package/src/DataTable.tsx +72 -19
- package/src/DataTableVirtualizationRegression.test.tsx +1 -0
- package/src/DateTimeActionSheet.test.tsx +2 -0
- package/src/DateTimeField.test.tsx +3 -12
- package/src/DateTimeField.tsx +10 -10
- package/src/DismissButton.test.tsx +22 -4
- package/src/DropdownPanel.tsx +0 -6
- package/src/EmailField.test.tsx +13 -22
- package/src/EmojiSelector.test.tsx +2 -2
- package/src/ErrorBoundary.test.tsx +5 -3
- package/src/Field.test.tsx +20 -44
- package/src/FilterAccordion.tsx +3 -3
- package/src/FilterBoolean.tsx +3 -3
- package/src/FilterSelectMenu.tsx +1 -1
- package/src/GPTChat.test.tsx +24 -16
- package/src/GPTChat.tsx +10 -9
- package/src/Heading.test.tsx +1 -1
- package/src/Heading.tsx +7 -14
- package/src/HeightField.tsx +17 -10
- package/src/Hyperlink.tsx +6 -3
- package/src/Icon.test.tsx +2 -2
- package/src/Image.test.tsx +1 -1
- package/src/Link.test.tsx +13 -6
- package/src/MarkdownEditorField.tsx +10 -2
- package/src/MarkdownView.test.tsx +10 -6
- package/src/MobileAddressAutoComplete.test.tsx +2 -1
- package/src/Modal.test.tsx +10 -3
- package/src/ModalSheet.test.tsx +11 -10
- package/src/MultiselectField.test.tsx +17 -3
- package/src/NumberField.test.tsx +14 -14
- package/src/NumberPickerActionSheet.test.tsx +1 -1
- package/src/OfflineBanner.tsx +3 -2
- package/src/OpenAPIContext.test.tsx +4 -4
- package/src/OpenAPIRenderRegression.test.tsx +1 -1
- package/src/OtpField.tsx +6 -5
- package/src/P0RenderRegression.test.tsx +7 -1
- package/src/P1RenderRegression.test.tsx +1 -0
- package/src/P2ButtonRenderRegression.test.tsx +1 -0
- package/src/Page.test.tsx +1 -1
- package/src/PhoneNumberField.test.tsx +14 -38
- package/src/PickerSelect.tsx +12 -11
- package/src/Popover.test.tsx +2 -2
- package/src/ProvisionalConsentSigner.test.tsx +140 -113
- package/src/ProvisionalConsentSigner.tsx +5 -4
- package/src/RadioField.test.tsx +7 -2
- package/src/SegmentedControl.test.tsx +21 -12
- package/src/SidebarNavigation.native.tsx +2 -2
- package/src/SidebarNavigation.test.tsx +18 -6
- package/src/SidebarNavigation.tsx +2 -2
- package/src/Signature.test.tsx +20 -23
- package/src/Skeleton.tsx +1 -1
- package/src/Slider.test.tsx +1 -1
- package/src/SplitPage.test.tsx +15 -5
- package/src/TapToEdit.test.tsx +40 -17
- package/src/TapToEdit.tsx +1 -1
- package/src/TerrenoFontProvider.test.tsx +1 -1
- package/src/Text.test.tsx +4 -4
- package/src/Text.tsx +25 -51
- package/src/TextField.test.tsx +82 -9
- package/src/TextField.tsx +6 -5
- package/src/Theme.test.tsx +49 -0
- package/src/Theme.tsx +16 -0
- package/src/ThumbsUpDownFeedback.tsx +3 -3
- package/src/Toast.test.tsx +5 -5
- package/src/ToastNotifications.test.tsx +73 -70
- package/src/ToastNotifications.tsx +3 -2
- package/src/ToastNotifications.webModal.test.tsx +6 -3
- package/src/Tooltip.test.tsx +3 -3
- package/src/Tooltip.tsx +2 -1
- package/src/UnifiedAddressAutoComplete.test.tsx +1 -1
- package/src/UserInactivity.test.tsx +1 -0
- package/src/WebAddressAutocomplete.test.tsx +12 -12
- package/src/WebAddressAutocomplete.tsx +3 -3
- package/src/WebDropdownMenu.test.tsx +16 -15
- package/src/WebDropdownMenu.tsx +16 -5
- package/src/__snapshots__/Card.test.tsx.snap +1 -1
- package/src/__snapshots__/DataTable.test.tsx.snap +13 -0
- package/src/__snapshots__/DismissButton.test.tsx.snap +3 -3
- package/src/__snapshots__/Field.test.tsx.snap +4 -2
- package/src/__snapshots__/Heading.test.tsx.snap +1 -1
- package/src/__snapshots__/Image.test.tsx.snap +1 -1
- package/src/__snapshots__/Page.test.tsx.snap +2 -2
- package/src/__snapshots__/Text.test.tsx.snap +1 -1
- package/src/announcementPlatform.ts +10 -0
- package/src/asks/AskCard.test.tsx +20 -15
- package/src/asks/AskCard.tsx +2 -2
- package/src/asks/AskFiles.test.tsx +5 -1
- package/src/asks/askFileRefs.test.ts +1 -1
- package/src/asks/askSummary.test.ts +2 -2
- package/src/benchmarks/importTiming.ts +1 -1
- package/src/blocks/BlocksView.test.tsx +20 -11
- package/src/bunSetup.ts +43 -1
- package/src/dataTableColumnWidths.test.ts +266 -0
- package/src/dataTableColumnWidths.ts +272 -0
- package/src/dataTableFilters.test.tsx +1 -1
- package/src/index.tsx +9 -2
- package/src/isolated/ListDetailLayout.isolated.tsx +2 -4
- package/src/login/LoginScreen.test.tsx +6 -6
- package/src/login/LoginScreen.tsx +2 -2
- package/src/requestClient.test.ts +288 -0
- package/src/requestClient.ts +228 -0
- package/src/security/PasswordCard.test.tsx +3 -3
- package/src/security/PasswordCard.tsx +7 -5
- package/src/security/TwoFactorSettingsCard.tsx +10 -3
- package/src/signUp/SignUpScreen.test.tsx +4 -4
- package/src/signUp/SignUpScreen.tsx +2 -2
- package/src/table/Table.tsx +1 -2
- package/src/table/TableTitle.tsx +2 -1
- package/src/table/tableContext.test.tsx +5 -5
- package/src/test-utils.tsx +132 -1
- package/src/testing/reactDomServer.d.ts +7 -0
- package/src/textFontSizes.ts +31 -0
- package/src/useAcknowledgeAnnouncement.test.ts +101 -193
- package/src/useAcknowledgeAnnouncement.ts +69 -147
- package/src/useAnnouncements.test.ts +122 -186
- package/src/useAnnouncements.ts +49 -105
- package/src/useConsentForms.test.ts +59 -112
- package/src/useConsentForms.ts +37 -87
- package/src/useProvisionalConsent.test.ts +74 -150
- package/src/useProvisionalConsent.ts +79 -125
- package/src/useSubmitConsent.test.ts +59 -85
- package/src/useSubmitConsent.ts +22 -77
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {beforeAll, describe, expect, it, mock} from "bun:test";
|
|
2
2
|
import {act, render, waitFor} from "@testing-library/react-native";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import {Text} from "react-native";
|
|
4
|
+
import {type ScaledSize, Text} from "react-native";
|
|
5
5
|
|
|
6
6
|
import ToastContainer, {
|
|
7
7
|
GlobalToast,
|
|
@@ -18,8 +18,8 @@ beforeAll(() => {
|
|
|
18
18
|
global.requestAnimationFrame = (callback: FrameRequestCallback) => {
|
|
19
19
|
return setTimeout(() => callback(Date.now()), 0) as unknown as number;
|
|
20
20
|
};
|
|
21
|
-
global.cancelAnimationFrame = (id: number) => {
|
|
22
|
-
clearTimeout(id);
|
|
21
|
+
global.cancelAnimationFrame = (id: number | null | undefined) => {
|
|
22
|
+
clearTimeout(id ?? undefined);
|
|
23
23
|
};
|
|
24
24
|
});
|
|
25
25
|
|
|
@@ -55,7 +55,7 @@ describe("ToastNotifications", () => {
|
|
|
55
55
|
|
|
56
56
|
describe("useToastNotifications hook", () => {
|
|
57
57
|
it("should return toast methods from context", () => {
|
|
58
|
-
let toastRef
|
|
58
|
+
let toastRef = null as ToastType | null;
|
|
59
59
|
|
|
60
60
|
const TestComponent = () => {
|
|
61
61
|
const toast = useToastNotifications();
|
|
@@ -73,7 +73,7 @@ describe("ToastNotifications", () => {
|
|
|
73
73
|
});
|
|
74
74
|
|
|
75
75
|
it("should have show method available after mount", async () => {
|
|
76
|
-
let toastRef
|
|
76
|
+
let toastRef = null as ToastType | null;
|
|
77
77
|
|
|
78
78
|
const TestComponent = () => {
|
|
79
79
|
const toast = useToastNotifications();
|
|
@@ -93,7 +93,7 @@ describe("ToastNotifications", () => {
|
|
|
93
93
|
});
|
|
94
94
|
|
|
95
95
|
it("should have hide method available after mount", async () => {
|
|
96
|
-
let toastRef
|
|
96
|
+
let toastRef = null as ToastType | null;
|
|
97
97
|
|
|
98
98
|
const TestComponent = () => {
|
|
99
99
|
const toast = useToastNotifications();
|
|
@@ -113,7 +113,7 @@ describe("ToastNotifications", () => {
|
|
|
113
113
|
});
|
|
114
114
|
|
|
115
115
|
it("should have hideAll method available after mount", async () => {
|
|
116
|
-
let toastRef
|
|
116
|
+
let toastRef = null as ToastType | null;
|
|
117
117
|
|
|
118
118
|
const TestComponent = () => {
|
|
119
119
|
const toast = useToastNotifications();
|
|
@@ -133,7 +133,7 @@ describe("ToastNotifications", () => {
|
|
|
133
133
|
});
|
|
134
134
|
|
|
135
135
|
it("should have update method available after mount", async () => {
|
|
136
|
-
let toastRef
|
|
136
|
+
let toastRef = null as ToastType | null;
|
|
137
137
|
|
|
138
138
|
const TestComponent = () => {
|
|
139
139
|
const toast = useToastNotifications();
|
|
@@ -153,7 +153,7 @@ describe("ToastNotifications", () => {
|
|
|
153
153
|
});
|
|
154
154
|
|
|
155
155
|
it("should have isOpen method available after mount", async () => {
|
|
156
|
-
let toastRef
|
|
156
|
+
let toastRef = null as ToastType | null;
|
|
157
157
|
|
|
158
158
|
const TestComponent = () => {
|
|
159
159
|
const toast = useToastNotifications();
|
|
@@ -189,7 +189,7 @@ describe("ToastNotifications", () => {
|
|
|
189
189
|
|
|
190
190
|
describe("Toast functionality", () => {
|
|
191
191
|
it("lets clicks pass through the full-width safe area around toasts", async () => {
|
|
192
|
-
let toastRef
|
|
192
|
+
let toastRef = null as ToastType | null;
|
|
193
193
|
|
|
194
194
|
const TestComponent = () => {
|
|
195
195
|
const toast = useToastNotifications();
|
|
@@ -225,7 +225,7 @@ describe("ToastNotifications", () => {
|
|
|
225
225
|
});
|
|
226
226
|
|
|
227
227
|
it("should show a toast and return an id", async () => {
|
|
228
|
-
let toastRef
|
|
228
|
+
let toastRef = null as ToastType | null;
|
|
229
229
|
|
|
230
230
|
const TestComponent = () => {
|
|
231
231
|
const toast = useToastNotifications();
|
|
@@ -253,7 +253,7 @@ describe("ToastNotifications", () => {
|
|
|
253
253
|
});
|
|
254
254
|
|
|
255
255
|
it("should show a toast with custom id", async () => {
|
|
256
|
-
let toastRef
|
|
256
|
+
let toastRef = null as ToastType | null;
|
|
257
257
|
|
|
258
258
|
const TestComponent = () => {
|
|
259
259
|
const toast = useToastNotifications();
|
|
@@ -280,7 +280,7 @@ describe("ToastNotifications", () => {
|
|
|
280
280
|
});
|
|
281
281
|
|
|
282
282
|
it("should have isOpen method that returns false for non-existent toast", async () => {
|
|
283
|
-
let toastRef
|
|
283
|
+
let toastRef = null as ToastType | null;
|
|
284
284
|
|
|
285
285
|
const TestComponent = () => {
|
|
286
286
|
const toast = useToastNotifications();
|
|
@@ -302,7 +302,7 @@ describe("ToastNotifications", () => {
|
|
|
302
302
|
});
|
|
303
303
|
|
|
304
304
|
it("should have hide method available", async () => {
|
|
305
|
-
let toastRef
|
|
305
|
+
let toastRef = null as ToastType | null;
|
|
306
306
|
|
|
307
307
|
const TestComponent = () => {
|
|
308
308
|
const toast = useToastNotifications();
|
|
@@ -324,7 +324,7 @@ describe("ToastNotifications", () => {
|
|
|
324
324
|
});
|
|
325
325
|
|
|
326
326
|
it("should have hideAll method available", async () => {
|
|
327
|
-
let toastRef
|
|
327
|
+
let toastRef = null as ToastType | null;
|
|
328
328
|
|
|
329
329
|
const TestComponent = () => {
|
|
330
330
|
const toast = useToastNotifications();
|
|
@@ -346,7 +346,7 @@ describe("ToastNotifications", () => {
|
|
|
346
346
|
});
|
|
347
347
|
|
|
348
348
|
it("should have update method available", async () => {
|
|
349
|
-
let toastRef
|
|
349
|
+
let toastRef = null as ToastType | null;
|
|
350
350
|
|
|
351
351
|
const TestComponent = () => {
|
|
352
352
|
const toast = useToastNotifications();
|
|
@@ -370,7 +370,7 @@ describe("ToastNotifications", () => {
|
|
|
370
370
|
|
|
371
371
|
describe("Toast types", () => {
|
|
372
372
|
it("should show success toast", async () => {
|
|
373
|
-
let toastRef
|
|
373
|
+
let toastRef = null as ToastType | null;
|
|
374
374
|
|
|
375
375
|
const TestComponent = () => {
|
|
376
376
|
const toast = useToastNotifications();
|
|
@@ -397,7 +397,7 @@ describe("ToastNotifications", () => {
|
|
|
397
397
|
});
|
|
398
398
|
|
|
399
399
|
it("should show danger toast", async () => {
|
|
400
|
-
let toastRef
|
|
400
|
+
let toastRef = null as ToastType | null;
|
|
401
401
|
|
|
402
402
|
const TestComponent = () => {
|
|
403
403
|
const toast = useToastNotifications();
|
|
@@ -424,7 +424,7 @@ describe("ToastNotifications", () => {
|
|
|
424
424
|
});
|
|
425
425
|
|
|
426
426
|
it("should show warning toast", async () => {
|
|
427
|
-
let toastRef
|
|
427
|
+
let toastRef = null as ToastType | null;
|
|
428
428
|
|
|
429
429
|
const TestComponent = () => {
|
|
430
430
|
const toast = useToastNotifications();
|
|
@@ -482,7 +482,7 @@ describe("ToastNotifications", () => {
|
|
|
482
482
|
|
|
483
483
|
describe("Toast options", () => {
|
|
484
484
|
it("should accept custom duration", async () => {
|
|
485
|
-
let toastRef
|
|
485
|
+
let toastRef = null as ToastType | null;
|
|
486
486
|
|
|
487
487
|
const TestComponent = () => {
|
|
488
488
|
const toast = useToastNotifications();
|
|
@@ -509,7 +509,7 @@ describe("ToastNotifications", () => {
|
|
|
509
509
|
});
|
|
510
510
|
|
|
511
511
|
it("should accept duration of 0 for persistent toast", async () => {
|
|
512
|
-
let toastRef
|
|
512
|
+
let toastRef = null as ToastType | null;
|
|
513
513
|
|
|
514
514
|
const TestComponent = () => {
|
|
515
515
|
const toast = useToastNotifications();
|
|
@@ -536,7 +536,7 @@ describe("ToastNotifications", () => {
|
|
|
536
536
|
});
|
|
537
537
|
|
|
538
538
|
it("should call onClose callback when toast is hidden", async () => {
|
|
539
|
-
let toastRef
|
|
539
|
+
let toastRef = null as ToastType | null;
|
|
540
540
|
const onCloseMock = mock(() => {});
|
|
541
541
|
|
|
542
542
|
const TestComponent = () => {
|
|
@@ -565,7 +565,7 @@ describe("ToastNotifications", () => {
|
|
|
565
565
|
});
|
|
566
566
|
|
|
567
567
|
it("should accept custom animation duration", async () => {
|
|
568
|
-
let toastRef
|
|
568
|
+
let toastRef = null as ToastType | null;
|
|
569
569
|
|
|
570
570
|
const TestComponent = () => {
|
|
571
571
|
const toast = useToastNotifications();
|
|
@@ -612,7 +612,7 @@ describe("ToastNotifications", () => {
|
|
|
612
612
|
|
|
613
613
|
describe("Toast with React elements", () => {
|
|
614
614
|
it("should accept React element as message", async () => {
|
|
615
|
-
let toastRef
|
|
615
|
+
let toastRef = null as ToastType | null;
|
|
616
616
|
|
|
617
617
|
const TestComponent = () => {
|
|
618
618
|
const toast = useToastNotifications();
|
|
@@ -641,7 +641,7 @@ describe("ToastNotifications", () => {
|
|
|
641
641
|
|
|
642
642
|
describe("Toast update and hideAll", () => {
|
|
643
643
|
it("should update an existing toast message", async () => {
|
|
644
|
-
let toastRef
|
|
644
|
+
let toastRef = null as ToastType | null;
|
|
645
645
|
|
|
646
646
|
const TestComponent = () => {
|
|
647
647
|
const toast = useToastNotifications();
|
|
@@ -674,7 +674,7 @@ describe("ToastNotifications", () => {
|
|
|
674
674
|
});
|
|
675
675
|
|
|
676
676
|
it("should hide all toasts at once", async () => {
|
|
677
|
-
let toastRef
|
|
677
|
+
let toastRef = null as ToastType | null;
|
|
678
678
|
|
|
679
679
|
const TestComponent = () => {
|
|
680
680
|
const toast = useToastNotifications();
|
|
@@ -711,7 +711,7 @@ describe("ToastNotifications", () => {
|
|
|
711
711
|
queryAllByText: ReturnType<typeof render>["queryAllByText"];
|
|
712
712
|
getRef: () => ToastType | null;
|
|
713
713
|
} => {
|
|
714
|
-
let toastRef
|
|
714
|
+
let toastRef = null as ToastType | null;
|
|
715
715
|
const TestComponent = () => {
|
|
716
716
|
toastRef = useToastNotifications();
|
|
717
717
|
return <Text>Test</Text>;
|
|
@@ -790,7 +790,7 @@ describe("ToastNotifications", () => {
|
|
|
790
790
|
|
|
791
791
|
describe("Toast placement rendering", () => {
|
|
792
792
|
it("should render toast with top placement", async () => {
|
|
793
|
-
let toastRef
|
|
793
|
+
let toastRef = null as ToastType | null;
|
|
794
794
|
|
|
795
795
|
const TestComponent = () => {
|
|
796
796
|
const toast = useToastNotifications();
|
|
@@ -817,7 +817,7 @@ describe("ToastNotifications", () => {
|
|
|
817
817
|
});
|
|
818
818
|
|
|
819
819
|
it("should render toast with center placement", async () => {
|
|
820
|
-
let toastRef
|
|
820
|
+
let toastRef = null as ToastType | null;
|
|
821
821
|
|
|
822
822
|
const TestComponent = () => {
|
|
823
823
|
const toast = useToastNotifications();
|
|
@@ -846,7 +846,7 @@ describe("ToastNotifications", () => {
|
|
|
846
846
|
|
|
847
847
|
describe("Toast icon and color variants", () => {
|
|
848
848
|
it("should render success toast with custom icon", async () => {
|
|
849
|
-
let toastRef
|
|
849
|
+
let toastRef = null as ToastType | null;
|
|
850
850
|
|
|
851
851
|
const TestComponent = () => {
|
|
852
852
|
const toast = useToastNotifications();
|
|
@@ -873,7 +873,7 @@ describe("ToastNotifications", () => {
|
|
|
873
873
|
});
|
|
874
874
|
|
|
875
875
|
it("should render danger toast with custom icon", async () => {
|
|
876
|
-
let toastRef
|
|
876
|
+
let toastRef = null as ToastType | null;
|
|
877
877
|
|
|
878
878
|
const TestComponent = () => {
|
|
879
879
|
const toast = useToastNotifications();
|
|
@@ -900,7 +900,7 @@ describe("ToastNotifications", () => {
|
|
|
900
900
|
});
|
|
901
901
|
|
|
902
902
|
it("should render warning toast with custom icon", async () => {
|
|
903
|
-
let toastRef
|
|
903
|
+
let toastRef = null as ToastType | null;
|
|
904
904
|
|
|
905
905
|
const TestComponent = () => {
|
|
906
906
|
const toast = useToastNotifications();
|
|
@@ -969,7 +969,7 @@ describe("ToastNotifications", () => {
|
|
|
969
969
|
|
|
970
970
|
describe("Toast with renderToast custom renderer", () => {
|
|
971
971
|
it("should use renderToast when provided", async () => {
|
|
972
|
-
let toastRef
|
|
972
|
+
let toastRef = null as ToastType | null;
|
|
973
973
|
|
|
974
974
|
const TestComponent = () => {
|
|
975
975
|
const toast = useToastNotifications();
|
|
@@ -999,7 +999,7 @@ describe("ToastNotifications", () => {
|
|
|
999
999
|
|
|
1000
1000
|
describe("Toast with renderType map", () => {
|
|
1001
1001
|
it("should use renderType for matching toast type", async () => {
|
|
1002
|
-
let toastRef
|
|
1002
|
+
let toastRef = null as ToastType | null;
|
|
1003
1003
|
|
|
1004
1004
|
const TestComponent = () => {
|
|
1005
1005
|
const toast = useToastNotifications();
|
|
@@ -1031,7 +1031,7 @@ describe("ToastNotifications", () => {
|
|
|
1031
1031
|
|
|
1032
1032
|
describe("Toast onPress handler", () => {
|
|
1033
1033
|
it("should accept onPress callback on toast", async () => {
|
|
1034
|
-
let toastRef
|
|
1034
|
+
let toastRef = null as ToastType | null;
|
|
1035
1035
|
const onPressMock = mock((_id: string) => {});
|
|
1036
1036
|
|
|
1037
1037
|
const TestComponent = () => {
|
|
@@ -1061,7 +1061,7 @@ describe("ToastNotifications", () => {
|
|
|
1061
1061
|
|
|
1062
1062
|
describe("Toast with swipe enabled", () => {
|
|
1063
1063
|
it("should render toast with swipe enabled (pan responder)", async () => {
|
|
1064
|
-
let toastRef
|
|
1064
|
+
let toastRef = null as ToastType | null;
|
|
1065
1065
|
|
|
1066
1066
|
const TestComponent = () => {
|
|
1067
1067
|
const toast = useToastNotifications();
|
|
@@ -1090,7 +1090,7 @@ describe("ToastNotifications", () => {
|
|
|
1090
1090
|
|
|
1091
1091
|
describe("Toast with zoom-in animation", () => {
|
|
1092
1092
|
it("should render toast with zoom-in animation type", async () => {
|
|
1093
|
-
let toastRef
|
|
1093
|
+
let toastRef = null as ToastType | null;
|
|
1094
1094
|
|
|
1095
1095
|
const TestComponent = () => {
|
|
1096
1096
|
const toast = useToastNotifications();
|
|
@@ -1118,7 +1118,7 @@ describe("ToastNotifications", () => {
|
|
|
1118
1118
|
|
|
1119
1119
|
describe("Toast custom colors", () => {
|
|
1120
1120
|
it("should render toasts with custom colors", async () => {
|
|
1121
|
-
let toastRef
|
|
1121
|
+
let toastRef = null as ToastType | null;
|
|
1122
1122
|
|
|
1123
1123
|
const TestComponent = () => {
|
|
1124
1124
|
const toast = useToastNotifications();
|
|
@@ -1161,7 +1161,7 @@ describe("ToastNotifications", () => {
|
|
|
1161
1161
|
|
|
1162
1162
|
describe("Toast with offsets", () => {
|
|
1163
1163
|
it("should render with custom offsetTop and offsetBottom", async () => {
|
|
1164
|
-
let toastRef
|
|
1164
|
+
let toastRef = null as ToastType | null;
|
|
1165
1165
|
|
|
1166
1166
|
const TestComponent = () => {
|
|
1167
1167
|
const toast = useToastNotifications();
|
|
@@ -1192,7 +1192,7 @@ describe("ToastNotifications", () => {
|
|
|
1192
1192
|
|
|
1193
1193
|
describe("Toast icon override", () => {
|
|
1194
1194
|
it("should use explicit icon over type-specific icon", async () => {
|
|
1195
|
-
let toastRef
|
|
1195
|
+
let toastRef = null as ToastType | null;
|
|
1196
1196
|
|
|
1197
1197
|
const TestComponent = () => {
|
|
1198
1198
|
const toast = useToastNotifications();
|
|
@@ -1231,7 +1231,7 @@ describe("ToastNotifications", () => {
|
|
|
1231
1231
|
it("should auto-close toast after short duration and call onClose", async () => {
|
|
1232
1232
|
const origOS = Platform.OS;
|
|
1233
1233
|
Platform.OS = "web";
|
|
1234
|
-
let toastRef
|
|
1234
|
+
let toastRef = null as ToastType | null;
|
|
1235
1235
|
const onCloseMock = mock(() => {});
|
|
1236
1236
|
|
|
1237
1237
|
const TestComponent = () => {
|
|
@@ -1275,7 +1275,7 @@ describe("ToastNotifications", () => {
|
|
|
1275
1275
|
it("should hide toast when hide() is called (exercises open effect)", async () => {
|
|
1276
1276
|
const origOS = Platform.OS;
|
|
1277
1277
|
Platform.OS = "web";
|
|
1278
|
-
let toastRef
|
|
1278
|
+
let toastRef = null as ToastType | null;
|
|
1279
1279
|
|
|
1280
1280
|
const TestComponent = () => {
|
|
1281
1281
|
const toast = useToastNotifications();
|
|
@@ -1333,7 +1333,7 @@ describe("ToastNotifications", () => {
|
|
|
1333
1333
|
return origCreate(config);
|
|
1334
1334
|
};
|
|
1335
1335
|
|
|
1336
|
-
let toastRef
|
|
1336
|
+
let toastRef = null as ToastType | null;
|
|
1337
1337
|
|
|
1338
1338
|
const TestComponent = () => {
|
|
1339
1339
|
const toast = useToastNotifications();
|
|
@@ -1402,7 +1402,7 @@ describe("ToastNotifications", () => {
|
|
|
1402
1402
|
return origCreate(config);
|
|
1403
1403
|
};
|
|
1404
1404
|
|
|
1405
|
-
let toastRef
|
|
1405
|
+
let toastRef = null as ToastType | null;
|
|
1406
1406
|
|
|
1407
1407
|
const TestComponent = () => {
|
|
1408
1408
|
const toast = useToastNotifications();
|
|
@@ -1458,7 +1458,7 @@ describe("ToastNotifications", () => {
|
|
|
1458
1458
|
return origCreate(config);
|
|
1459
1459
|
};
|
|
1460
1460
|
|
|
1461
|
-
let toastRef
|
|
1461
|
+
let toastRef = null as ToastType | null;
|
|
1462
1462
|
|
|
1463
1463
|
const TestComponent = () => {
|
|
1464
1464
|
const toast = useToastNotifications();
|
|
@@ -1507,7 +1507,7 @@ describe("ToastNotifications", () => {
|
|
|
1507
1507
|
|
|
1508
1508
|
describe("Toast zoom-in animation with swipe", () => {
|
|
1509
1509
|
it("renders toast with both zoom-in and swipe enabled", async () => {
|
|
1510
|
-
let toastRef
|
|
1510
|
+
let toastRef = null as ToastType | null;
|
|
1511
1511
|
|
|
1512
1512
|
const TestComponent = () => {
|
|
1513
1513
|
const toast = useToastNotifications();
|
|
@@ -1544,7 +1544,7 @@ describe("ToastNotifications", () => {
|
|
|
1544
1544
|
|
|
1545
1545
|
describe("Toast onPress interaction", () => {
|
|
1546
1546
|
it("should trigger onPress when pressing the toast", async () => {
|
|
1547
|
-
let toastRef
|
|
1547
|
+
let toastRef = null as ToastType | null;
|
|
1548
1548
|
const onPressMock = mock((_id: string) => {});
|
|
1549
1549
|
|
|
1550
1550
|
const TestComponent = () => {
|
|
@@ -1592,7 +1592,7 @@ describe("ToastNotifications", () => {
|
|
|
1592
1592
|
const {Platform: P} = await import("react-native");
|
|
1593
1593
|
const origOS = P.OS;
|
|
1594
1594
|
P.OS = "web";
|
|
1595
|
-
let toastRef
|
|
1595
|
+
let toastRef = null as ToastType | null;
|
|
1596
1596
|
|
|
1597
1597
|
const TestComponent = () => {
|
|
1598
1598
|
const toast = useToastNotifications();
|
|
@@ -1643,7 +1643,7 @@ describe("ToastNotifications", () => {
|
|
|
1643
1643
|
it("exercises dimension change via Dimensions event", async () => {
|
|
1644
1644
|
const rn = await import("react-native");
|
|
1645
1645
|
const Dims = rn.Dimensions;
|
|
1646
|
-
let toastRef
|
|
1646
|
+
let toastRef = null as ToastType | null;
|
|
1647
1647
|
|
|
1648
1648
|
const TestComponent = () => {
|
|
1649
1649
|
const toast = useToastNotifications();
|
|
@@ -1669,9 +1669,12 @@ describe("ToastNotifications", () => {
|
|
|
1669
1669
|
|
|
1670
1670
|
// Capture the original addEventListener to spy on it
|
|
1671
1671
|
// Instead, we'll spy on the subscription by monkey-patching Dimensions
|
|
1672
|
-
const listeners: Array<(data: {window:
|
|
1672
|
+
const listeners: Array<(data: {window: ScaledSize}) => void> = [];
|
|
1673
1673
|
const origAddEventListener = Dims.addEventListener.bind(Dims);
|
|
1674
|
-
const patchedAdd = (
|
|
1674
|
+
const patchedAdd = (
|
|
1675
|
+
event: Parameters<typeof Dims.addEventListener>[0],
|
|
1676
|
+
handler: (data: {window: ScaledSize}) => void
|
|
1677
|
+
) => {
|
|
1675
1678
|
if (event === "change") {
|
|
1676
1679
|
listeners.push(handler);
|
|
1677
1680
|
}
|
|
@@ -1695,7 +1698,7 @@ describe("ToastNotifications", () => {
|
|
|
1695
1698
|
await act(async () => {
|
|
1696
1699
|
for (const listener of listeners) {
|
|
1697
1700
|
listener({
|
|
1698
|
-
window: {fontScale: 1, height: 900, scale: 1, width: 500} as
|
|
1701
|
+
window: {fontScale: 1, height: 900, scale: 1, width: 500} as ScaledSize,
|
|
1699
1702
|
});
|
|
1700
1703
|
}
|
|
1701
1704
|
});
|
|
@@ -1718,7 +1721,7 @@ describe("ToastNotifications", () => {
|
|
|
1718
1721
|
return originalCreate.call(PanResponder, config);
|
|
1719
1722
|
};
|
|
1720
1723
|
|
|
1721
|
-
let toastRef
|
|
1724
|
+
let toastRef = null as ToastType | null;
|
|
1722
1725
|
const TestComponent = () => {
|
|
1723
1726
|
const toast = useToastNotifications();
|
|
1724
1727
|
toastRef = toast;
|
|
@@ -1792,7 +1795,7 @@ describe("ToastNotifications", () => {
|
|
|
1792
1795
|
return originalCreate.call(PanResponder, config);
|
|
1793
1796
|
};
|
|
1794
1797
|
|
|
1795
|
-
let toastRef
|
|
1798
|
+
let toastRef = null as ToastType | null;
|
|
1796
1799
|
const TestComponent = () => {
|
|
1797
1800
|
const toast = useToastNotifications();
|
|
1798
1801
|
toastRef = toast;
|
|
@@ -1840,7 +1843,7 @@ describe("ToastNotifications", () => {
|
|
|
1840
1843
|
return originalCreate.call(PanResponder, config);
|
|
1841
1844
|
};
|
|
1842
1845
|
|
|
1843
|
-
let toastRef
|
|
1846
|
+
let toastRef = null as ToastType | null;
|
|
1844
1847
|
const TestComponent = () => {
|
|
1845
1848
|
const toast = useToastNotifications();
|
|
1846
1849
|
toastRef = toast;
|
|
@@ -1882,7 +1885,7 @@ describe("ToastNotifications", () => {
|
|
|
1882
1885
|
|
|
1883
1886
|
describe("Toast lifecycle and auto-close", () => {
|
|
1884
1887
|
it("should auto-close toast after duration expires", async () => {
|
|
1885
|
-
let toastRef
|
|
1888
|
+
let toastRef = null as ToastType | null;
|
|
1886
1889
|
|
|
1887
1890
|
const TestComponent = () => {
|
|
1888
1891
|
const toast = useToastNotifications();
|
|
@@ -1916,7 +1919,7 @@ describe("ToastNotifications", () => {
|
|
|
1916
1919
|
});
|
|
1917
1920
|
|
|
1918
1921
|
it("should trigger handleClose when hiding a toast", async () => {
|
|
1919
|
-
let toastRef
|
|
1922
|
+
let toastRef = null as ToastType | null;
|
|
1920
1923
|
|
|
1921
1924
|
const TestComponent = () => {
|
|
1922
1925
|
const toast = useToastNotifications();
|
|
@@ -1954,7 +1957,7 @@ describe("ToastNotifications", () => {
|
|
|
1954
1957
|
});
|
|
1955
1958
|
|
|
1956
1959
|
it("should auto-destroy toast after animation completes", async () => {
|
|
1957
|
-
let toastRef
|
|
1960
|
+
let toastRef = null as ToastType | null;
|
|
1958
1961
|
const onCloseMock = mock(() => {});
|
|
1959
1962
|
|
|
1960
1963
|
const TestComponent = () => {
|
|
@@ -1993,7 +1996,7 @@ describe("ToastNotifications", () => {
|
|
|
1993
1996
|
|
|
1994
1997
|
describe("Toast swipe gestures", () => {
|
|
1995
1998
|
it("should render swipe-enabled toast and handle pan gestures", async () => {
|
|
1996
|
-
let toastRef
|
|
1999
|
+
let toastRef = null as ToastType | null;
|
|
1997
2000
|
|
|
1998
2001
|
const TestComponent = () => {
|
|
1999
2002
|
const toast = useToastNotifications();
|
|
@@ -2023,7 +2026,7 @@ describe("ToastNotifications", () => {
|
|
|
2023
2026
|
|
|
2024
2027
|
describe("Toast animation types", () => {
|
|
2025
2028
|
it("should show toast with zoom-in animation", async () => {
|
|
2026
|
-
let toastRef
|
|
2029
|
+
let toastRef = null as ToastType | null;
|
|
2027
2030
|
|
|
2028
2031
|
const TestComponent = () => {
|
|
2029
2032
|
const toast = useToastNotifications();
|
|
@@ -2051,7 +2054,7 @@ describe("ToastNotifications", () => {
|
|
|
2051
2054
|
});
|
|
2052
2055
|
|
|
2053
2056
|
it("should show toast with bottom placement and slide-in", async () => {
|
|
2054
|
-
let toastRef
|
|
2057
|
+
let toastRef = null as ToastType | null;
|
|
2055
2058
|
|
|
2056
2059
|
const TestComponent = () => {
|
|
2057
2060
|
const toast = useToastNotifications();
|
|
@@ -2081,7 +2084,7 @@ describe("ToastNotifications", () => {
|
|
|
2081
2084
|
|
|
2082
2085
|
describe("Toast renderType and renderToast", () => {
|
|
2083
2086
|
it("should render custom toast via renderType", async () => {
|
|
2084
|
-
let toastRef
|
|
2087
|
+
let toastRef = null as ToastType | null;
|
|
2085
2088
|
|
|
2086
2089
|
const TestComponent = () => {
|
|
2087
2090
|
const toast = useToastNotifications();
|
|
@@ -2113,7 +2116,7 @@ describe("ToastNotifications", () => {
|
|
|
2113
2116
|
});
|
|
2114
2117
|
|
|
2115
2118
|
it("should render custom toast via renderToast", async () => {
|
|
2116
|
-
let toastRef
|
|
2119
|
+
let toastRef = null as ToastType | null;
|
|
2117
2120
|
|
|
2118
2121
|
const TestComponent = () => {
|
|
2119
2122
|
const toast = useToastNotifications();
|
|
@@ -2146,7 +2149,7 @@ describe("ToastNotifications", () => {
|
|
|
2146
2149
|
|
|
2147
2150
|
describe("Toast onPress", () => {
|
|
2148
2151
|
it("should call onPress when toast is pressed", async () => {
|
|
2149
|
-
let toastRef
|
|
2152
|
+
let toastRef = null as ToastType | null;
|
|
2150
2153
|
const onPressMock = mock((_id: string) => {});
|
|
2151
2154
|
|
|
2152
2155
|
const TestComponent = () => {
|
|
@@ -2177,7 +2180,7 @@ describe("ToastNotifications", () => {
|
|
|
2177
2180
|
|
|
2178
2181
|
describe("Toast custom colors", () => {
|
|
2179
2182
|
it("should render with custom success/danger/warning/normal colors", async () => {
|
|
2180
|
-
let toastRef
|
|
2183
|
+
let toastRef = null as ToastType | null;
|
|
2181
2184
|
|
|
2182
2185
|
const TestComponent = () => {
|
|
2183
2186
|
const toast = useToastNotifications();
|
|
@@ -2213,7 +2216,7 @@ describe("ToastNotifications", () => {
|
|
|
2213
2216
|
|
|
2214
2217
|
describe("center placement toast rendering", () => {
|
|
2215
2218
|
it("should fully render center toast content including filter and map callbacks", async () => {
|
|
2216
|
-
let toastRef
|
|
2219
|
+
let toastRef = null as ToastType | null;
|
|
2217
2220
|
const TestComponent = () => {
|
|
2218
2221
|
const toast = useToastNotifications();
|
|
2219
2222
|
toastRef = toast;
|
|
@@ -2245,7 +2248,7 @@ describe("ToastNotifications", () => {
|
|
|
2245
2248
|
});
|
|
2246
2249
|
|
|
2247
2250
|
it("should render multiple center toasts through filter and map", async () => {
|
|
2248
|
-
let toastRef
|
|
2251
|
+
let toastRef = null as ToastType | null;
|
|
2249
2252
|
const TestComponent = () => {
|
|
2250
2253
|
const toast = useToastNotifications();
|
|
2251
2254
|
toastRef = toast;
|
|
@@ -2289,7 +2292,7 @@ describe("ToastNotifications", () => {
|
|
|
2289
2292
|
|
|
2290
2293
|
describe("auto-close timer callback", () => {
|
|
2291
2294
|
it("should fire the setTimeout callback that calls handleClose", async () => {
|
|
2292
|
-
let toastRef
|
|
2295
|
+
let toastRef = null as ToastType | null;
|
|
2293
2296
|
const onCloseMock = mock(() => {});
|
|
2294
2297
|
|
|
2295
2298
|
const TestComponent = () => {
|
|
@@ -2327,7 +2330,7 @@ describe("ToastNotifications", () => {
|
|
|
2327
2330
|
|
|
2328
2331
|
describe("onHide callback on toast props", () => {
|
|
2329
2332
|
it("should exercise the onHide function via renderToast", async () => {
|
|
2330
|
-
let toastRef
|
|
2333
|
+
let toastRef = null as ToastType | null;
|
|
2331
2334
|
let capturedOnHide: (() => void) | null = null;
|
|
2332
2335
|
|
|
2333
2336
|
const customRenderToast = (toast: ToastProps) => {
|
|
@@ -2382,7 +2385,7 @@ describe("ToastNotifications", () => {
|
|
|
2382
2385
|
|
|
2383
2386
|
describe("update map callback with toast in state", () => {
|
|
2384
2387
|
it("should invoke the map callback inside update when toasts exist", async () => {
|
|
2385
|
-
let toastRef
|
|
2388
|
+
let toastRef = null as ToastType | null;
|
|
2386
2389
|
|
|
2387
2390
|
const TestComponent = () => {
|
|
2388
2391
|
const toast = useToastNotifications();
|
|
@@ -54,6 +54,7 @@ import {
|
|
|
54
54
|
type TextStyle,
|
|
55
55
|
TouchableWithoutFeedback,
|
|
56
56
|
View,
|
|
57
|
+
type ViewInstance,
|
|
57
58
|
type ViewStyle,
|
|
58
59
|
} from "react-native";
|
|
59
60
|
import type {ToastProps as TerrenoToastPayload} from "./Common";
|
|
@@ -224,7 +225,7 @@ const ToastItem: FC<ToastProps> = (props) => {
|
|
|
224
225
|
onPress,
|
|
225
226
|
} = props;
|
|
226
227
|
|
|
227
|
-
const containerRef = useRef<
|
|
228
|
+
const containerRef = useRef<ViewInstance>(null);
|
|
228
229
|
const [animation] = useState(new Animated.Value(0));
|
|
229
230
|
const panResponderRef = useRef<PanResponderInstance | undefined>(undefined);
|
|
230
231
|
const panResponderAnimRef = useRef<Animated.ValueXY | undefined>(undefined);
|
|
@@ -394,7 +395,7 @@ const ToastItem: FC<ToastProps> = (props) => {
|
|
|
394
395
|
|
|
395
396
|
const animationStyle = {
|
|
396
397
|
opacity: animation,
|
|
397
|
-
transform: baseTransform as Animated.
|
|
398
|
+
transform: baseTransform as Animated.WithAnimatedValue<ViewStyle>["transform"],
|
|
398
399
|
};
|
|
399
400
|
|
|
400
401
|
return (
|
|
@@ -103,7 +103,10 @@ const restoreDocument = (): void => {
|
|
|
103
103
|
};
|
|
104
104
|
|
|
105
105
|
const flattenStyle = (style: unknown): {pointerEvents?: string; zIndex?: number} => {
|
|
106
|
-
return StyleSheet.flatten(style
|
|
106
|
+
return StyleSheet.flatten(style as Parameters<typeof StyleSheet.flatten>[0]) as {
|
|
107
|
+
pointerEvents?: string;
|
|
108
|
+
zIndex?: number;
|
|
109
|
+
};
|
|
107
110
|
};
|
|
108
111
|
|
|
109
112
|
const portalContainerFor = (node: ReactTestInstance): unknown => {
|
|
@@ -150,8 +153,8 @@ beforeAll(() => {
|
|
|
150
153
|
global.requestAnimationFrame = (callback: FrameRequestCallback) => {
|
|
151
154
|
return setTimeout(() => callback(Date.now()), 0) as unknown as number;
|
|
152
155
|
};
|
|
153
|
-
global.cancelAnimationFrame = (id: number) => {
|
|
154
|
-
clearTimeout(id);
|
|
156
|
+
global.cancelAnimationFrame = (id: number | null | undefined) => {
|
|
157
|
+
clearTimeout(id ?? undefined);
|
|
155
158
|
};
|
|
156
159
|
});
|
|
157
160
|
|
package/src/Tooltip.test.tsx
CHANGED
|
@@ -34,8 +34,8 @@ beforeAll(() => {
|
|
|
34
34
|
globalThis.requestAnimationFrame = (callback: FrameRequestCallback) => {
|
|
35
35
|
return setTimeout(() => callback(Date.now()), 0) as unknown as number;
|
|
36
36
|
};
|
|
37
|
-
globalThis.cancelAnimationFrame = (id: number) => {
|
|
38
|
-
clearTimeout(id);
|
|
37
|
+
globalThis.cancelAnimationFrame = (id: number | null | undefined) => {
|
|
38
|
+
clearTimeout(id ?? undefined);
|
|
39
39
|
};
|
|
40
40
|
});
|
|
41
41
|
|
|
@@ -299,7 +299,7 @@ describe("Tooltip", () => {
|
|
|
299
299
|
const {StyleSheet, View: ViewComp} = await import("react-native");
|
|
300
300
|
const findPlacementStyle = () => {
|
|
301
301
|
const positioned = UNSAFE_getAllByType(ViewComp).find(
|
|
302
|
-
(node
|
|
302
|
+
(node) =>
|
|
303
303
|
Boolean(node.props.onLayout) &&
|
|
304
304
|
StyleSheet.flatten(node.props.style)?.position === "absolute"
|
|
305
305
|
);
|
package/src/Tooltip.tsx
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
Platform,
|
|
7
7
|
Pressable,
|
|
8
8
|
View,
|
|
9
|
+
type ViewInstance,
|
|
9
10
|
type ViewStyle,
|
|
10
11
|
} from "react-native";
|
|
11
12
|
|
|
@@ -220,7 +221,7 @@ export const Tooltip: FC<TooltipProps> = ({text, children, idealPosition, includ
|
|
|
220
221
|
|
|
221
222
|
const showTooltipTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
|
|
222
223
|
const hideTooltipTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
|
|
223
|
-
const childrenWrapperRef = useRef<
|
|
224
|
+
const childrenWrapperRef = useRef<ViewInstance>(null);
|
|
224
225
|
const touched = useRef(false);
|
|
225
226
|
// Bumped on every hide so async measure callbacks from an earlier show are ignored.
|
|
226
227
|
const showGeneration = useRef(0);
|