@hero-design/rn 8.3.4 → 8.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +9 -9
- package/assets/fonts/hero-icons-mobile.ttf +0 -0
- package/es/index.js +436 -401
- package/lib/assets/fonts/hero-icons-mobile.ttf +0 -0
- package/lib/index.js +436 -401
- package/package.json +5 -5
- package/src/components/Carousel/CarouselItem.tsx +3 -1
- package/src/components/Carousel/StyledCarousel.tsx +2 -0
- package/src/components/Carousel/__tests__/__snapshots__/index.spec.tsx.snap +18 -15
- package/src/components/Icon/HeroIcon/glyphMap.json +1 -1
- package/src/components/Icon/IconList.ts +8 -0
- package/src/components/Select/BaseOptionList.tsx +5 -12
- package/src/components/Select/MultiSelect/OptionList.tsx +6 -6
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +3 -0
- package/src/components/Select/MultiSelect/index.tsx +9 -0
- package/src/components/Select/SingleSelect/OptionList.tsx +5 -3
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +24 -4
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +21 -3
- package/src/components/Select/SingleSelect/index.tsx +8 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +1 -1
- package/src/theme/components/carousel.ts +1 -1
- package/types/components/Icon/IconList.d.ts +1 -1
- package/types/components/Icon/index.d.ts +1 -1
- package/types/components/Icon/utils.d.ts +1 -1
- package/types/components/Select/BaseOptionList.d.ts +4 -8
- package/types/components/Select/MultiSelect/OptionList.d.ts +4 -7
- package/types/components/Select/SingleSelect/OptionList.d.ts +4 -4
- package/types/components/Select/SingleSelect/StyledSingleSelect.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.5.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@emotion/native": "^11.9.3",
|
|
23
23
|
"@emotion/react": "^11.9.3",
|
|
24
|
-
"@hero-design/colors": "8.
|
|
24
|
+
"@hero-design/colors": "8.5.0",
|
|
25
25
|
"date-fns": "^2.16.1",
|
|
26
26
|
"events": "^3.2.0",
|
|
27
27
|
"hero-editor": "^1.9.21"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@babel/preset-typescript": "^7.17.12",
|
|
45
45
|
"@babel/runtime": "^7.18.9",
|
|
46
46
|
"@emotion/jest": "^11.9.3",
|
|
47
|
-
"@hero-design/eslint-plugin": "8.
|
|
47
|
+
"@hero-design/eslint-plugin": "8.5.0",
|
|
48
48
|
"@react-native-community/datetimepicker": "^3.5.2",
|
|
49
49
|
"@react-native-community/slider": "4.1.12",
|
|
50
50
|
"@rollup/plugin-babel": "^5.3.1",
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
"@types/react-native": "^0.67.7",
|
|
61
61
|
"@types/react-native-vector-icons": "^6.4.10",
|
|
62
62
|
"babel-plugin-inline-import": "^3.0.0",
|
|
63
|
-
"eslint-config-hd": "8.
|
|
63
|
+
"eslint-config-hd": "8.5.0",
|
|
64
64
|
"jest": "^27.3.1",
|
|
65
|
-
"prettier-config-hd": "8.
|
|
65
|
+
"prettier-config-hd": "8.5.0",
|
|
66
66
|
"react": "18.0.0",
|
|
67
67
|
"react-native": "0.69.7",
|
|
68
68
|
"react-native-gesture-handler": "~2.1.0",
|
|
@@ -35,7 +35,9 @@ const CarouselItem = ({
|
|
|
35
35
|
>
|
|
36
36
|
{content}
|
|
37
37
|
<StyledCarouselHeading>{heading}</StyledCarouselHeading>
|
|
38
|
-
{body ?
|
|
38
|
+
{body ? (
|
|
39
|
+
<Typography.Text fontSize="large">{body}</Typography.Text>
|
|
40
|
+
) : null}
|
|
39
41
|
</StyledCarouselContentWrapper>
|
|
40
42
|
</Box>
|
|
41
43
|
);
|
|
@@ -3,6 +3,7 @@ import styled from '@emotion/native';
|
|
|
3
3
|
import Typography from '../Typography';
|
|
4
4
|
import Image from '../Image';
|
|
5
5
|
import Box from '../Box';
|
|
6
|
+
import { scale } from '../../utils/scale';
|
|
6
7
|
|
|
7
8
|
const StyledBackDrop = styled(View)<{
|
|
8
9
|
themeSlideBackground: string;
|
|
@@ -38,6 +39,7 @@ const StyledCarouselContentWrapper = styled(Box)<{
|
|
|
38
39
|
width: number;
|
|
39
40
|
}>(({ width }) => ({
|
|
40
41
|
width,
|
|
42
|
+
minHeight: scale(250),
|
|
41
43
|
}));
|
|
42
44
|
|
|
43
45
|
const StyledCarouselFooterWrapper = styled(View)(({ theme }) => ({
|
|
@@ -153,6 +153,7 @@ exports[`Carousel renders basic carousel 1`] = `
|
|
|
153
153
|
},
|
|
154
154
|
Array [
|
|
155
155
|
Object {
|
|
156
|
+
"minHeight": 250,
|
|
156
157
|
"width": 750,
|
|
157
158
|
},
|
|
158
159
|
undefined,
|
|
@@ -174,7 +175,7 @@ exports[`Carousel renders basic carousel 1`] = `
|
|
|
174
175
|
Array [
|
|
175
176
|
Object {
|
|
176
177
|
"fontFamily": "RebondGrotesque-SemiBold",
|
|
177
|
-
"fontSize":
|
|
178
|
+
"fontSize": 32,
|
|
178
179
|
"lineHeight": 44,
|
|
179
180
|
"marginBottom": 16,
|
|
180
181
|
"marginTop": 8,
|
|
@@ -196,14 +197,14 @@ exports[`Carousel renders basic carousel 1`] = `
|
|
|
196
197
|
Object {
|
|
197
198
|
"color": "#001f23",
|
|
198
199
|
"fontFamily": "BeVietnamPro-Regular",
|
|
199
|
-
"fontSize":
|
|
200
|
-
"letterSpacing": 0.
|
|
201
|
-
"lineHeight":
|
|
200
|
+
"fontSize": 16,
|
|
201
|
+
"letterSpacing": 0.48,
|
|
202
|
+
"lineHeight": 24,
|
|
202
203
|
},
|
|
203
204
|
undefined,
|
|
204
205
|
]
|
|
205
206
|
}
|
|
206
|
-
themeFontSize="
|
|
207
|
+
themeFontSize="large"
|
|
207
208
|
themeFontWeight="regular"
|
|
208
209
|
themeIntent="body"
|
|
209
210
|
themeTypeface="neutral"
|
|
@@ -269,6 +270,7 @@ exports[`Carousel renders basic carousel 1`] = `
|
|
|
269
270
|
},
|
|
270
271
|
Array [
|
|
271
272
|
Object {
|
|
273
|
+
"minHeight": 250,
|
|
272
274
|
"width": 750,
|
|
273
275
|
},
|
|
274
276
|
undefined,
|
|
@@ -307,7 +309,7 @@ exports[`Carousel renders basic carousel 1`] = `
|
|
|
307
309
|
Array [
|
|
308
310
|
Object {
|
|
309
311
|
"fontFamily": "RebondGrotesque-SemiBold",
|
|
310
|
-
"fontSize":
|
|
312
|
+
"fontSize": 32,
|
|
311
313
|
"lineHeight": 44,
|
|
312
314
|
"marginBottom": 16,
|
|
313
315
|
"marginTop": 8,
|
|
@@ -329,14 +331,14 @@ exports[`Carousel renders basic carousel 1`] = `
|
|
|
329
331
|
Object {
|
|
330
332
|
"color": "#001f23",
|
|
331
333
|
"fontFamily": "BeVietnamPro-Regular",
|
|
332
|
-
"fontSize":
|
|
333
|
-
"letterSpacing": 0.
|
|
334
|
-
"lineHeight":
|
|
334
|
+
"fontSize": 16,
|
|
335
|
+
"letterSpacing": 0.48,
|
|
336
|
+
"lineHeight": 24,
|
|
335
337
|
},
|
|
336
338
|
undefined,
|
|
337
339
|
]
|
|
338
340
|
}
|
|
339
|
-
themeFontSize="
|
|
341
|
+
themeFontSize="large"
|
|
340
342
|
themeFontWeight="regular"
|
|
341
343
|
themeIntent="body"
|
|
342
344
|
themeTypeface="neutral"
|
|
@@ -402,6 +404,7 @@ exports[`Carousel renders basic carousel 1`] = `
|
|
|
402
404
|
},
|
|
403
405
|
Array [
|
|
404
406
|
Object {
|
|
407
|
+
"minHeight": 250,
|
|
405
408
|
"width": 750,
|
|
406
409
|
},
|
|
407
410
|
undefined,
|
|
@@ -423,7 +426,7 @@ exports[`Carousel renders basic carousel 1`] = `
|
|
|
423
426
|
Array [
|
|
424
427
|
Object {
|
|
425
428
|
"fontFamily": "RebondGrotesque-SemiBold",
|
|
426
|
-
"fontSize":
|
|
429
|
+
"fontSize": 32,
|
|
427
430
|
"lineHeight": 44,
|
|
428
431
|
"marginBottom": 16,
|
|
429
432
|
"marginTop": 8,
|
|
@@ -445,14 +448,14 @@ exports[`Carousel renders basic carousel 1`] = `
|
|
|
445
448
|
Object {
|
|
446
449
|
"color": "#001f23",
|
|
447
450
|
"fontFamily": "BeVietnamPro-Regular",
|
|
448
|
-
"fontSize":
|
|
449
|
-
"letterSpacing": 0.
|
|
450
|
-
"lineHeight":
|
|
451
|
+
"fontSize": 16,
|
|
452
|
+
"letterSpacing": 0.48,
|
|
453
|
+
"lineHeight": 24,
|
|
451
454
|
},
|
|
452
455
|
undefined,
|
|
453
456
|
]
|
|
454
457
|
}
|
|
455
|
-
themeFontSize="
|
|
458
|
+
themeFontSize="large"
|
|
456
459
|
themeFontWeight="regular"
|
|
457
460
|
themeIntent="body"
|
|
458
461
|
themeTypeface="neutral"
|
|
@@ -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,"bookmark":59011,"box-check":
|
|
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,"bookmark-added":59011,"bookmark":59012,"box-check":59013,"box":59014,"buildings":59015,"cake":59016,"calendar-clock":59017,"calendar":59018,"candy-box-menu":59019,"caret-down-small":59020,"caret-down":59021,"caret-left-small":59022,"caret-left":59023,"caret-right-small":59024,"caret-right":59025,"caret-up-small":59026,"caret-up":59027,"check-radio":59028,"circle-add":59029,"circle-cancel":59030,"circle-check":59031,"circle-down":59032,"circle-info":59033,"circle-left":59034,"circle-ok":59035,"circle-pencil":59036,"circle-question":59037,"circle-remove":59038,"circle-right":59039,"circle-up":59040,"circle-warning":59041,"clock-3":59042,"clock":59043,"cloud-download":59044,"cloud-upload":59045,"cog":59046,"coin":59047,"contacts":59048,"credit-card":59049,"diamond":59050,"direction-arrows":59051,"directory":59052,"document":59053,"dollar-coin-shine":59054,"double-buildings":59055,"edit-template":59056,"envelope":59057,"expense":59058,"eye-circle":59059,"eye-invisible":59060,"eye":59061,"face-meh":59062,"face-sad":59063,"face-smiley":59064,"feed":59065,"feedbacks":59066,"file-certified":59067,"file-clone":59068,"file-copy":59069,"file-csv":59070,"file-dispose":59071,"file-doc":59072,"file-excel":59073,"file-export":59074,"file-lock":59075,"file-pdf":59076,"file-powerpoint":59077,"file-search":59078,"file-secured":59079,"file-sheets":59080,"file-slide":59081,"file-verified":59082,"file-word":59083,"file":59084,"filter":59085,"folder-user":59086,"folder":59087,"format-bold":59088,"format-heading1":59089,"format-heading2":59090,"format-italic":59091,"format-list-bulleted":59092,"format-list-numbered":59093,"format-underlined":59094,"funnel-filter":59095,"global-dollar":59096,"globe":59097,"graduation-cap":59098,"graph":59099,"happy-sun":59100,"health-bag":59101,"heart":59102,"home":59103,"image":59104,"import":59105,"incident-siren":59106,"instapay":59107,"list":59108,"loading-2":59109,"loading":59110,"location":59111,"lock":59112,"looks-one":59113,"looks-two":59114,"media-content":59115,"menu":59116,"money-notes":59117,"moneybag":59118,"moon":59119,"multiple-stars":59120,"multiple-users":59121,"node":59122,"open-folder":59123,"paperclip":59124,"payment-summary":59125,"pencil":59126,"phone":59127,"piggy-bank":59128,"plane":59129,"play-circle":59130,"print":59131,"raising-hands":59132,"reply-arrow":59133,"reply":59134,"reschedule":59135,"rostering":59136,"save":59137,"schedule-send":59138,"schedule":59139,"search-person":59140,"send":59141,"speaker-active":59142,"speaker":59143,"star-award":59144,"star-badge":59145,"star-circle":59146,"star-medal":59147,"star":59148,"steps-circle":59149,"stopwatch":59150,"suitcase":59151,"survey":59152,"swag":59153,"switch":59154,"tag":59155,"target":59156,"teams":59157,"timesheet":59158,"touch-id":59159,"trash-bin":59160,"unlock":59161,"user":59162,"video-1":59163,"video-2":59164,"wallet":59165,"warning":59166,"activate-outlined":59167,"add-credit-card-outlined":59168,"add-person-outlined":59169,"add-section-outlined":59170,"add-time-outlined":59171,"add":59172,"adjustment-outlined":59173,"alignment-2-outlined":59174,"alignment-outlined":59175,"all-caps":59176,"arrow-down":59177,"arrow-downwards":59178,"arrow-left":59179,"arrow-leftwards":59180,"arrow-right":59181,"arrow-rightwards":59182,"arrow-up":59183,"arrow-upwards":59184,"article-outlined":59185,"at-sign":59186,"auto-graph-outlined":59187,"bell-active-outlined":59188,"bell-outlined":59189,"bell-slash-outlined":59190,"billing-outlined":59191,"body-outlined":59192,"bold":59193,"bookmark-added-outlined":59194,"bookmark-outlined":59195,"box-check-outlined":59196,"box-outlined":59197,"bullet-points":59198,"cake-outlined":59199,"calendar-dates-outlined":59200,"calendar-star-outlined":59201,"camera-outlined":59202,"cancel":59203,"chat-bubble-outlined":59204,"chat-unread-outlined":59205,"checkmark":59206,"circle-add-outlined":59207,"circle-cancel-outlined":59208,"circle-down-outlined":59209,"circle-info-outlined":59210,"circle-left-outlined":59211,"circle-ok-outlined":59212,"circle-question-outlined":59213,"circle-remove-outlined":59214,"circle-right-outlined":59215,"circle-up-outlined":59216,"circle-warning-outlined":59217,"clock-2-outlined":59218,"clock-outlined":59219,"cog-outlined":59220,"coin-outlined":59221,"comment-outlined":59222,"contacts-outlined":59223,"credit-card-outlined":59224,"cup-outlined":59225,"direction-arrows-outlined":59226,"directory-outlined":59227,"document-outlined":59228,"dollar-card-outlined":59229,"dollar-coin-shine-outlined":59230,"dollar-sign":59231,"double-buildings-outlined":59232,"double-left-arrows":59233,"double-right-arrows":59234,"download-outlined":59235,"edit-template-outlined":59236,"email-outlined":59237,"enter-arrow":59238,"envelope-outlined":59239,"expense-outlined":59240,"explore-outlined":59241,"external-link":59242,"eye-invisible-outlined":59243,"eye-outlined":59244,"face-id":59245,"face-meh-outlined":59246,"face-open-smiley-outlined":59247,"face-sad-outlined":59248,"face-smiley-outlined":59249,"feed-outlined":59250,"file-certified-outlined":59251,"file-clone-outlined":59252,"file-copy-outlined":59253,"file-dispose-outlined":59254,"file-dollar-outlined":59255,"file-download-outlined":59256,"file-export-outlined":59257,"file-lock-outlined":59258,"file-outlined":59259,"file-search-outlined":59260,"file-secured-outlined":59261,"file-verified-outlined":59262,"filter-outlined":59263,"folder-outlined":59264,"folder-user-outlined":59265,"funnel-filter-outline":59266,"graph-outlined":59267,"hand-holding-user-outlined":59268,"happy-sun-outlined":59269,"health-bag-outlined":59270,"heart-outlined":59271,"home-active-outlined":59272,"home-outlined":59273,"id-card-outlined":59274,"image-outlined":59275,"import-outlined":59276,"instapay-outlined":59277,"italic":59278,"link-1":59279,"link-2":59280,"list-outlined":59281,"live-help-outlined":59282,"location-outlined":59283,"lock-outlined":59284,"locked-file-outlined":59285,"log-out":59286,"media-content-outlined":59287,"menu-close":59288,"menu-expand":59289,"menu-fold-outlined":59290,"menu-unfold-outlined":59291,"moneybag-outlined":59292,"moon-outlined":59293,"more-horizontal":59294,"more-vertical":59295,"multiple-folders-outlined":59296,"multiple-users-outlined":59297,"near-me-outlined":59298,"node-outlined":59299,"number-points":59300,"number":59301,"overview-outlined":59302,"payment-summary-outlined":59303,"payslip-outlined":59304,"pencil-outlined":59305,"percentage":59306,"phone-outlined":59307,"piggy-bank-outlined":59308,"plane-outlined":59309,"play-circle-outlined":59310,"print-outlined":59311,"qr-code-outlined":59312,"qualification-outlined":59313,"re-assign":59314,"redeem":59315,"refresh":59316,"remove":59317,"reply-outlined":59318,"restart":59319,"return-arrow":59320,"rostering-outlined":59321,"save-outlined":59322,"schedule-outlined":59323,"search-outlined":59324,"search-secured-outlined":59325,"send-outlined":59326,"share-1":59327,"share-2":59328,"share-outlined":59329,"show-chart-outlined":59330,"single-down-arrow":59331,"single-left-arrow":59332,"single-right-arrow":59333,"single-up-arrow":59334,"speaker-active-outlined":59335,"speaker-outlined":59336,"star-circle-outlined":59337,"star-outlined":59338,"stopwatch-outlined":59339,"strikethrough":59340,"suitcase-clock-outlined":59341,"suitcase-outlined":59342,"survey-outlined":59343,"switch-outlined":59344,"sync":59345,"target-outlined":59346,"timesheet-outlined":59347,"today-outlined":59348,"transfer":59349,"trash-bin-outlined":59350,"umbrela-outlined":59351,"unavailable":59352,"underline":59353,"unlock-outlined":59354,"upload-outlined":59355,"user-circle-outlined":59356,"user-gear-outlined":59357,"user-outlined":59358,"user-rectangle-outlined":59359,"video-1-outlined":59360,"video-2-outlined":59361,"wallet-outlined":59362}
|
|
@@ -11,6 +11,7 @@ const IconList = [
|
|
|
11
11
|
'bank',
|
|
12
12
|
'bell',
|
|
13
13
|
'billing',
|
|
14
|
+
'bookmark-added',
|
|
14
15
|
'bookmark',
|
|
15
16
|
'box-check',
|
|
16
17
|
'box',
|
|
@@ -116,6 +117,7 @@ const IconList = [
|
|
|
116
117
|
'looks-two',
|
|
117
118
|
'media-content',
|
|
118
119
|
'menu',
|
|
120
|
+
'money-notes',
|
|
119
121
|
'moneybag',
|
|
120
122
|
'moon',
|
|
121
123
|
'multiple-stars',
|
|
@@ -144,6 +146,7 @@ const IconList = [
|
|
|
144
146
|
'speaker',
|
|
145
147
|
'star-award',
|
|
146
148
|
'star-badge',
|
|
149
|
+
'star-circle',
|
|
147
150
|
'star-medal',
|
|
148
151
|
'star',
|
|
149
152
|
'steps-circle',
|
|
@@ -182,7 +185,9 @@ const IconList = [
|
|
|
182
185
|
'arrow-rightwards',
|
|
183
186
|
'arrow-up',
|
|
184
187
|
'arrow-upwards',
|
|
188
|
+
'article-outlined',
|
|
185
189
|
'at-sign',
|
|
190
|
+
'auto-graph-outlined',
|
|
186
191
|
'bell-active-outlined',
|
|
187
192
|
'bell-outlined',
|
|
188
193
|
'bell-slash-outlined',
|
|
@@ -297,6 +302,7 @@ const IconList = [
|
|
|
297
302
|
'node-outlined',
|
|
298
303
|
'number-points',
|
|
299
304
|
'number',
|
|
305
|
+
'overview-outlined',
|
|
300
306
|
'payment-summary-outlined',
|
|
301
307
|
'payslip-outlined',
|
|
302
308
|
'pencil-outlined',
|
|
@@ -324,12 +330,14 @@ const IconList = [
|
|
|
324
330
|
'share-1',
|
|
325
331
|
'share-2',
|
|
326
332
|
'share-outlined',
|
|
333
|
+
'show-chart-outlined',
|
|
327
334
|
'single-down-arrow',
|
|
328
335
|
'single-left-arrow',
|
|
329
336
|
'single-right-arrow',
|
|
330
337
|
'single-up-arrow',
|
|
331
338
|
'speaker-active-outlined',
|
|
332
339
|
'speaker-outlined',
|
|
340
|
+
'star-circle-outlined',
|
|
333
341
|
'star-outlined',
|
|
334
342
|
'stopwatch-outlined',
|
|
335
343
|
'strikethrough',
|
|
@@ -1,26 +1,17 @@
|
|
|
1
1
|
import { useTheme } from '@emotion/react';
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
|
-
import { Dimensions, SectionList, View } from 'react-native';
|
|
4
|
-
import type { ReactElement } from 'react';
|
|
5
|
-
import type { SectionListRenderItemInfo } from 'react-native';
|
|
3
|
+
import { Dimensions, SectionList, SectionListProps, View } from 'react-native';
|
|
6
4
|
import SectionHeading from '../SectionHeading';
|
|
7
5
|
import Spinner from '../Spinner';
|
|
8
6
|
import { OptionSpacer, SectionSpacer, StyledSectionList } from './StyledSelect';
|
|
9
|
-
import type {
|
|
10
|
-
SectionData,
|
|
11
|
-
OptionType,
|
|
12
|
-
SelectProps,
|
|
13
|
-
SectionType,
|
|
14
|
-
} from './types';
|
|
7
|
+
import type { OptionType, SelectProps, SectionType } from './types';
|
|
15
8
|
|
|
16
9
|
export type BaseOptionListProps<V, T extends OptionType<V>> = Pick<
|
|
17
10
|
SelectProps<V, T>,
|
|
18
11
|
'keyExtractor' | 'loading' | 'onEndReached' | 'onQueryChange'
|
|
19
12
|
> & {
|
|
20
|
-
sections: SectionData<V, T>[];
|
|
21
|
-
renderItem: (info: SectionListRenderItemInfo<T, SectionType>) => ReactElement;
|
|
22
13
|
sectionListRef?: React.RefObject<SectionList<T, SectionType>>;
|
|
23
|
-
}
|
|
14
|
+
} & SectionListProps<T, SectionType>;
|
|
24
15
|
|
|
25
16
|
const BaseOptionList = <V, T extends OptionType<V>>({
|
|
26
17
|
keyExtractor,
|
|
@@ -30,6 +21,7 @@ const BaseOptionList = <V, T extends OptionType<V>>({
|
|
|
30
21
|
sections,
|
|
31
22
|
renderItem,
|
|
32
23
|
sectionListRef,
|
|
24
|
+
...rest
|
|
33
25
|
}: BaseOptionListProps<V, T>) => {
|
|
34
26
|
const theme = useTheme();
|
|
35
27
|
|
|
@@ -75,6 +67,7 @@ const BaseOptionList = <V, T extends OptionType<V>>({
|
|
|
75
67
|
renderItem={renderItem}
|
|
76
68
|
ItemSeparatorComponent={OptionSpacer}
|
|
77
69
|
SectionSeparatorComponent={SectionSpacer}
|
|
70
|
+
{...rest}
|
|
78
71
|
/>
|
|
79
72
|
);
|
|
80
73
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { SectionListRenderItemInfo
|
|
3
|
-
import BaseOptionList from '../BaseOptionList';
|
|
2
|
+
import type { SectionListRenderItemInfo } from 'react-native';
|
|
3
|
+
import BaseOptionList, { BaseOptionListProps } from '../BaseOptionList';
|
|
4
4
|
import Option from './Option';
|
|
5
5
|
import type { MultiSelectProps } from '.';
|
|
6
|
-
import type { OptionType,
|
|
6
|
+
import type { OptionType, SectionType } from '../types';
|
|
7
7
|
|
|
8
8
|
type OptionListProps<V, T extends OptionType<V>> = Pick<
|
|
9
9
|
MultiSelectProps<V, T>,
|
|
@@ -15,9 +15,7 @@ type OptionListProps<V, T extends OptionType<V>> = Pick<
|
|
|
15
15
|
| 'renderOption'
|
|
16
16
|
> & {
|
|
17
17
|
onPress: (value: V[]) => void;
|
|
18
|
-
|
|
19
|
-
sectionListRef?: React.RefObject<SectionList<T, SectionType>>;
|
|
20
|
-
};
|
|
18
|
+
} & BaseOptionListProps<V, T>;
|
|
21
19
|
|
|
22
20
|
const OptionList = <V, T extends OptionType<V>>({
|
|
23
21
|
keyExtractor,
|
|
@@ -29,6 +27,7 @@ const OptionList = <V, T extends OptionType<V>>({
|
|
|
29
27
|
renderOption,
|
|
30
28
|
value,
|
|
31
29
|
sectionListRef,
|
|
30
|
+
...rest
|
|
32
31
|
}: OptionListProps<V, T>) => {
|
|
33
32
|
const renderItem = (info: SectionListRenderItemInfo<T, SectionType>) => {
|
|
34
33
|
const { item } = info;
|
|
@@ -63,6 +62,7 @@ const OptionList = <V, T extends OptionType<V>>({
|
|
|
63
62
|
sections={sections}
|
|
64
63
|
renderItem={renderItem}
|
|
65
64
|
sectionListRef={sectionListRef}
|
|
65
|
+
{...rest}
|
|
66
66
|
/>
|
|
67
67
|
);
|
|
68
68
|
};
|
|
@@ -443,6 +443,7 @@ Array [
|
|
|
443
443
|
onScroll={[Function]}
|
|
444
444
|
onScrollBeginDrag={[Function]}
|
|
445
445
|
onScrollEndDrag={[Function]}
|
|
446
|
+
onScrollToIndexFailed={[Function]}
|
|
446
447
|
renderItem={[Function]}
|
|
447
448
|
scrollEventThrottle={50}
|
|
448
449
|
stickyHeaderIndices={
|
|
@@ -2013,6 +2014,7 @@ Array [
|
|
|
2013
2014
|
onScroll={[Function]}
|
|
2014
2015
|
onScrollBeginDrag={[Function]}
|
|
2015
2016
|
onScrollEndDrag={[Function]}
|
|
2017
|
+
onScrollToIndexFailed={[Function]}
|
|
2016
2018
|
renderItem={[Function]}
|
|
2017
2019
|
scrollEventThrottle={50}
|
|
2018
2020
|
stickyHeaderIndices={
|
|
@@ -3757,6 +3759,7 @@ Array [
|
|
|
3757
3759
|
onScroll={[Function]}
|
|
3758
3760
|
onScrollBeginDrag={[Function]}
|
|
3759
3761
|
onScrollEndDrag={[Function]}
|
|
3762
|
+
onScrollToIndexFailed={[Function]}
|
|
3760
3763
|
renderItem={[Function]}
|
|
3761
3764
|
scrollEventThrottle={50}
|
|
3762
3765
|
stickyHeaderIndices={
|
|
@@ -172,6 +172,15 @@ function MultiSelect<V, T extends OptionType<V>>({
|
|
|
172
172
|
value={selectingValue}
|
|
173
173
|
onPress={setSelectingValue}
|
|
174
174
|
sectionListRef={sectionListRef}
|
|
175
|
+
onScrollToIndexFailed={(info) => {
|
|
176
|
+
setTimeout(() => {
|
|
177
|
+
const scrollParams = getScrollParams(value?.[0], sections);
|
|
178
|
+
|
|
179
|
+
if (scrollParams.itemIndex < info.highestMeasuredFrameIndex) {
|
|
180
|
+
sectionListRef.current?.scrollToLocation(scrollParams);
|
|
181
|
+
}
|
|
182
|
+
}, 500);
|
|
183
|
+
}}
|
|
175
184
|
/>
|
|
176
185
|
</BottomSheet>
|
|
177
186
|
</>
|
|
@@ -2,8 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import type { SectionListRenderItemInfo, SectionList } from 'react-native';
|
|
3
3
|
import Option from './Option';
|
|
4
4
|
import type { SingleSelectProps } from '.';
|
|
5
|
-
import type { OptionType,
|
|
5
|
+
import type { OptionType, SectionType } from '../types';
|
|
6
6
|
import { StyledOptionList } from './StyledSingleSelect';
|
|
7
|
+
import { BaseOptionListProps } from '../BaseOptionList';
|
|
7
8
|
|
|
8
9
|
type OptionListProps<V, T extends OptionType<V>> = Pick<
|
|
9
10
|
SingleSelectProps<V, T>,
|
|
@@ -15,9 +16,8 @@ type OptionListProps<V, T extends OptionType<V>> = Pick<
|
|
|
15
16
|
| 'renderOption'
|
|
16
17
|
> & {
|
|
17
18
|
onPress: (value: V | null) => void;
|
|
18
|
-
sections: SectionData<V, T>[];
|
|
19
19
|
sectionListRef?: React.RefObject<SectionList<T, SectionType>>;
|
|
20
|
-
}
|
|
20
|
+
} & BaseOptionListProps<V, T>;
|
|
21
21
|
|
|
22
22
|
const OptionList = <V, T extends OptionType<V>>({
|
|
23
23
|
keyExtractor,
|
|
@@ -29,6 +29,7 @@ const OptionList = <V, T extends OptionType<V>>({
|
|
|
29
29
|
renderOption,
|
|
30
30
|
value,
|
|
31
31
|
sectionListRef,
|
|
32
|
+
...rest
|
|
32
33
|
}: OptionListProps<V, T>) => {
|
|
33
34
|
const renderItem = (info: SectionListRenderItemInfo<T, SectionType>) => {
|
|
34
35
|
const { item } = info;
|
|
@@ -63,6 +64,7 @@ const OptionList = <V, T extends OptionType<V>>({
|
|
|
63
64
|
sections={sections}
|
|
64
65
|
renderItem={renderItem}
|
|
65
66
|
sectionListRef={sectionListRef}
|
|
67
|
+
{...rest}
|
|
66
68
|
/>
|
|
67
69
|
);
|
|
68
70
|
};
|
|
@@ -66,7 +66,12 @@ exports[`OptionList render isLoading correctly 1`] = `
|
|
|
66
66
|
Object {
|
|
67
67
|
"paddingHorizontal": 12,
|
|
68
68
|
},
|
|
69
|
-
|
|
69
|
+
Array [
|
|
70
|
+
Object {
|
|
71
|
+
"paddingBottom": 16,
|
|
72
|
+
},
|
|
73
|
+
undefined,
|
|
74
|
+
],
|
|
70
75
|
]
|
|
71
76
|
}
|
|
72
77
|
>
|
|
@@ -843,7 +848,12 @@ exports[`OptionList renders correctly 1`] = `
|
|
|
843
848
|
Object {
|
|
844
849
|
"paddingHorizontal": 12,
|
|
845
850
|
},
|
|
846
|
-
|
|
851
|
+
Array [
|
|
852
|
+
Object {
|
|
853
|
+
"paddingBottom": 16,
|
|
854
|
+
},
|
|
855
|
+
undefined,
|
|
856
|
+
],
|
|
847
857
|
]
|
|
848
858
|
}
|
|
849
859
|
>
|
|
@@ -1467,7 +1477,12 @@ exports[`OptionList trigger onPress correctly on select new value 1`] = `
|
|
|
1467
1477
|
Object {
|
|
1468
1478
|
"paddingHorizontal": 12,
|
|
1469
1479
|
},
|
|
1470
|
-
|
|
1480
|
+
Array [
|
|
1481
|
+
Object {
|
|
1482
|
+
"paddingBottom": 16,
|
|
1483
|
+
},
|
|
1484
|
+
undefined,
|
|
1485
|
+
],
|
|
1471
1486
|
]
|
|
1472
1487
|
}
|
|
1473
1488
|
>
|
|
@@ -2091,7 +2106,12 @@ exports[`OptionList trigger onPress correctly on unselect current value 1`] = `
|
|
|
2091
2106
|
Object {
|
|
2092
2107
|
"paddingHorizontal": 12,
|
|
2093
2108
|
},
|
|
2094
|
-
|
|
2109
|
+
Array [
|
|
2110
|
+
Object {
|
|
2111
|
+
"paddingBottom": 16,
|
|
2112
|
+
},
|
|
2113
|
+
undefined,
|
|
2114
|
+
],
|
|
2095
2115
|
]
|
|
2096
2116
|
}
|
|
2097
2117
|
>
|
|
@@ -442,6 +442,7 @@ Array [
|
|
|
442
442
|
onScroll={[Function]}
|
|
443
443
|
onScrollBeginDrag={[Function]}
|
|
444
444
|
onScrollEndDrag={[Function]}
|
|
445
|
+
onScrollToIndexFailed={[Function]}
|
|
445
446
|
renderItem={[Function]}
|
|
446
447
|
scrollEventThrottle={50}
|
|
447
448
|
stickyHeaderIndices={
|
|
@@ -455,7 +456,12 @@ Array [
|
|
|
455
456
|
Object {
|
|
456
457
|
"paddingHorizontal": 12,
|
|
457
458
|
},
|
|
458
|
-
|
|
459
|
+
Array [
|
|
460
|
+
Object {
|
|
461
|
+
"paddingBottom": 16,
|
|
462
|
+
},
|
|
463
|
+
undefined,
|
|
464
|
+
],
|
|
459
465
|
]
|
|
460
466
|
}
|
|
461
467
|
>
|
|
@@ -1933,6 +1939,7 @@ Array [
|
|
|
1933
1939
|
onScroll={[Function]}
|
|
1934
1940
|
onScrollBeginDrag={[Function]}
|
|
1935
1941
|
onScrollEndDrag={[Function]}
|
|
1942
|
+
onScrollToIndexFailed={[Function]}
|
|
1936
1943
|
renderItem={[Function]}
|
|
1937
1944
|
scrollEventThrottle={50}
|
|
1938
1945
|
stickyHeaderIndices={
|
|
@@ -1945,7 +1952,12 @@ Array [
|
|
|
1945
1952
|
Object {
|
|
1946
1953
|
"paddingHorizontal": 12,
|
|
1947
1954
|
},
|
|
1948
|
-
|
|
1955
|
+
Array [
|
|
1956
|
+
Object {
|
|
1957
|
+
"paddingBottom": 16,
|
|
1958
|
+
},
|
|
1959
|
+
undefined,
|
|
1960
|
+
],
|
|
1949
1961
|
]
|
|
1950
1962
|
}
|
|
1951
1963
|
>
|
|
@@ -3544,6 +3556,7 @@ Array [
|
|
|
3544
3556
|
onScroll={[Function]}
|
|
3545
3557
|
onScrollBeginDrag={[Function]}
|
|
3546
3558
|
onScrollEndDrag={[Function]}
|
|
3559
|
+
onScrollToIndexFailed={[Function]}
|
|
3547
3560
|
renderItem={[Function]}
|
|
3548
3561
|
scrollEventThrottle={50}
|
|
3549
3562
|
stickyHeaderIndices={
|
|
@@ -3557,7 +3570,12 @@ Array [
|
|
|
3557
3570
|
Object {
|
|
3558
3571
|
"paddingHorizontal": 12,
|
|
3559
3572
|
},
|
|
3560
|
-
|
|
3573
|
+
Array [
|
|
3574
|
+
Object {
|
|
3575
|
+
"paddingBottom": 16,
|
|
3576
|
+
},
|
|
3577
|
+
undefined,
|
|
3578
|
+
],
|
|
3561
3579
|
]
|
|
3562
3580
|
}
|
|
3563
3581
|
>
|
|
@@ -134,6 +134,14 @@ const SingleSelect = <V, T extends OptionType<V>>({
|
|
|
134
134
|
onConfirm(selectedValue);
|
|
135
135
|
}}
|
|
136
136
|
sectionListRef={sectionListRef}
|
|
137
|
+
onScrollToIndexFailed={(info) => {
|
|
138
|
+
setTimeout(() => {
|
|
139
|
+
const scrollParams = getScrollParams(value, sections);
|
|
140
|
+
if (scrollParams.itemIndex < info.highestMeasuredFrameIndex) {
|
|
141
|
+
sectionListRef.current?.scrollToLocation(scrollParams);
|
|
142
|
+
}
|
|
143
|
+
}, 500);
|
|
144
|
+
}}
|
|
137
145
|
/>
|
|
138
146
|
</BottomSheet>
|
|
139
147
|
</>
|