Commit ccb3145a authored by Andrea Ascari's avatar Andrea Ascari Committed by zooble

Made callback for isPickerShow optional (#296)

parent 358d080a
...@@ -5,15 +5,15 @@ ...@@ -5,15 +5,15 @@
/** /**
* Options to create a picker object * Options to create a picker object
* *
* @interface PickerOptions * @interface PickerOptions
*/ */
interface PickerOptions { interface PickerOptions {
/** /**
* Items to be passed into the picker * Items to be passed into the picker
* *
* Default is an empty array * Default is an empty array
* *
* @type {any[]} * @type {any[]}
* @memberof PickerOptions * @memberof PickerOptions
*/ */
...@@ -21,12 +21,12 @@ interface PickerOptions { ...@@ -21,12 +21,12 @@ interface PickerOptions {
/** /**
* The selected item in the picker * The selected item in the picker
* *
* Accepts the item in an array * Accepts the item in an array
* Example: ['selected'] * Example: ['selected']
* *
* Default is an empty array * Default is an empty array
* *
* @type {any[]} * @type {any[]}
* @memberof PickerOptions * @memberof PickerOptions
*/ */
...@@ -34,9 +34,9 @@ interface PickerOptions { ...@@ -34,9 +34,9 @@ interface PickerOptions {
/** /**
* Title text shown at the top of the picker * Title text shown at the top of the picker
* *
* Default value is 'pls select' * Default value is 'pls select'
* *
* @type {string} * @type {string}
* @memberof PickerOptions * @memberof PickerOptions
*/ */
...@@ -44,9 +44,9 @@ interface PickerOptions { ...@@ -44,9 +44,9 @@ interface PickerOptions {
/** /**
* Text for the confirm button * Text for the confirm button
* *
* Default value is 'confirm' * Default value is 'confirm'
* *
* @type {string} * @type {string}
* @memberof PickerOptions * @memberof PickerOptions
*/ */
...@@ -54,9 +54,9 @@ interface PickerOptions { ...@@ -54,9 +54,9 @@ interface PickerOptions {
/** /**
* Text for the cancel button * Text for the cancel button
* *
* Default value is 'cancel' * Default value is 'cancel'
* *
* @type {string} * @type {string}
* @memberof PickerOptions * @memberof PickerOptions
*/ */
...@@ -64,12 +64,12 @@ interface PickerOptions { ...@@ -64,12 +64,12 @@ interface PickerOptions {
/** /**
* The color of the text for the confirm button * The color of the text for the confirm button
* *
* Accepts rgba values as an array * Accepts rgba values as an array
* [R, G, B, A] * [R, G, B, A]
* *
* Default is [1, 186, 245, 1] * Default is [1, 186, 245, 1]
* *
* @type {number[]} * @type {number[]}
* @memberof PickerOptions * @memberof PickerOptions
*/ */
...@@ -77,12 +77,12 @@ interface PickerOptions { ...@@ -77,12 +77,12 @@ interface PickerOptions {
/** /**
* The color of the text for the cancel button * The color of the text for the cancel button
* *
* Accepts rgba values as an array * Accepts rgba values as an array
* [R, G, B, A] * [R, G, B, A]
* *
* Default is [1, 186, 245, 1] * Default is [1, 186, 245, 1]
* *
* @type {number[]} * @type {number[]}
* @memberof PickerOptions * @memberof PickerOptions
*/ */
...@@ -90,12 +90,12 @@ interface PickerOptions { ...@@ -90,12 +90,12 @@ interface PickerOptions {
/** /**
* The color of the Title text * The color of the Title text
* *
* Accepts rgba values as an array * Accepts rgba values as an array
* [R, G, B, A] * [R, G, B, A]
* *
* Default is [20, 20, 20, 1] * Default is [20, 20, 20, 1]
* *
* @type {number[]} * @type {number[]}
* @memberof PickerOptions * @memberof PickerOptions
*/ */
...@@ -103,12 +103,12 @@ interface PickerOptions { ...@@ -103,12 +103,12 @@ interface PickerOptions {
/** /**
* The background color of the toobar * The background color of the toobar
* *
* Accepts rgba values as an array * Accepts rgba values as an array
* [R, G, B, A] * [R, G, B, A]
* *
* Default is [232, 232, 232, 1] * Default is [232, 232, 232, 1]
* *
* @type {number[]} * @type {number[]}
* @memberof PickerOptions * @memberof PickerOptions
*/ */
...@@ -116,12 +116,12 @@ interface PickerOptions { ...@@ -116,12 +116,12 @@ interface PickerOptions {
/** /**
* Background color of the picker * Background color of the picker
* *
* Accepts rgba values as an array * Accepts rgba values as an array
* [R, G, B, A] * [R, G, B, A]
* *
* Default is [196, 199, 206, 1] * Default is [196, 199, 206, 1]
* *
* @type {number[]} * @type {number[]}
* @memberof PickerOptions * @memberof PickerOptions
*/ */
...@@ -130,9 +130,9 @@ interface PickerOptions { ...@@ -130,9 +130,9 @@ interface PickerOptions {
/** /**
* Font size of the items in the toolbar * Font size of the items in the toolbar
* *
* Default is 16 * Default is 16
* *
* @type {number} * @type {number}
* @memberof PickerOptions * @memberof PickerOptions
*/ */
...@@ -140,9 +140,9 @@ interface PickerOptions { ...@@ -140,9 +140,9 @@ interface PickerOptions {
/** /**
* Font size of the items in the picker * Font size of the items in the picker
* *
* Default is 16 * Default is 16
* *
* @type {number} * @type {number}
* @memberof PickerOptions * @memberof PickerOptions
*/ */
...@@ -150,9 +150,9 @@ interface PickerOptions { ...@@ -150,9 +150,9 @@ interface PickerOptions {
/** /**
* Row height of the items in the picker * Row height of the items in the picker
* *
* Default is 24 * Default is 24
* *
* @type {number} * @type {number}
* @memberof PickerOptions * @memberof PickerOptions
*/ */
...@@ -160,12 +160,12 @@ interface PickerOptions { ...@@ -160,12 +160,12 @@ interface PickerOptions {
/** /**
* Color of the text for the items in the picker * Color of the text for the items in the picker
* *
* Accepts rgba values as an array * Accepts rgba values as an array
* [R, G, B, A] * [R, G, B, A]
* *
* Default is [31, 31, 31, 1] * Default is [31, 31, 31, 1]
* *
* @type {number[]} * @type {number[]}
* @memberof PickerOptions * @memberof PickerOptions
*/ */
...@@ -173,22 +173,22 @@ interface PickerOptions { ...@@ -173,22 +173,22 @@ interface PickerOptions {
/** /**
* Event fired when user confirms the picker * Event fired when user confirms the picker
* *
* Returns the selected item * Returns the selected item
* *
* @param {any[]} item * @param {any[]} item
* *
* @memberof PickerOptions * @memberof PickerOptions
*/ */
onPickerConfirm?(item: any[]): void onPickerConfirm?(item: any[]): void
/** /**
* Event fired when user cancels the picker * Event fired when user cancels the picker
* *
* Returns the selected item * Returns the selected item
* *
* @param {any[]} item * @param {any[]} item
* *
* @memberof PickerOptions * @memberof PickerOptions
*/ */
onPickerCancel?(item: any[]): void onPickerCancel?(item: any[]): void
...@@ -196,11 +196,11 @@ interface PickerOptions { ...@@ -196,11 +196,11 @@ interface PickerOptions {
/** /**
* Event fired when user scrolls over or selects a value in the picker * Event fired when user scrolls over or selects a value in the picker
* *
* Returns the selected item * Returns the selected item
* *
* @param {any[]} item * @param {any[]} item
* *
* @memberof PickerOptions * @memberof PickerOptions
*/ */
onPickerSelect?(item: any[]): void onPickerSelect?(item: any[]): void
...@@ -210,61 +210,61 @@ interface PickerOptions { ...@@ -210,61 +210,61 @@ interface PickerOptions {
export default class Picker { export default class Picker {
/** /**
* Creates a new Picker objects * Creates a new Picker objects
* *
* @static * @static
* @param {PickerOptions} options * @param {PickerOptions} options
* *
* @memberof Picker * @memberof Picker
*/ */
static init(options: PickerOptions): void static init(options: PickerOptions): void
/** /**
* Shows the picker * Shows the picker
* *
* @static * @static
* *
* @memberof Picker * @memberof Picker
*/ */
static show(): void static show(): void
/** /**
* Hides the picker * Hides the picker
* *
* @static * @static
* *
* @memberof Picker * @memberof Picker
*/ */
static hide(): void static hide(): void
/** /**
* Toggles the visibility of the picker * Toggles the visibility of the picker
* *
* @static * @static
* *
* @memberof Picker * @memberof Picker
*/ */
static toggle(): void static toggle(): void
/** /**
* Sets an item in the picker as the selected value * Sets an item in the picker as the selected value
* *
* Accepts the item in an array * Accepts the item in an array
* Example: ['selected'] * Example: ['selected']
* *
* @static * @static
* @param {any[]} item * @param {any[]} item
* *
* @memberof Picker * @memberof Picker
*/ */
static select(item: any[]): void static select(item: any[]): void
/** /**
* Checks if the picker is showing currently * Checks if the picker is showing currently
* *
* @static * @static
* @returns {boolean} * @returns {boolean}
* *
* @memberof Picker * @memberof Picker
*/ */
static isPickerShow(): boolean static isPickerShow(fn?: (err: any, message: any) => void): boolean
} }
\ No newline at end of file
...@@ -91,7 +91,7 @@ export default { ...@@ -91,7 +91,7 @@ export default {
else if(ios){ else if(ios){
returnValue = !err; returnValue = !err;
} }
fn(returnValue); fn && fn(returnValue);
}); });
} }
}; };
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment