@hero-design/rn 8.112.5 → 8.113.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +3 -3
- package/CHANGELOG.md +21 -0
- package/assets/fonts/hero-icons-mobile.ttf +0 -0
- package/es/index.js +1593 -2010
- package/jest.config.js +1 -1
- package/lib/assets/fonts/hero-icons-mobile.ttf +0 -0
- package/lib/index.js +1592 -2009
- package/package.json +5 -5
- package/src/components/Alert/index.tsx +1 -1
- package/src/components/Badge/Count.tsx +2 -2
- package/src/components/Badge/Status.tsx +2 -2
- package/src/components/Badge/index.tsx +2 -1
- package/src/components/BottomNavigation/StyledBottomNavigation.tsx +1 -1
- package/src/components/BottomNavigation/__tests__/__snapshots__/index.spec.tsx.snap +32 -36
- package/src/components/BottomNavigation/__tests__/index.spec.tsx +17 -8
- package/src/components/BottomNavigation/index.tsx +4 -5
- package/src/components/BottomSheet/ScrollView.tsx +2 -1
- package/src/components/BottomSheet/index.tsx +1 -1
- package/src/components/Button/Button.tsx +2 -2
- package/src/components/Calendar/CalendarRange.tsx +1 -1
- package/src/components/Calendar/__tests__/index.spec.tsx +3 -8
- package/src/components/Calendar/index.tsx +1 -1
- package/src/components/Card/DataCard/index.tsx +2 -2
- package/src/components/Card/index.tsx +2 -2
- package/src/components/Carousel/index.tsx +2 -2
- package/src/components/DatePicker/Dialog/__tests__/IOSDialog.spec.tsx +0 -6
- package/src/components/DatePicker/__tests__/DatePickerCalendar.spec.tsx +2 -10
- package/src/components/DatePicker/__tests__/DatePickerIOS.spec.tsx +27 -0
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +176 -728
- package/src/components/DatePicker/hooks/__tests__/useFormatDate.spec.ts +5 -7
- package/src/components/DatePicker/hooks/useFormatDate.ts +1 -1
- package/src/components/DatePicker/types.ts +1 -1
- package/src/components/Drawer/DragableDrawer/index.tsx +2 -2
- package/src/components/Drawer/index.tsx +2 -2
- package/src/components/FAB/__tests__/index.spec.tsx +33 -8
- package/src/components/Icon/HeroIcon/glyphMap.json +1 -1
- package/src/components/Icon/IconList.ts +1 -0
- package/src/components/Image/index.tsx +2 -1
- package/src/components/List/BasicListItem.tsx +2 -1
- package/src/components/List/ListItem.tsx +1 -1
- package/src/components/LocaleProvider/__tests__/utils.specs.ts +2 -1
- package/src/components/LocaleProvider/index.tsx +1 -1
- package/src/components/LocaleProvider/utils.ts +3 -2
- package/src/components/MapPin/Focussed.tsx +2 -1
- package/src/components/MapPin/index.tsx +2 -1
- package/src/components/Modal/__tests__/index.spec.tsx +46 -0
- package/src/components/Modal/index.tsx +121 -149
- package/src/components/Progress/ProgressBar.tsx +2 -1
- package/src/components/Progress/ProgressCircle.tsx +2 -1
- package/src/components/RichTextEditor/MentionList.tsx +2 -1
- package/src/components/Tabs/ScrollableTabsHeader/ScrollableTabsHeader.tsx +4 -6
- package/src/components/Tabs/__tests__/ScrollableTabs.spec.tsx +43 -32
- package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabs.spec.tsx.snap +105 -129
- package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabsHeader.spec.tsx.snap +30 -42
- package/src/components/Tabs/__tests__/__snapshots__/index.spec.tsx.snap +0 -683
- package/src/components/Tabs/__tests__/index.spec.tsx +37 -25
- package/src/components/Tabs/index.tsx +2 -2
- package/src/components/Tag/index.tsx +1 -1
- package/src/components/TimePicker/TimePickerAndroid.tsx +1 -1
- package/src/components/TimePicker/TimePickerIOS.tsx +1 -1
- package/src/components/TimePicker/__tests__/TimePickerIOS.spec.tsx +0 -6
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +237 -282
- package/src/components/TimePicker/types.ts +1 -1
- package/src/components/Toast/Toast.tsx +2 -1
- package/src/components/Toolbar/ToolbarItem.tsx +2 -1
- package/src/components/Typography/Label/index.tsx +1 -1
- package/src/testHelpers/renderWithTheme.tsx +2 -1
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +1 -1
- package/src/theme/components/bottomNavigation.ts +1 -1
- package/types/components/Alert/index.d.ts +1 -1
- package/types/components/Badge/Count.d.ts +2 -2
- package/types/components/Badge/Status.d.ts +2 -2
- package/types/components/Badge/index.d.ts +4 -3
- package/types/components/BottomNavigation/StyledBottomNavigation.d.ts +1 -1
- package/types/components/BottomNavigation/index.d.ts +2 -2
- package/types/components/BottomSheet/index.d.ts +1 -1
- package/types/components/Button/Button.d.ts +2 -2
- package/types/components/Card/DataCard/index.d.ts +2 -2
- package/types/components/Card/index.d.ts +3 -3
- package/types/components/Carousel/index.d.ts +2 -2
- package/types/components/DatePicker/types.d.ts +1 -1
- package/types/components/Drawer/DragableDrawer/index.d.ts +2 -2
- package/types/components/Drawer/index.d.ts +3 -3
- package/types/components/Icon/IconList.d.ts +1 -1
- package/types/components/Icon/index.d.ts +1 -1
- package/types/components/Image/index.d.ts +2 -1
- package/types/components/List/BasicListItem.d.ts +2 -1
- package/types/components/List/ListItem.d.ts +1 -1
- package/types/components/LocaleProvider/utils.d.ts +1 -1
- package/types/components/MapPin/Focussed.d.ts +2 -1
- package/types/components/MapPin/index.d.ts +3 -2
- package/types/components/Modal/index.d.ts +2 -2
- package/types/components/Progress/ProgressBar.d.ts +2 -1
- package/types/components/Progress/ProgressCircle.d.ts +2 -1
- package/types/components/Progress/index.d.ts +2 -2
- package/types/components/RichTextEditor/MentionList.d.ts +2 -1
- package/types/components/Tabs/index.d.ts +2 -2
- package/types/components/Tag/index.d.ts +1 -1
- package/types/components/TextInput/index.d.ts +1 -1
- package/types/components/TimePicker/types.d.ts +1 -1
- package/types/components/Toast/Toast.d.ts +2 -1
- package/types/components/Typography/Label/index.d.ts +1 -1
- package/types/testHelpers/renderWithTheme.d.ts +84 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { renderHook } from '@testing-library/react-hooks';
|
|
2
|
-
import
|
|
2
|
+
import formatDate from 'date-fns/fp/format';
|
|
3
3
|
import useFormatDate from '../useFormatDate';
|
|
4
4
|
import { useDateTimeFormat } from '../../../LocaleProvider/hooks';
|
|
5
5
|
|
|
@@ -8,12 +8,10 @@ jest.mock('../../../LocaleProvider/hooks', () => ({
|
|
|
8
8
|
useDateTimeFormat: jest.fn(),
|
|
9
9
|
}));
|
|
10
10
|
|
|
11
|
-
jest.mock('date-fns/fp', () => {
|
|
12
|
-
return {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}),
|
|
16
|
-
};
|
|
11
|
+
jest.mock('date-fns/fp/format', () => {
|
|
12
|
+
return jest.fn((format, date) => {
|
|
13
|
+
return `Formatted: ${format}, Date: ${date.toISOString()}`;
|
|
14
|
+
});
|
|
17
15
|
});
|
|
18
16
|
|
|
19
17
|
describe('useFormatDate', () => {
|
|
@@ -43,7 +43,7 @@ export interface DatePickerProps {
|
|
|
43
43
|
confirmLabel: string;
|
|
44
44
|
/**
|
|
45
45
|
* Date format. Default format is dd/MM/yyyy.
|
|
46
|
-
* Following date-fns's format (https://date-fns.org/
|
|
46
|
+
* Following date-fns's format (https://date-fns.org/v2.16.1/docs/format).
|
|
47
47
|
*/
|
|
48
48
|
displayFormat?: string;
|
|
49
49
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { Animated, PanResponder, Easing, Platform } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import type { ReactNode } from 'react';
|
|
4
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
5
5
|
import {
|
|
6
6
|
StyledDragableContainer,
|
|
7
7
|
StyledDragableDrawerContainer,
|
|
@@ -54,7 +54,7 @@ const DragableDrawer = ({
|
|
|
54
54
|
onExpanded,
|
|
55
55
|
onCollapsed,
|
|
56
56
|
testID,
|
|
57
|
-
}: DragableDrawerProps):
|
|
57
|
+
}: DragableDrawerProps): ReactElement => {
|
|
58
58
|
const [height, setHeight] = useState(0);
|
|
59
59
|
const baseHeightForMeasure = useRef(0);
|
|
60
60
|
const snapPointsData = useRef<SnapPointsData>({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import React, { useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { Animated, Dimensions, Easing } from 'react-native';
|
|
4
4
|
import DragableDrawer from './DragableDrawer';
|
|
@@ -40,7 +40,7 @@ const Drawer = ({
|
|
|
40
40
|
hasBackdrop = true,
|
|
41
41
|
onDismiss,
|
|
42
42
|
testID,
|
|
43
|
-
}: DrawerProps):
|
|
43
|
+
}: DrawerProps): ReactElement => {
|
|
44
44
|
const animatedValue = useRef(new Animated.Value(visible ? 1 : 0)).current;
|
|
45
45
|
const [height, setHeight] = useState(Dimensions.get('window').height);
|
|
46
46
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { createRef } from 'react';
|
|
2
|
-
import { fireEvent } from '@testing-library/react-native';
|
|
2
|
+
import { act, fireEvent, waitFor } from '@testing-library/react-native';
|
|
3
3
|
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
4
4
|
import type { FABHandles } from '../../../index';
|
|
5
5
|
import { theme } from '../../../index';
|
|
@@ -69,7 +69,7 @@ describe('FAB', () => {
|
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
describe('usage with ref', () => {
|
|
72
|
-
it('allow controlling inner fab states by ref', () => {
|
|
72
|
+
it('allow controlling inner fab states by ref', async () => {
|
|
73
73
|
const fabRef = createRef<FABHandles>();
|
|
74
74
|
|
|
75
75
|
const { queryByText } = renderWithTheme(
|
|
@@ -77,14 +77,39 @@ describe('FAB', () => {
|
|
|
77
77
|
);
|
|
78
78
|
|
|
79
79
|
expect(queryByText('Shout out')).toBeDefined();
|
|
80
|
-
fabRef.current!.collapse();
|
|
81
|
-
expect(queryByText('Shout out')).toBeFalsy();
|
|
82
80
|
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
act(() => {
|
|
82
|
+
fabRef.current!.collapse();
|
|
83
|
+
});
|
|
85
84
|
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
await waitFor(
|
|
86
|
+
() => {
|
|
87
|
+
expect(queryByText('Shout out')).toBeFalsy();
|
|
88
|
+
},
|
|
89
|
+
{ timeout: 1000 }
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
act(() => {
|
|
93
|
+
fabRef.current!.show();
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
await waitFor(
|
|
97
|
+
() => {
|
|
98
|
+
expect(queryByText('Shout out')).toBeDefined();
|
|
99
|
+
},
|
|
100
|
+
{ timeout: 1000 }
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
act(() => {
|
|
104
|
+
fabRef.current!.hide();
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
await waitFor(
|
|
108
|
+
() => {
|
|
109
|
+
expect(queryByText('Shout out')).toBeDefined();
|
|
110
|
+
},
|
|
111
|
+
{ timeout: 1000 }
|
|
112
|
+
);
|
|
88
113
|
});
|
|
89
114
|
});
|
|
90
115
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"activate":59000,"add-emoji":59001,"add-person":59002,"adjustment":59003,"alignment":59004,"antenna":59005,"archive":59006,"assignment-warning":59007,"bank":59008,"bell":59009,"billing":59010,"bolt":59011,"bookmark-added":59012,"bookmark-checked":59013,"bookmark":59014,"box-check":59015,"box":59016,"bpay":59017,"buildings":59018,"cake":59019,"calendar-clock":59020,"calendar":59021,"candy-box-menu":59022,"caret-down-small":59023,"caret-down":59024,"caret-left-small":59025,"caret-left":59026,"caret-right-small":59027,"caret-right":59028,"caret-up-small":59029,"caret-up":59030,"check-radio":59031,"circle-add":59032,"circle-cancel":59033,"circle-check":59034,"circle-down":59035,"circle-info":59036,"circle-left":59037,"circle-ok":59038,"circle-pencil":59039,"circle-question":59040,"circle-remove":59041,"circle-right":59042,"circle-up":59043,"circle-warning":59044,"clock-3":59045,"clock":59046,"cloud-download":59047,"cloud-upload":59048,"cog":59049,"coin":59050,"contacts":59051,"credit-card":59052,"diamond":59053,"direction-arrows":59054,"directory":59055,"document":59056,"dollar-coin-shine":59057,"dot":59058,"double-buildings":59059,"edit-template":59060,"envelope":59061,"exclude":59062,"expand-content":59063,"expense":59064,"explore_nearby":59065,"eye-circle":59066,"eye-invisible":59067,"eye":59068,"face-meh":59069,"face-sad":59070,"face-smiley":59071,"feed":59072,"feedbacks":59073,"file-certified":59074,"file-clone":59075,"file-copy":59076,"file-csv":59077,"file-dispose":59078,"file-doc":59079,"file-excel":59080,"file-export":59081,"file-lock":59082,"file-pdf":59083,"file-powerpoint":59084,"file-search":59085,"file-secured":59086,"file-sheets":59087,"file-slide":59088,"file-verified":59089,"file-word":59090,"file":59091,"filter":59092,"folder-user":59093,"folder":59094,"format-bold":59095,"format-heading1":59096,"format-heading2":59097,"format-italic":59098,"format-list-bulleted":59099,"format-list-numbered":59100,"format-underlined":59101,"funnel-filter":59102,"global-dollar":59103,"global-pound":59104,"globe":59105,"graduation-cap":59106,"graph":59107,"happy-sun":59108,"health-bag":59109,"heart":59110,"hero-points":59111,"home":59112,"image":59113,"import":59114,"incident-siren":59115,"instapay-daily":59116,"instapay-now":59117,"instapay":59118,"list":59119,"loading-2":59120,"loading":59121,"location-on":59122,"location":59123,"lock":59124,"looks-one":59125,"looks-two":59126,"media-content":59127,"menu":59128,"money-notes":59129,"moneybag":59130,"moon":59131,"multiple-stars":59132,"multiple-users":59133,"near-me":59134,"node":59135,"open-folder":59136,"paperclip-vertical":59137,"paperclip":59138,"payment-summary":59139,"pencil":59140,"phone":59141,"piggy-bank":59142,"plane-up":59143,"plane":59144,"play-arrow":59145,"play-circle":59146,"pound-coin-shine":59147,"pound-sign":59148,"print":59149,"raising-hands":59150,"reply-arrow":59151,"reply":59152,"reschedule":59153,"rostering":59154,"salary-sacrifice":59155,"save":59156,"schedule-send":59157,"schedule":59158,"search-person":59159,"search":59160,"send":59161,"speaker-active":59162,"speaker":59163,"star-award":59164,"star-badge":59165,"star-circle":59166,"star-medal":59167,"star":59168,"steps-circle":59169,"stopwatch":59170,"suitcase":59171,"surfing":59172,"survey":59173,"swag-pillar-benefit":59174,"swag-pillar-career":59175,"swag-pillar-money":59176,"swag-pillar-work":59177,"swag":59178,"swipe-right":59179,"switch":59180,"tag":59181,"target":59182,"teams":59183,"thumb-down":59184,"thumb-up":59185,"timesheet":59186,"touch-id":59187,"trash-bin":59188,"unlock":59189,"user":59190,"video-1":59191,"video-2":59192,"wallet":59193,"warning":59194,"academic-hat-outlined":59195,"accommodation-outlined":59196,"activate-outlined":59197,"add-credit-card-outlined":59198,"add-person-outlined":59199,"add-section-outlined":59200,"add-time-outlined":59201,"add":59202,"adjustment-outlined":59203,"afternoon-outlined":59204,"ai-outlined":59205,"alignment-2-outlined":59206,"alignment-outlined":59207,"all-caps":59208,"application-outlined":59209,"arrow-down":59210,"arrow-downwards":59211,"arrow-left":59212,"arrow-leftwards":59213,"arrow-right":59214,"arrow-rightwards":59215,"arrow-up":59216,"arrow-upwards":59217,"article-outlined":59218,"at-sign":59219,"auto-graph-outlined":59220,"automotive-outlined":59221,"bakery-outlined":59222,"bar-outlined":59223,"beauty-outlined":59224,"beer-outlined":59225,"bell-active-outlined":59226,"bell-outlined":59227,"bell-slash-outlined":59228,"bill-management-outlined":59229,"billing-outlined":59230,"body-outlined":59231,"bold":59232,"bolt-outlined":59233,"book-outlined":59234,"bookmark-added-outlined":59235,"bookmark-checked-outlined":59236,"bookmark-outlined":59237,"box-1-outlined":59238,"box-check-outlined":59239,"box-outlined":59240,"bullet-points":59241,"cake-outlined":59242,"calculator-outlined":59243,"calendar-dates-outlined":59244,"calendar-star-outlined":59245,"call-outlined":59246,"call-split-outlined":59247,"camera-outlined":59248,"cancel":59249,"car-forward-outlined":59250,"cashback-outlined":59251,"charging-station-outlined":59252,"chat-bubble-outlined":59253,"chat-unread-outlined":59254,"checkmark":59255,"circle-add-outlined":59256,"circle-cancel-outlined":59257,"circle-down-outlined":59258,"circle-info-outlined":59259,"circle-left-outlined":59260,"circle-ok-outlined":59261,"circle-question-outlined":59262,"circle-remove-outlined":59263,"circle-right-outlined":59264,"circle-up-outlined":59265,"circle-warning-outlined":59266,"clock-2-outlined":59267,"clock-in-outlined":59268,"clock-out-outlined":59269,"clock-outlined":59270,"cog-outlined":59271,"coin-outlined":59272,"coin-super-outlined":59273,"comment-outlined":59274,"contacts-outlined":59275,"contacts-user-outlined":59276,"credit-card-outlined":59277,"cultural-site-outlined":59278,"cup-outlined":59279,"dentistry-outlined":59280,"direction-arrows-outlined":59281,"directory-outlined":59282,"document-outlined":59283,"dollar-box-outlined":59284,"dollar-card-outlined":59285,"dollar-coin-shine-outlined":59286,"dollar-credit-card-outlined":59287,"dollar-sign":59288,"double-buildings-outlined":59289,"double-left-arrows":59290,"double-right-arrows":59291,"download-box-outlined":59292,"download-outlined":59293,"edit-template-outlined":59294,"electronics-outlined":59295,"email-outlined":59296,"end-break-outlined":59297,"enter-arrow":59298,"entertainment-outlined":59299,"envelope-outlined":59300,"evening-outlined":59301,"expense-approval-outlined":59302,"expense-outlined":59303,"explore-outlined":59304,"extension-outlined":59305,"external-link":59306,"eye-invisible-outlined":59307,"eye-outlined":59308,"face-id":59309,"face-meh-outlined":59310,"face-open-smiley-outlined":59311,"face-sad-outlined":59312,"face-smiley-outlined":59313,"fastfood-outlined":59314,"feed-outlined":59315,"file-certified-outlined":59316,"file-clone-outlined":59317,"file-copy-outlined":59318,"file-dispose-outlined":59319,"file-dollar-certified-outlined":59320,"file-dollar-outlined":59321,"file-download-outlined":59322,"file-export-outlined":59323,"file-lock-outlined":59324,"file-outlined":59325,"file-pound-outlined":59326,"file-search-outlined":59327,"file-secured-outlined":59328,"file-statutory-outlined":59329,"file-verified-outlined":59330,"filter-outlined":59331,"fitness-outlined":59332,"folder-outlined":59333,"folder-upload-outlined":59334,"folder-user-outlined":59335,"form-outlined":59336,"funnel-filter-outline":59337,"goal-outlined":59338,"graph-outlined":59339,"grocery-outlined":59340,"hand-holding-user-outlined":59341,"handshake-outlined":59342,"happy-sun-outlined":59343,"health-bag-outlined":59344,"heart-outlined":59345,"home-active-outlined":59346,"home-outlined":59347,"id-card-outlined":59348,"image-outlined":59349,"import-outlined":59350,"instapay-outlined":59351,"italic":59352,"job-search-outlined":59353,"leave-approval-outlined":59354,"link-1":59355,"link-2":59356,"list-outlined":59357,"live-help-outlined":59358,"local_mall_outlined":59359,"location-on-outlined":59360,"location-outlined":59361,"lock-outlined":59362,"locked-file-outlined":59363,"log-out":59364,"mail-outlined":59365,"map-outlined":59366,"media-content-outlined":59367,"menu-close":59368,"menu-expand":59369,"menu-fold-outlined":59370,"menu-unfold-outlined":59371,"moneybag-outlined":59372,"moon-outlined":59373,"more-horizontal":59374,"more-vertical":59375,"morning-outlined":59376,"multiple-folders-outlined":59377,"multiple-users-outlined":59378,"near-me-outlined":59379,"node-outlined":59380,"number-points":59381,"number":59382,"overview-outlined":59383,"park-outlined":59384,"payment-summary-outlined":59385,"payslip-outlined":59386,"pencil-outlined":59387,"percentage":59388,"phone-outlined":59389,"piggy-bank-outlined":59390,"plane-outlined":59391,"play-circle-outlined":59392,"pound-box-outlined":59393,"pound-card-outlined":59394,"pound-coin-shine-outlined":59395,"pound-credit-card-outlined":59396,"print-outlined":59397,"propane-tank-outlined":59398,"qr-code-outlined":59399,"qualification-outlined":59400,"re-assign":59401,"redeem":59402,"refresh":59403,"remove":59404,"reply-outlined":59405,"restart":59406,"restaurant-outlined":59407,"resume-outlined":59408,"return-arrow":59409,"rostering-outlined":59410,"safety-outlined":59411,"save-outlined":59412,"schedule-outlined":59413,"search-outlined":59414,"search-secured-outlined":59415,"send-outlined":59416,"share-1":59417,"share-2":59418,"share-outlined-2":59419,"share-outlined":59420,"shield-check-outlined":59421,"shop-outlined":59422,"shopping_basket_outlined":59423,"show-chart-outlined":59424,"single-down-arrow":59425,"single-left-arrow":59426,"single-right-arrow":59427,"single-up-arrow":59428,"smart-match-outlined":59429,"sparkle-outlined":59430,"speaker-active-outlined":59431,"speaker-outlined":59432,"star-circle-outlined":59433,"star-outlined":59434,"start-break-outlined":59435,"stash-outlined":59436,"stopwatch-outlined":59437,"strikethrough":59438,"styler-outlined":59439,"suitcase-clock-outlined":59440,"suitcase-outlined":59441,"survey-outlined":59442,"switch-outlined":59443,"sync":59444,"tag-outlined":59445,"target-outlined":59446,"tennis-outlined":59447,"thumb-down-outlined":59448,"thumb-up-outlined":59449,"ticket-outlined":59450,"timesheet-outlined":59451,"timesheets-outlined":59452,"today-outlined":59453,"transfer":59454,"transportation-outlined":59455,"trash-bin-outlined":59456,"umbrela-outlined":59457,"unavailability-outlined":59458,"unavailable":59459,"underline":59460,"union-outlined":59461,"unlock-outlined":59462,"upload-outlined":59463,"user-circle-outlined":59464,"user-gear-outlined":59465,"user-outlined":59466,"user-rectangle-outlined":59467,"video-1-outlined":59468,"video-2-outlined":59469,"volunteer-outlined":59470,"wallet-outlined":59471,"wellness-outlined":59472}
|
|
1
|
+
{"activate":59000,"add-emoji":59001,"add-person":59002,"adjustment":59003,"alignment":59004,"antenna":59005,"archive":59006,"assignment-warning":59007,"bank":59008,"bell":59009,"billing":59010,"bolt":59011,"bookmark-added":59012,"bookmark-checked":59013,"bookmark":59014,"box-check":59015,"box":59016,"bpay":59017,"buildings":59018,"cake":59019,"calendar-clock":59020,"calendar":59021,"candy-box-menu":59022,"caret-down-small":59023,"caret-down":59024,"caret-left-small":59025,"caret-left":59026,"caret-right-small":59027,"caret-right":59028,"caret-up-small":59029,"caret-up":59030,"check-radio":59031,"circle-add":59032,"circle-cancel":59033,"circle-check":59034,"circle-down":59035,"circle-info":59036,"circle-left":59037,"circle-ok":59038,"circle-pencil":59039,"circle-question":59040,"circle-remove":59041,"circle-right":59042,"circle-up":59043,"circle-warning":59044,"clock-3":59045,"clock":59046,"cloud-download":59047,"cloud-upload":59048,"cog":59049,"coin":59050,"contacts":59051,"credit-card":59052,"diamond":59053,"direction-arrows":59054,"directory":59055,"document":59056,"dollar-coin-shine":59057,"dot":59058,"double-buildings":59059,"edit-template":59060,"envelope":59061,"exclude":59062,"expand-content":59063,"expense":59064,"explore_nearby":59065,"eye-circle":59066,"eye-invisible":59067,"eye":59068,"face-meh":59069,"face-sad":59070,"face-smiley":59071,"feed":59072,"feedbacks":59073,"file-certified":59074,"file-clone":59075,"file-copy":59076,"file-csv":59077,"file-dispose":59078,"file-doc":59079,"file-excel":59080,"file-export":59081,"file-lock":59082,"file-pdf":59083,"file-powerpoint":59084,"file-search":59085,"file-secured":59086,"file-sheets":59087,"file-slide":59088,"file-verified":59089,"file-word":59090,"file":59091,"filter":59092,"folder-user":59093,"folder":59094,"format-bold":59095,"format-heading1":59096,"format-heading2":59097,"format-italic":59098,"format-list-bulleted":59099,"format-list-numbered":59100,"format-underlined":59101,"funnel-filter":59102,"global-dollar":59103,"global-pound":59104,"globe":59105,"graduation-cap":59106,"graph":59107,"happy-sun":59108,"health-bag":59109,"heart":59110,"hero-points":59111,"home":59112,"image":59113,"import":59114,"incident-siren":59115,"instapay-daily":59116,"instapay-now":59117,"instapay":59118,"list":59119,"loading-2":59120,"loading":59121,"location-on":59122,"location":59123,"lock":59124,"looks-one":59125,"looks-two":59126,"media-content":59127,"menu":59128,"money-notes":59129,"moneybag":59130,"moon":59131,"multiple-stars":59132,"multiple-users":59133,"near-me":59134,"node":59135,"open-folder":59136,"paperclip-vertical":59137,"paperclip":59138,"payment-summary":59139,"pencil":59140,"phone":59141,"piggy-bank":59142,"plane-up":59143,"plane":59144,"play-arrow":59145,"play-circle":59146,"pound-coin-shine":59147,"pound-sign":59148,"print":59149,"raising-hands":59150,"reply-arrow":59151,"reply":59152,"reschedule":59153,"rostering":59154,"salary-sacrifice":59155,"save":59156,"schedule-send":59157,"schedule":59158,"search-person":59159,"search":59160,"send":59161,"speaker-active":59162,"speaker":59163,"star-award":59164,"star-badge":59165,"star-circle":59166,"star-medal":59167,"star":59168,"steps-circle":59169,"stopwatch":59170,"suitcase":59171,"surfing":59172,"survey":59173,"swag-pillar-benefit":59174,"swag-pillar-career":59175,"swag-pillar-money":59176,"swag-pillar-work":59177,"swag":59178,"swipe-right":59179,"switch":59180,"tag":59181,"target":59182,"teams":59183,"thumb-down":59184,"thumb-up":59185,"timesheet":59186,"touch-id":59187,"trash-bin":59188,"unlock":59189,"user":59190,"video-1":59191,"video-2":59192,"wallet":59193,"warning":59194,"academic-hat-outlined":59195,"accommodation-outlined":59196,"activate-outlined":59197,"add-credit-card-outlined":59198,"add-person-outlined":59199,"add-section-outlined":59200,"add-time-outlined":59201,"add":59202,"adjustment-outlined":59203,"afternoon-outlined":59204,"ai-outlined":59205,"alignment-2-outlined":59206,"alignment-outlined":59207,"all-caps":59208,"application-outlined":59209,"arrow-down":59210,"arrow-downwards":59211,"arrow-left":59212,"arrow-leftwards":59213,"arrow-right":59214,"arrow-rightwards":59215,"arrow-up":59216,"arrow-upwards":59217,"article-outlined":59218,"at-sign":59219,"auto-graph-outlined":59220,"automotive-outlined":59221,"bakery-outlined":59222,"bar-outlined":59223,"beauty-outlined":59224,"beer-outlined":59225,"bell-active-outlined":59226,"bell-outlined":59227,"bell-slash-outlined":59228,"bill-management-outlined":59229,"billing-outlined":59230,"body-outlined":59231,"bold":59232,"bolt-outlined":59233,"book-outlined":59234,"bookmark-added-outlined":59235,"bookmark-checked-outlined":59236,"bookmark-outlined":59237,"box-1-outlined":59238,"box-check-outlined":59239,"box-outlined":59240,"bullet-points":59241,"cake-outlined":59242,"calculator-outlined":59243,"calendar-dates-outlined":59244,"calendar-star-outlined":59245,"call-outlined":59246,"call-split-outlined":59247,"camera-outlined":59248,"cancel":59249,"car-forward-outlined":59250,"cashback-outlined":59251,"charging-station-outlined":59252,"chat-bubble-outlined":59253,"chat-unread-outlined":59254,"checkmark":59255,"circle-add-outlined":59256,"circle-cancel-outlined":59257,"circle-down-outlined":59258,"circle-info-outlined":59259,"circle-left-outlined":59260,"circle-ok-outlined":59261,"circle-question-outlined":59262,"circle-remove-outlined":59263,"circle-right-outlined":59264,"circle-up-outlined":59265,"circle-warning-outlined":59266,"clock-2-outlined":59267,"clock-in-outlined":59268,"clock-out-outlined":59269,"clock-outlined":59270,"cog-outlined":59271,"coin-outlined":59272,"coin-super-outlined":59273,"comment-outlined":59274,"contacts-outlined":59275,"contacts-user-outlined":59276,"credit-card-outlined":59277,"cultural-site-outlined":59278,"cup-outlined":59279,"dentistry-outlined":59280,"direction-arrows-outlined":59281,"directory-outlined":59282,"document-outlined":59283,"dollar-box-outlined":59284,"dollar-card-outlined":59285,"dollar-coin-shine-outlined":59286,"dollar-credit-card-outlined":59287,"dollar-sign":59288,"double-buildings-outlined":59289,"double-left-arrows":59290,"double-right-arrows":59291,"download-box-outlined":59292,"download-outlined":59293,"edit-template-outlined":59294,"electronics-outlined":59295,"email-outlined":59296,"end-break-outlined":59297,"enter-arrow":59298,"entertainment-outlined":59299,"envelope-outlined":59300,"evening-outlined":59301,"expense-approval-outlined":59302,"expense-outlined":59303,"explore-outlined":59304,"extension-outlined":59305,"external-link":59306,"eye-invisible-outlined":59307,"eye-outlined":59308,"face-id":59309,"face-meh-outlined":59310,"face-open-smiley-outlined":59311,"face-sad-outlined":59312,"face-smiley-outlined":59313,"fastfood-outlined":59314,"feed-outlined":59315,"file-certified-outlined":59316,"file-clone-outlined":59317,"file-copy-outlined":59318,"file-dispose-outlined":59319,"file-dollar-certified-outlined":59320,"file-dollar-outlined":59321,"file-download-outlined":59322,"file-export-outlined":59323,"file-lock-outlined":59324,"file-outlined":59325,"file-pound-outlined":59326,"file-search-outlined":59327,"file-secured-outlined":59328,"file-statutory-outlined":59329,"file-verified-outlined":59330,"filter-outlined":59331,"fitness-outlined":59332,"folder-outlined":59333,"folder-upload-outlined":59334,"folder-user-outlined":59335,"form-outlined":59336,"funnel-filter-outline":59337,"goal-outlined":59338,"graph-outlined":59339,"grocery-outlined":59340,"hand-holding-user-outlined":59341,"handshake-outlined":59342,"happy-sun-outlined":59343,"health-bag-outlined":59344,"heart-outlined":59345,"home-active-outlined":59346,"home-outlined":59347,"id-card-outlined":59348,"image-outlined":59349,"import-outlined":59350,"instapay-outlined":59351,"italic":59352,"job-search-outlined":59353,"leave-approval-outlined":59354,"lighting-outlined":59355,"link-1":59356,"link-2":59357,"list-outlined":59358,"live-help-outlined":59359,"local_mall_outlined":59360,"location-on-outlined":59361,"location-outlined":59362,"lock-outlined":59363,"locked-file-outlined":59364,"log-out":59365,"mail-outlined":59366,"map-outlined":59367,"media-content-outlined":59368,"menu-close":59369,"menu-expand":59370,"menu-fold-outlined":59371,"menu-unfold-outlined":59372,"moneybag-outlined":59373,"moon-outlined":59374,"more-horizontal":59375,"more-vertical":59376,"morning-outlined":59377,"multiple-folders-outlined":59378,"multiple-users-outlined":59379,"near-me-outlined":59380,"node-outlined":59381,"number-points":59382,"number":59383,"overview-outlined":59384,"park-outlined":59385,"payment-summary-outlined":59386,"payslip-outlined":59387,"pencil-outlined":59388,"percentage":59389,"phone-outlined":59390,"piggy-bank-outlined":59391,"plane-outlined":59392,"play-circle-outlined":59393,"pound-box-outlined":59394,"pound-card-outlined":59395,"pound-coin-shine-outlined":59396,"pound-credit-card-outlined":59397,"print-outlined":59398,"propane-tank-outlined":59399,"qr-code-outlined":59400,"qualification-outlined":59401,"re-assign":59402,"redeem":59403,"refresh":59404,"remove":59405,"reply-outlined":59406,"restart":59407,"restaurant-outlined":59408,"resume-outlined":59409,"return-arrow":59410,"rostering-outlined":59411,"safety-outlined":59412,"save-outlined":59413,"schedule-outlined":59414,"search-outlined":59415,"search-secured-outlined":59416,"send-outlined":59417,"share-1":59418,"share-2":59419,"share-outlined-2":59420,"share-outlined":59421,"shield-check-outlined":59422,"shop-outlined":59423,"shopping_basket_outlined":59424,"show-chart-outlined":59425,"single-down-arrow":59426,"single-left-arrow":59427,"single-right-arrow":59428,"single-up-arrow":59429,"smart-match-outlined":59430,"sparkle-outlined":59431,"speaker-active-outlined":59432,"speaker-outlined":59433,"star-circle-outlined":59434,"star-outlined":59435,"start-break-outlined":59436,"stash-outlined":59437,"stopwatch-outlined":59438,"strikethrough":59439,"styler-outlined":59440,"suitcase-clock-outlined":59441,"suitcase-outlined":59442,"survey-outlined":59443,"switch-outlined":59444,"sync":59445,"tag-outlined":59446,"target-outlined":59447,"tennis-outlined":59448,"thumb-down-outlined":59449,"thumb-up-outlined":59450,"ticket-outlined":59451,"timesheet-outlined":59452,"timesheets-outlined":59453,"today-outlined":59454,"transfer":59455,"transportation-outlined":59456,"trash-bin-outlined":59457,"umbrela-outlined":59458,"unavailability-outlined":59459,"unavailable":59460,"underline":59461,"union-outlined":59462,"unlock-outlined":59463,"upload-outlined":59464,"user-circle-outlined":59465,"user-gear-outlined":59466,"user-outlined":59467,"user-rectangle-outlined":59468,"video-1-outlined":59469,"video-2-outlined":59470,"volunteer-outlined":59471,"wallet-outlined":59472,"wellness-outlined":59473}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { Image as RNImage } from 'react-native';
|
|
3
4
|
import type { ImageProps as RNImageProps } from 'react-native';
|
|
@@ -28,7 +29,7 @@ const Image = ({
|
|
|
28
29
|
testID,
|
|
29
30
|
style,
|
|
30
31
|
...imageNativeProps
|
|
31
|
-
}: ImageProps):
|
|
32
|
+
}: ImageProps): ReactElement => {
|
|
32
33
|
useDeprecation(
|
|
33
34
|
'Image component will soon be deprecated. Please use `Image` from `react-native` instead.'
|
|
34
35
|
);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
4
|
import Icon from '../Icon';
|
|
@@ -60,7 +61,7 @@ const BasicListItem = ({
|
|
|
60
61
|
selected = false,
|
|
61
62
|
disabled = false,
|
|
62
63
|
onPress,
|
|
63
|
-
}: ListItemProps):
|
|
64
|
+
}: ListItemProps): ReactElement => {
|
|
64
65
|
const theme = useTheme();
|
|
65
66
|
|
|
66
67
|
return (
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import setDefaultOptions from 'date-fns/setDefaultOptions';
|
|
3
3
|
import { LocaleContext } from './context';
|
|
4
4
|
import { getDateFnsLocale } from './utils';
|
|
5
5
|
import type { LocaleValues } from '../../locales/types';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import enAU from 'date-fns/locale/en-AU';
|
|
2
|
+
import enCA from 'date-fns/locale/en-CA';
|
|
3
|
+
import type { Locale } from 'date-fns';
|
|
3
4
|
import type { LocaleCode } from '../../locales/types';
|
|
4
5
|
|
|
5
6
|
const Locales = {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import type { ViewProps, StyleProp, ViewStyle } from 'react-native';
|
|
3
4
|
import { StyledContainer, StyledFocusIcon } from './StyledMapPin';
|
|
@@ -17,7 +18,7 @@ const MapPinFocussed = ({
|
|
|
17
18
|
style,
|
|
18
19
|
testID,
|
|
19
20
|
...nativeProps
|
|
20
|
-
}: MapPinFocussedProps):
|
|
21
|
+
}: MapPinFocussedProps): ReactElement => {
|
|
21
22
|
return (
|
|
22
23
|
<StyledContainer {...nativeProps} style={style} testID={testID}>
|
|
23
24
|
<StyledFocusIcon icon="location-on" intent="secondary" />
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import {
|
|
3
4
|
StyledContainer,
|
|
@@ -30,7 +31,7 @@ const MapPin = ({
|
|
|
30
31
|
image,
|
|
31
32
|
icon,
|
|
32
33
|
...nativeProps
|
|
33
|
-
}: MapPinProps):
|
|
34
|
+
}: MapPinProps): ReactElement => {
|
|
34
35
|
const badgeIcon = getBadgeIconName(state);
|
|
35
36
|
return (
|
|
36
37
|
<StyledContainer {...nativeProps} style={style} testID={testID}>
|
|
@@ -96,4 +96,50 @@ describe('Modal', () => {
|
|
|
96
96
|
fireEvent.press(getByText('Close modal'));
|
|
97
97
|
expect(onDismiss).toBeCalled();
|
|
98
98
|
});
|
|
99
|
+
|
|
100
|
+
it('unmounts correctly when closed with slide animation', () => {
|
|
101
|
+
const ModalExample = () => {
|
|
102
|
+
const [modalVisible, setModalVisible] = React.useState(true);
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<Portal.Provider>
|
|
106
|
+
<Modal animationType="slide" visible={modalVisible} transparent>
|
|
107
|
+
<Typography.Body>Modal content</Typography.Body>
|
|
108
|
+
<Button text="Close modal" onPress={() => setModalVisible(false)} />
|
|
109
|
+
</Modal>
|
|
110
|
+
</Portal.Provider>
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const { getByText, queryByText } = renderWithTheme(<ModalExample />);
|
|
115
|
+
|
|
116
|
+
expect(getByText('Modal content')).toBeTruthy();
|
|
117
|
+
fireEvent.press(getByText('Close modal'));
|
|
118
|
+
|
|
119
|
+
// Modal content should still be in DOM during animation
|
|
120
|
+
expect(queryByText('Modal content')).toBeTruthy();
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it('unmounts correctly when closed with fade animation', () => {
|
|
124
|
+
const ModalExample = () => {
|
|
125
|
+
const [modalVisible, setModalVisible] = React.useState(true);
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<Portal.Provider>
|
|
129
|
+
<Modal animationType="fade" visible={modalVisible} transparent>
|
|
130
|
+
<Typography.Body>Modal content</Typography.Body>
|
|
131
|
+
<Button text="Close modal" onPress={() => setModalVisible(false)} />
|
|
132
|
+
</Modal>
|
|
133
|
+
</Portal.Provider>
|
|
134
|
+
);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const { getByText, queryByText } = renderWithTheme(<ModalExample />);
|
|
138
|
+
|
|
139
|
+
expect(getByText('Modal content')).toBeTruthy();
|
|
140
|
+
fireEvent.press(getByText('Close modal'));
|
|
141
|
+
|
|
142
|
+
// Modal content should still be in DOM during animation
|
|
143
|
+
expect(queryByText('Modal content')).toBeTruthy();
|
|
144
|
+
});
|
|
99
145
|
});
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import React, {
|
|
3
|
-
forwardRef,
|
|
4
|
-
useEffect,
|
|
5
|
-
useImperativeHandle,
|
|
6
|
-
useRef,
|
|
7
|
-
useState,
|
|
8
|
-
useCallback,
|
|
9
|
-
} from 'react';
|
|
2
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
10
3
|
import {
|
|
11
4
|
Animated,
|
|
12
5
|
BackHandler,
|
|
@@ -18,11 +11,6 @@ import {
|
|
|
18
11
|
import { useTheme } from '../../theme';
|
|
19
12
|
import Portal from '../Portal';
|
|
20
13
|
|
|
21
|
-
type ModalHandles = {
|
|
22
|
-
show: () => void;
|
|
23
|
-
hide: (callback: () => void) => void;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
14
|
const DEFAULT_BACKDROP_OPACITY = 0.4;
|
|
27
15
|
|
|
28
16
|
const DEFAULT_ANIMATION_CONFIG = {
|
|
@@ -66,152 +54,136 @@ export interface ModalProps {
|
|
|
66
54
|
onDismiss?: () => void;
|
|
67
55
|
}
|
|
68
56
|
|
|
69
|
-
const Modal =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
57
|
+
const Modal = ({
|
|
58
|
+
children,
|
|
59
|
+
visible = true,
|
|
60
|
+
onShow,
|
|
61
|
+
onRequestClose,
|
|
62
|
+
testID,
|
|
63
|
+
animationType = 'none',
|
|
64
|
+
transparent = false,
|
|
65
|
+
onDismiss,
|
|
66
|
+
}: ModalProps) => {
|
|
67
|
+
const theme = useTheme();
|
|
68
|
+
const animatedBackdropValue = useRef(new Animated.Value(0)).current;
|
|
69
|
+
const animatedModalValue = useRef(new Animated.Value(0)).current;
|
|
70
|
+
const [mounted, setMounted] = useState(visible);
|
|
71
|
+
const previousVisible = useRef(false);
|
|
72
|
+
|
|
73
|
+
// Animate in/out based on visible prop
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
if (visible && !previousVisible.current) {
|
|
76
|
+
// Show animation
|
|
77
|
+
setMounted(true);
|
|
78
|
+
|
|
79
|
+
if (animationType !== 'none') {
|
|
80
|
+
if (!transparent) {
|
|
81
|
+
Animated.timing(animatedBackdropValue, {
|
|
82
|
+
toValue: 1,
|
|
83
|
+
...DEFAULT_ANIMATION_CONFIG,
|
|
84
|
+
}).start();
|
|
85
|
+
}
|
|
97
86
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
87
|
+
Animated.timing(animatedModalValue, {
|
|
88
|
+
toValue: 1,
|
|
89
|
+
...DEFAULT_ANIMATION_CONFIG,
|
|
90
|
+
}).start(() => {
|
|
91
|
+
onShow?.();
|
|
92
|
+
});
|
|
93
|
+
} else {
|
|
94
|
+
onShow?.();
|
|
95
|
+
}
|
|
96
|
+
} else if (!visible && previousVisible.current) {
|
|
97
|
+
// Hide animation
|
|
98
|
+
if (animationType !== 'none') {
|
|
99
|
+
if (!transparent) {
|
|
100
|
+
Animated.timing(animatedBackdropValue, {
|
|
101
|
+
toValue: 0,
|
|
101
102
|
...DEFAULT_ANIMATION_CONFIG,
|
|
102
|
-
}).start(
|
|
103
|
-
} else {
|
|
104
|
-
callback?.();
|
|
103
|
+
}).start();
|
|
105
104
|
}
|
|
106
|
-
},
|
|
107
|
-
[animationType, onShow, transparent]
|
|
108
|
-
);
|
|
109
105
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
106
|
+
Animated.timing(animatedModalValue, {
|
|
107
|
+
toValue: 0,
|
|
108
|
+
...DEFAULT_ANIMATION_CONFIG,
|
|
109
|
+
}).start(() => {
|
|
110
|
+
setMounted(false);
|
|
111
|
+
if (Platform.OS === 'ios') {
|
|
112
|
+
onDismiss?.();
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
} else {
|
|
116
|
+
setMounted(false);
|
|
117
|
+
if (Platform.OS === 'ios') {
|
|
118
|
+
onDismiss?.();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
previousVisible.current = visible;
|
|
124
|
+
}, [visible, animationType, transparent, onShow, onDismiss]);
|
|
125
|
+
|
|
126
|
+
// Back button handler
|
|
127
|
+
useEffect(() => {
|
|
128
|
+
if (!visible) return;
|
|
129
|
+
|
|
130
|
+
const backHandler = BackHandler.addEventListener(
|
|
131
|
+
'hardwareBackPress',
|
|
125
132
|
() => {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
},
|
|
130
|
-
|
|
131
|
-
hide: (wrapperCallback) => {
|
|
132
|
-
animateBackdropAndContent({
|
|
133
|
-
toValue: 0,
|
|
134
|
-
callback: () => {
|
|
135
|
-
if (Platform.OS === 'ios') {
|
|
136
|
-
onDismiss?.();
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
wrapperCallback();
|
|
140
|
-
},
|
|
141
|
-
});
|
|
142
|
-
},
|
|
143
|
-
};
|
|
144
|
-
},
|
|
145
|
-
[onDismiss, onShow, animateBackdropAndContent]
|
|
133
|
+
onRequestClose?.();
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
146
136
|
);
|
|
147
137
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
const backHandler = BackHandler.addEventListener(
|
|
151
|
-
'hardwareBackPress',
|
|
152
|
-
() => {
|
|
153
|
-
onRequestClose?.();
|
|
154
|
-
return true;
|
|
155
|
-
}
|
|
156
|
-
);
|
|
157
|
-
|
|
158
|
-
return () => backHandler.remove();
|
|
159
|
-
}, [onRequestClose]);
|
|
160
|
-
|
|
161
|
-
return (
|
|
162
|
-
<Portal>
|
|
163
|
-
<Animated.View
|
|
164
|
-
style={{
|
|
165
|
-
...StyleSheet.absoluteFillObject,
|
|
166
|
-
backgroundColor: transparent
|
|
167
|
-
? 'transparent'
|
|
168
|
-
: theme.colors.overlayGlobalSurface,
|
|
169
|
-
opacity:
|
|
170
|
-
animationType !== 'none'
|
|
171
|
-
? backdropOpacityAnimation
|
|
172
|
-
: DEFAULT_BACKDROP_OPACITY,
|
|
173
|
-
}}
|
|
174
|
-
/>
|
|
175
|
-
|
|
176
|
-
<Animated.View
|
|
177
|
-
testID={testID}
|
|
178
|
-
style={{
|
|
179
|
-
...StyleSheet.absoluteFillObject,
|
|
180
|
-
opacity: animationType === 'fade' ? modalAnimation : 1,
|
|
181
|
-
transform: [
|
|
182
|
-
{
|
|
183
|
-
translateY: animationType === 'slide' ? modalAnimation : 0,
|
|
184
|
-
},
|
|
185
|
-
],
|
|
186
|
-
}}
|
|
187
|
-
>
|
|
188
|
-
{children}
|
|
189
|
-
</Animated.View>
|
|
190
|
-
</Portal>
|
|
191
|
-
);
|
|
192
|
-
}
|
|
193
|
-
);
|
|
138
|
+
return () => backHandler.remove();
|
|
139
|
+
}, [visible, onRequestClose]);
|
|
194
140
|
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
|
|
141
|
+
const backdropOpacityAnimation = animatedBackdropValue.interpolate({
|
|
142
|
+
inputRange: [0, 1],
|
|
143
|
+
outputRange: [0, DEFAULT_BACKDROP_OPACITY],
|
|
144
|
+
});
|
|
198
145
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
modalRef.current?.hide(() => setInternalVisible(false));
|
|
205
|
-
}
|
|
206
|
-
}, [visible]);
|
|
146
|
+
const modalAnimation = animatedModalValue.interpolate({
|
|
147
|
+
inputRange: [0, 1],
|
|
148
|
+
outputRange:
|
|
149
|
+
animationType === 'slide' ? [Dimensions.get('window').height, 0] : [0, 1],
|
|
150
|
+
});
|
|
207
151
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
}, [internalVisible]);
|
|
152
|
+
if (!visible && !mounted) {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
213
155
|
|
|
214
|
-
return
|
|
156
|
+
return (
|
|
157
|
+
<Portal>
|
|
158
|
+
<Animated.View
|
|
159
|
+
style={{
|
|
160
|
+
...StyleSheet.absoluteFillObject,
|
|
161
|
+
backgroundColor: transparent
|
|
162
|
+
? 'transparent'
|
|
163
|
+
: theme.colors.overlayGlobalSurface,
|
|
164
|
+
opacity:
|
|
165
|
+
animationType !== 'none'
|
|
166
|
+
? backdropOpacityAnimation
|
|
167
|
+
: DEFAULT_BACKDROP_OPACITY,
|
|
168
|
+
}}
|
|
169
|
+
/>
|
|
170
|
+
|
|
171
|
+
<Animated.View
|
|
172
|
+
testID={testID}
|
|
173
|
+
style={{
|
|
174
|
+
...StyleSheet.absoluteFillObject,
|
|
175
|
+
opacity: animationType === 'fade' ? modalAnimation : 1,
|
|
176
|
+
transform: [
|
|
177
|
+
{
|
|
178
|
+
translateY: animationType === 'slide' ? modalAnimation : 0,
|
|
179
|
+
},
|
|
180
|
+
],
|
|
181
|
+
}}
|
|
182
|
+
>
|
|
183
|
+
{children}
|
|
184
|
+
</Animated.View>
|
|
185
|
+
</Portal>
|
|
186
|
+
);
|
|
215
187
|
};
|
|
216
188
|
|
|
217
|
-
export default
|
|
189
|
+
export default Modal;
|