Skip to content

Commit

Permalink
added SetStateAction to types in index.d.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
taeh98 committed Sep 5, 2023
1 parent b20d19f commit 41bc9c7
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
declare module 'react-native-dropdown-picker' {

Check failure on line 1 in index.d.ts

View workflow job for this annotation

GitHub Actions / Lint source files

Missing @file
import { Dispatch, JSX, PropsWithoutRef, ReactElement } from 'react';
import {
Dispatch,
JSX,
PropsWithoutRef,
ReactElement,
SetStateAction,
} from 'react';
import {
FlatListProps,
LayoutChangeEvent,
Expand All @@ -14,9 +20,6 @@ declare module 'react-native-dropdown-picker' {
ViewStyle,
} from 'react-native';

type SetStateCallback<S> = (prevState: S) => S;
type SetStateValue<S> = (prevState: S) => S;

export type ValueType = string | number | boolean;

export type ItemType<T extends ValueType> = {
Expand Down Expand Up @@ -155,9 +158,9 @@ declare module 'react-native-dropdown-picker' {

export interface DropDownPickerBaseProps<T extends ValueType> {
items: Array<ItemType<T>>;
setItems?: Dispatch<SetStateCallback<Array<ItemType<T>>>>;
setItems?: Dispatch<SetStateAction<Array<ItemType<T>>>>;
open: boolean;
setOpen: Dispatch<SetStateValue<boolean>>;
setOpen: Dispatch<SetStateAction<boolean>>;
activityIndicatorColor?: string;
ActivityIndicatorComponent?: (
props: ActivityIndicatorComponentPropsInterface,
Expand Down Expand Up @@ -278,15 +281,15 @@ declare module 'react-native-dropdown-picker' {
multiple?: false;
onChangeValue?: (value: T | null) => void;
onSelectItem?: (item: ItemType<T>) => void;
setValue: Dispatch<SetStateCallback<T | null>>;
setValue: Dispatch<SetStateAction<T | null>>;
value: T | null;
}

interface DropDownPickerMultipleProps<T extends ValueType> {
multiple: true;
onChangeValue?: (value: Array<T> | null) => void;
onSelectItem?: (items: Array<ItemType<T>>) => void;
setValue: Dispatch<SetStateCallback<Array<T> | null>>;
setValue: Dispatch<SetStateAction<Array<T> | null>>;
value: Array<T> | null;
}

Expand Down

0 comments on commit 41bc9c7

Please sign in to comment.