react-google-picker
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -13,2 +13,6 @@ 'use strict'; | ||
var _propTypes = require('prop-types'); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
var _loadScript = require('load-script'); | ||
@@ -113,2 +117,4 @@ | ||
this.props.onAuthenticate(oauthToken); | ||
if (this.props.createPicker) { | ||
@@ -164,17 +170,19 @@ return this.props.createPicker(google, oauthToken); | ||
GoogleChooser.propTypes = { | ||
children: _react2.default.PropTypes.node, | ||
clientId: _react2.default.PropTypes.string.isRequired, | ||
developerKey: _react2.default.PropTypes.string.isRequired, | ||
scope: _react2.default.PropTypes.array, | ||
viewId: _react2.default.PropTypes.string, | ||
authImmediate: _react2.default.PropTypes.bool, | ||
origin: _react2.default.PropTypes.string, | ||
onChange: _react2.default.PropTypes.func, | ||
createPicker: _react2.default.PropTypes.func, | ||
multiselect: _react2.default.PropTypes.bool, | ||
navHidden: _react2.default.PropTypes.bool, | ||
disabled: _react2.default.PropTypes.bool | ||
children: _propTypes2.default.node, | ||
clientId: _propTypes2.default.string.isRequired, | ||
developerKey: _propTypes2.default.string.isRequired, | ||
scope: _propTypes2.default.array, | ||
viewId: _propTypes2.default.string, | ||
authImmediate: _propTypes2.default.bool, | ||
origin: _propTypes2.default.string, | ||
onChange: _propTypes2.default.func, | ||
onAuthenticate: _propTypes2.default.func, | ||
createPicker: _propTypes2.default.func, | ||
multiselect: _propTypes2.default.bool, | ||
navHidden: _propTypes2.default.bool, | ||
disabled: _propTypes2.default.bool | ||
}; | ||
GoogleChooser.defaultProps = { | ||
onChange: function onChange() {}, | ||
onAuthenticate: function onAuthenticate() {}, | ||
scope: ['https://www.googleapis.com/auth/drive.readonly'], | ||
@@ -181,0 +189,0 @@ viewId: 'DOCS', |
{ | ||
"name": "react-google-picker", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Simple react wrapper for google picker API", | ||
@@ -42,2 +42,3 @@ "main": "dist/react-google-picker.js", | ||
"express": "^4.13.4", | ||
"prop-types": "^15.6.0", | ||
"react": "^15.4.0", | ||
@@ -44,0 +45,0 @@ "react-dom": "^15.4.0", |
@@ -27,4 +27,25 @@ React google picker | ||
## Custom build method | ||
You can override the default build function by passing your custom function which receives two arguments: | ||
## Authentication token | ||
You might want to get the Oauth token in order to use it later, for example | ||
in order to [download the selected file](https://developers.google.com/drive/v3/web/manage-downloads). | ||
You can do so by using `onAuthenticate`: | ||
``` | ||
<GooglePicker clientId={'your-client-id'} | ||
developerKey={'your-developer-key'} | ||
scope={['https://www.googleapis.com/auth/drive.readonly']} | ||
onChange={data => console.log('on change:', data)} | ||
onAuthenticate={token => console.log('oauth token:', token)} | ||
multiselect={true} | ||
navHidden={true} | ||
authImmediate={false} | ||
mimeTypes={['image/png', 'image/jpeg', 'image/jpg']} | ||
viewId={'DOCS'}> | ||
<MyCustomButton /> | ||
</GooglePicker> | ||
``` | ||
## Custom build method | ||
You can override the default build function by passing your custom function which receives two arguments: | ||
- `google`: a reference to the window.google object. | ||
@@ -63,3 +84,3 @@ - `access_token`: which you will need to pass to `setOAuthToken` method. | ||
``` | ||
This example creates a picker which shows folders and you can select folders. | ||
This example creates a picker which shows folders and you can select folders. | ||
@@ -66,0 +87,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41523
197
97
15