@@ -133,15 +133,15 @@ type FilterRadioProps<T> = {
133
133
onValueChange : ( value : T | undefined ) => void ;
134
134
} ;
135
135
136
- function FilterRadio < T > ( {
136
+ const FilterRadio = < T , > ( {
137
137
label,
138
138
items,
139
139
width,
140
140
value,
141
141
onValueChange,
142
142
onPressRemove,
143
143
autoOpen = false ,
144
- } : FilterRadioProps < T > ) {
144
+ } : FilterRadioProps < T > ) => {
145
145
const inputRef = useRef < View > ( null ) ;
146
146
const [ visible , { close, toggle } ] = useDisclosure ( autoOpen ) ;
147
147
const currentValue = useMemo ( ( ) => items . find ( i => i . value === value ) , [ items , value ] ) ;
@@ -194,7 +194,7 @@ function FilterRadio<T>({
194
194
</ Popover >
195
195
</ View >
196
196
) ;
197
- }
197
+ } ;
198
198
199
199
type FilterCheckboxProps < T > = {
200
200
label : string ;
@@ -212,7 +212,7 @@ type CheckAllItem = {
212
212
checked : boolean | "mixed" ;
213
213
} ;
214
214
215
- function FilterCheckbox < T > ( {
215
+ const FilterCheckbox = < T , > ( {
216
216
label,
217
217
items,
218
218
width,
@@ -221,7 +221,7 @@ function FilterCheckbox<T>({
221
221
onValueChange,
222
222
onPressRemove,
223
223
autoOpen = false ,
224
- } : FilterCheckboxProps < T > ) {
224
+ } : FilterCheckboxProps < T > ) => {
225
225
const inputRef = useRef < View > ( null ) ;
226
226
const [ visible , { close, toggle } ] = useDisclosure ( autoOpen ) ;
227
227
@@ -323,7 +323,7 @@ function FilterCheckbox<T>({
323
323
</ Popover >
324
324
</ View >
325
325
) ;
326
- }
326
+ } ;
327
327
328
328
type FilterDateProps = {
329
329
label : string ;
@@ -339,7 +339,7 @@ type FilterDateProps = {
339
339
autoOpen ?: boolean ;
340
340
} ;
341
341
342
- function FilterDate ( {
342
+ const FilterDate = ( {
343
343
label,
344
344
initialValue,
345
345
noValueText,
@@ -351,7 +351,7 @@ function FilterDate({
351
351
onValueChange,
352
352
onPressRemove,
353
353
autoOpen = false ,
354
- } : FilterDateProps ) {
354
+ } : FilterDateProps ) => {
355
355
const inputRef = useRef < View > ( null ) ;
356
356
const [ visible , { close, toggle } ] = useDisclosure ( autoOpen ) ;
357
357
@@ -389,7 +389,7 @@ function FilterDate({
389
389
/>
390
390
</ View >
391
391
) ;
392
- }
392
+ } ;
393
393
394
394
type FilterInputProps = {
395
395
label : string ;
@@ -402,7 +402,7 @@ type FilterInputProps = {
402
402
autoOpen ?: boolean ;
403
403
} ;
404
404
405
- function FilterInput ( {
405
+ const FilterInput = ( {
406
406
label,
407
407
initialValue = "" ,
408
408
noValueText,
@@ -411,7 +411,7 @@ function FilterInput({
411
411
validate,
412
412
onValueChange,
413
413
onPressRemove,
414
- } : FilterInputProps ) {
414
+ } : FilterInputProps ) => {
415
415
const [ visible , { close, toggle } ] = useDisclosure ( autoOpen ) ;
416
416
const tagRef = useRef < View > ( null ) ;
417
417
@@ -480,7 +480,7 @@ function FilterInput({
480
480
</ Popover >
481
481
</ View >
482
482
) ;
483
- }
483
+ } ;
484
484
485
485
export type FilterCheckboxDef < T > = {
486
486
type : "checkbox" ;
@@ -522,9 +522,7 @@ type ExtractFilterValue<T extends Filter<unknown>> = T extends { type: "checkbox
522
522
? T [ "items" ] [ number ] [ "value" ] [ ] | undefined
523
523
: T extends { type : "radio" }
524
524
? T [ "items" ] [ number ] [ "value" ] | undefined
525
- : T extends { type : "boolean" }
526
- ? boolean | undefined
527
- : string | undefined ;
525
+ : string | undefined ;
528
526
529
527
const getFilterValue = < T extends Filter < unknown > [ "type" ] > (
530
528
_type : T ,
@@ -557,6 +555,7 @@ export const FiltersStack = <T extends FiltersDefinition>({
557
555
onChangeFilters,
558
556
} : FiltersStackProps < T > ) => {
559
557
const previousOpened = usePreviousValue ( openedFilters ) ;
558
+
560
559
const lastOpenedFilter =
561
560
openedFilters . length > previousOpened . length
562
561
? openedFilters [ openedFilters . length - 1 ]
0 commit comments