1.0.2 • Published 2 years ago

rc-g-picker v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

React Google Picker

npm version

A React wrapper component for the Google Picker API that lets the user authenitcate and choose a file from Google Drive .

Installation

Install the module

npm install rc-g-picker --save

Usage

import RCGPicker from "rc-g-picker";

<RCGPicker {...props} />;

Props

PropTypeDefaultDescription
clientIdstringnullThe client ID of the application.
developerKeystringnullThe developer key of the application.
scopestringnullThe scope of the application.
onChangefunctionnullThe callback function that is called when the user selects a file.
onAuthFailedfunctionnullThe callback function that is called when the user fails to authenticate.
onAuthFailedfunctionnullThe callback function that is called when the authentication fails
offlinebooleanfalseIf enabled, the onAuthenticate response will include a code and an access token
multiselectbooleanfalseIf enabled, the user can select multiple files.
viewIdstringnullThe view ID of the picker.
mimeTypesstring[]nullThe mimetypes of the files to be choosen
originstringnullThe origin of the picker.
childrennodenullThe children of the component.
buttonTitlestringnullThe title of the button in case no children provided.
querystringnullThe query to be used in the picker.

Note

Please note that the Google Picker API is not available in all countries. For more information, please refer to the Google Picker API documentation.

Please do not forget to add the gapi init code in your app, Example Below:

import { gapi } from "gapi-script";


  gapi.load("client:auth2", () => {
      gapi.client.init({
        clientId:
          "YOUR_CLIENT_ID",
      });
    });

This package is influenced by react-google-picker but extended to support more features and allow code generation.