react-native-multiple-image-picker
react-native-multiple-image-picker copied to clipboard
Type mismatch openPicker using singleSelectedMode
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch @baronha/[email protected] for the project I'm working on.
I notice that openPicker type is not correct in TypeScript. I want to use singleSelectedMode, but TypeScript suggests MultiPicker.
Here is the diff that solved my problem:
diff --git a/node_modules/@baronha/react-native-multiple-image-picker/src/index.d.ts b/node_modules/@baronha/react-native-multiple-image-picker/src/index.d.ts
index 690360c..f8ec0d3 100644
--- a/node_modules/@baronha/react-native-multiple-image-picker/src/index.d.ts
+++ b/node_modules/@baronha/react-native-multiple-image-picker/src/index.d.ts
@@ -93,16 +93,15 @@ interface MediaTypeResults {
[MediaType.ALL]: ImageResults | VideoResults;
}
-export type IOpenPicker = <T extends MediaType = MediaType.ALL>(
- options: MultiPickerOptions & MediaTypeOptions[T] & Options<T>
-) => Promise<MediaTypeResults[T][]>;
-
type MultipleImagePickerType = {
- openPicker: IOpenPicker;
+ openPicker<T extends MediaType = MediaType.ALL>(
+ options: MultiPickerOptions & MediaTypeOptions[T] & Options<T>
+ ): Promise<MediaTypeResults[T][]>;
+ openPicker<T extends MediaType = MediaType.ALL>(
+ options: SinglePickerOptions & MediaTypeOptions[T] & Options<T>
+ ): Promise<MediaTypeResults[T]>;
};
const { MultipleImagePicker } = NativeModules;
-export const { openPicker } = MultipleImagePicker as MultipleImagePickerType;
-
export default MultipleImagePicker as MultipleImagePickerType;
This issue body was partially generated by patch-package.
It would be great if I could get PR from you
Thanks! I make PR #132