From 478fa67d8d3e8d674e177146def964a4bbf12ee2 Mon Sep 17 00:00:00 2001 From: Anuj Kapoor Date: Tue, 18 Jun 2024 18:43:26 +0530 Subject: [PATCH] Adding support to show shared drives on the picker --- package-lock.json | 4 ++-- src/index.tsx | 2 ++ src/typeDefs.ts | 15 ++++++++------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 14a56dd..faf4312 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "react-google-drive-picker", - "version": "1.2.1", + "version": "1.2.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "react-google-drive-picker", - "version": "1.2.1", + "version": "1.2.2", "license": "MIT", "devDependencies": { "@types/react": "^17.0.5", diff --git a/src/index.tsx b/src/index.tsx index 62e1fe3..2e70f6f 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -118,6 +118,7 @@ export default function useDrivePicker(): [ setIncludeFolders, setSelectFolderEnabled, disableDefaultView = false, + setEnableDrives, callbackFunction, }: PickerConfiguration) => { if (disabled) return false @@ -126,6 +127,7 @@ export default function useDrivePicker(): [ if (viewMimeTypes) view.setMimeTypes(viewMimeTypes) if (setIncludeFolders) view.setIncludeFolders(true) if (setSelectFolderEnabled) view.setSelectFolderEnabled(true) + if (setEnableDrives) view.setEnableDrives(true) const uploadView = new google.picker.DocsUploadView() if (viewMimeTypes) uploadView.setMimeTypes(viewMimeTypes) diff --git a/src/typeDefs.ts b/src/typeDefs.ts index cd169f3..520e471 100644 --- a/src/typeDefs.ts +++ b/src/typeDefs.ts @@ -23,13 +23,13 @@ export type PickerCallback = { docs: CallbackDoc[] } -export type authResult = { - access_token: string; - token_type: string; - expires_in: number; - scope: string; - authuser: string; - prompt: string; +export type authResult = { + access_token: string + token_type: string + expires_in: number + scope: string + authuser: string + prompt: string } type ViewIdOptions = @@ -66,6 +66,7 @@ export type PickerConfiguration = { customViews?: any[] locale?: string customScopes?: string[] + setEnableDrives?: boolean callbackFunction: (data: PickerCallback) => any }