Skip to content

Commit e3f4d09

Browse files
authored
fix: corrected SetStateCallback and SetStateValue to SetStateAction in types (#705)
* sorted items in LanguageType * added SetStateAction to types in index.d.ts
1 parent 83a0adc commit e3f4d09

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

index.d.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
declare module 'react-native-dropdown-picker' {
2-
import { Dispatch, JSX, PropsWithoutRef, ReactElement } from 'react';
2+
import {
3+
Dispatch,
4+
JSX,
5+
PropsWithoutRef,
6+
ReactElement,
7+
SetStateAction,
8+
} from 'react';
39
import {
410
FlatListProps,
511
LayoutChangeEvent,
@@ -14,9 +20,6 @@ declare module 'react-native-dropdown-picker' {
1420
ViewStyle,
1521
} from 'react-native';
1622

17-
type SetStateCallback<S> = (prevState: S) => S;
18-
type SetStateValue<S> = (prevState: S) => S;
19-
2023
export type ValueType = string | number | boolean;
2124

2225
export type ItemType<T extends ValueType> = {
@@ -70,10 +73,10 @@ declare module 'react-native-dropdown-picker' {
7073
| 'FR'
7174
| 'ID'
7275
| 'IT'
76+
| 'KO'
7377
| 'PT'
7478
| 'RU'
75-
| 'TR'
76-
| 'KO';
79+
| 'TR';
7780

7881
export interface TranslationInterface {
7982
NOTHING_TO_SHOW: string;
@@ -155,9 +158,9 @@ declare module 'react-native-dropdown-picker' {
155158

156159
export interface DropDownPickerBaseProps<T extends ValueType> {
157160
items: Array<ItemType<T>>;
158-
setItems?: Dispatch<SetStateCallback<Array<ItemType<T>>>>;
161+
setItems?: Dispatch<SetStateAction<Array<ItemType<T>>>>;
159162
open: boolean;
160-
setOpen: Dispatch<SetStateValue<boolean>>;
163+
setOpen: Dispatch<SetStateAction<boolean>>;
161164
activityIndicatorColor?: string;
162165
ActivityIndicatorComponent?: (
163166
props: ActivityIndicatorComponentPropsInterface,
@@ -278,15 +281,15 @@ declare module 'react-native-dropdown-picker' {
278281
multiple?: false;
279282
onChangeValue?: (value: T | null) => void;
280283
onSelectItem?: (item: ItemType<T>) => void;
281-
setValue: Dispatch<SetStateCallback<T | null>>;
284+
setValue: Dispatch<SetStateAction<T | null>>;
282285
value: T | null;
283286
}
284287

285288
interface DropDownPickerMultipleProps<T extends ValueType> {
286289
multiple: true;
287290
onChangeValue?: (value: Array<T> | null) => void;
288291
onSelectItem?: (items: Array<ItemType<T>>) => void;
289-
setValue: Dispatch<SetStateCallback<Array<T> | null>>;
292+
setValue: Dispatch<SetStateAction<Array<T> | null>>;
290293
value: Array<T> | null;
291294
}
292295

0 commit comments

Comments
 (0)