Jose-cd / React-google-drive-picker

58 stars 70 forks source link

openPicker property 'supportDrives: false' displays shared drives. #58

Closed R3GENERATion closed 4 months ago

R3GENERATion commented 1 year ago

If I'm reading the documentation correctly, the sharedDrives property passed into openPicker (referring to example provided on npm) is supposed to toggle shared drives, with the default reading false. This property doesn't seem to have any effect on the outcome of the picker presented, specifying false continues to show files shared to your drive.

How are we getting around this? What should I be doing to this example to display only files owned by the user?

import  { useEffect } from 'react';
import useDrivePicker from 'react-google-drive-picker'

function App() {
  const [openPicker, authResponse] = useDrivePicker();  
  // const customViewsArray = [new google.picker.DocsView()]; // custom view
  const handleOpenPicker = () => {
    openPicker({
      clientId: "xxxxxxxxxxxxxxxxx",
      developerKey: "xxxxxxxxxxxx",
      viewId: "DOCS",
      // token: token, // pass oauth token in case you already have one
      showUploadView: true,
      showUploadFolders: true,
      supportDrives: true,
      multiselect: true,
      // customViews: customViewsArray, // custom view
      callbackFunction: (data) => {
        if (data.action === 'cancel') {
          console.log('User clicked cancel/close button')
        }
        console.log(data)
      },
    })
  }

  return (
    <div>
        <button onClick={() => handleOpenPicker()}>Open Picker</button>
    </div>
  );
}

export default App;
jay-cascade commented 5 months ago

I am experiencing the same issue, setting the value to false or removing it still presents files outside of my drive!

@R3GENERATion , did you find a workaround?

jay-cascade commented 5 months ago

I found a fork of this project which resolves my issue.

R3GENERATion commented 4 months ago

Thank you, the result was fine for my purposes. Thanks for sharing!