From e3f4d09bf99bd01f59173cc6a1e2e1719f2cf0c8 Mon Sep 17 00:00:00 2001 From: Tom <28008958+taeh98@users.noreply.github.com> Date: Tue, 5 Sep 2023 13:00:33 +0100 Subject: [PATCH] fix: corrected SetStateCallback and SetStateValue to SetStateAction in types (#705) * sorted items in LanguageType * added SetStateAction to types in index.d.ts --- index.d.ts | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/index.d.ts b/index.d.ts index 1c4a052..edcb3ce 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,5 +1,11 @@ declare module 'react-native-dropdown-picker' { - import { Dispatch, JSX, PropsWithoutRef, ReactElement } from 'react'; + import { + Dispatch, + JSX, + PropsWithoutRef, + ReactElement, + SetStateAction, + } from 'react'; import { FlatListProps, LayoutChangeEvent, @@ -14,9 +20,6 @@ declare module 'react-native-dropdown-picker' { ViewStyle, } from 'react-native'; - type SetStateCallback = (prevState: S) => S; - type SetStateValue = (prevState: S) => S; - export type ValueType = string | number | boolean; export type ItemType = { @@ -70,10 +73,10 @@ declare module 'react-native-dropdown-picker' { | 'FR' | 'ID' | 'IT' + | 'KO' | 'PT' | 'RU' - | 'TR' - | 'KO'; + | 'TR'; export interface TranslationInterface { NOTHING_TO_SHOW: string; @@ -155,9 +158,9 @@ declare module 'react-native-dropdown-picker' { export interface DropDownPickerBaseProps { items: Array>; - setItems?: Dispatch>>>; + setItems?: Dispatch>>>; open: boolean; - setOpen: Dispatch>; + setOpen: Dispatch>; activityIndicatorColor?: string; ActivityIndicatorComponent?: ( props: ActivityIndicatorComponentPropsInterface, @@ -278,7 +281,7 @@ declare module 'react-native-dropdown-picker' { multiple?: false; onChangeValue?: (value: T | null) => void; onSelectItem?: (item: ItemType) => void; - setValue: Dispatch>; + setValue: Dispatch>; value: T | null; } @@ -286,7 +289,7 @@ declare module 'react-native-dropdown-picker' { multiple: true; onChangeValue?: (value: Array | null) => void; onSelectItem?: (items: Array>) => void; - setValue: Dispatch | null>>; + setValue: Dispatch | null>>; value: Array | null; }