picker icon indicating copy to clipboard operation
picker copied to clipboard

Expose PickerProps and PickerItemProps types

Open amiratak88 opened this issue 5 years ago • 1 comments

Feature request

Expose PickerProps and PickerItemProps types in the declaration files

Why it is needed

I'm trying to write a wrapper for this so it works similarly to how a select tag works in iOS (which is a good feature to add in itself IMO) and need to accept these props for that wrapper.

This is what I'm doing at the moment.

import { PickerProps } from 'node_modules/@react-native-community/picker/typings/Picker';

amiratak88 avatar Jul 29 '20 15:07 amiratak88

I was able to get the type using TypeScript's ConstructorParameters utility type which is a safer alternative.

import { Picker } from '@react-native-community/picker';
type PickerProps = ConstructorParameters<typeof Picker>[0];

amiratak88 avatar Aug 17 '20 18:08 amiratak88