From ccb3145a48f087a4d3001880b6204fa1c11ba0f1 Mon Sep 17 00:00:00 2001 From: Andrea Ascari Date: Thu, 26 Apr 2018 20:05:46 +0200 Subject: [PATCH] Made callback for isPickerShow optional (#296) --- index.d.ts | 134 ++++++++++++++++++++++++++--------------------------- index.js | 4 +- 2 files changed, 69 insertions(+), 69 deletions(-) diff --git a/index.d.ts b/index.d.ts index 85c0616..973fc60 100644 --- a/index.d.ts +++ b/index.d.ts @@ -5,15 +5,15 @@ /** * Options to create a picker object - * + * * @interface PickerOptions */ interface PickerOptions { /** * Items to be passed into the picker - * + * * Default is an empty array - * + * * @type {any[]} * @memberof PickerOptions */ @@ -21,12 +21,12 @@ interface PickerOptions { /** * The selected item in the picker - * + * * Accepts the item in an array * Example: ['selected'] - * + * * Default is an empty array - * + * * @type {any[]} * @memberof PickerOptions */ @@ -34,9 +34,9 @@ interface PickerOptions { /** * Title text shown at the top of the picker - * + * * Default value is 'pls select' - * + * * @type {string} * @memberof PickerOptions */ @@ -44,9 +44,9 @@ interface PickerOptions { /** * Text for the confirm button - * + * * Default value is 'confirm' - * + * * @type {string} * @memberof PickerOptions */ @@ -54,9 +54,9 @@ interface PickerOptions { /** * Text for the cancel button - * + * * Default value is 'cancel' - * + * * @type {string} * @memberof PickerOptions */ @@ -64,12 +64,12 @@ interface PickerOptions { /** * The color of the text for the confirm button - * + * * Accepts rgba values as an array * [R, G, B, A] - * + * * Default is [1, 186, 245, 1] - * + * * @type {number[]} * @memberof PickerOptions */ @@ -77,12 +77,12 @@ interface PickerOptions { /** * The color of the text for the cancel button - * + * * Accepts rgba values as an array * [R, G, B, A] - * + * * Default is [1, 186, 245, 1] - * + * * @type {number[]} * @memberof PickerOptions */ @@ -90,12 +90,12 @@ interface PickerOptions { /** * The color of the Title text - * + * * Accepts rgba values as an array * [R, G, B, A] - * + * * Default is [20, 20, 20, 1] - * + * * @type {number[]} * @memberof PickerOptions */ @@ -103,12 +103,12 @@ interface PickerOptions { /** * The background color of the toobar - * + * * Accepts rgba values as an array * [R, G, B, A] - * + * * Default is [232, 232, 232, 1] - * + * * @type {number[]} * @memberof PickerOptions */ @@ -116,12 +116,12 @@ interface PickerOptions { /** * Background color of the picker - * + * * Accepts rgba values as an array * [R, G, B, A] - * + * * Default is [196, 199, 206, 1] - * + * * @type {number[]} * @memberof PickerOptions */ @@ -130,9 +130,9 @@ interface PickerOptions { /** * Font size of the items in the toolbar - * + * * Default is 16 - * + * * @type {number} * @memberof PickerOptions */ @@ -140,9 +140,9 @@ interface PickerOptions { /** * Font size of the items in the picker - * + * * Default is 16 - * + * * @type {number} * @memberof PickerOptions */ @@ -150,9 +150,9 @@ interface PickerOptions { /** * Row height of the items in the picker - * + * * Default is 24 - * + * * @type {number} * @memberof PickerOptions */ @@ -160,12 +160,12 @@ interface PickerOptions { /** * Color of the text for the items in the picker - * + * * Accepts rgba values as an array * [R, G, B, A] - * + * * Default is [31, 31, 31, 1] - * + * * @type {number[]} * @memberof PickerOptions */ @@ -173,22 +173,22 @@ interface PickerOptions { /** * Event fired when user confirms the picker - * + * * Returns the selected item - * - * @param {any[]} item - * + * + * @param {any[]} item + * * @memberof PickerOptions */ onPickerConfirm?(item: any[]): void /** * Event fired when user cancels the picker - * + * * Returns the selected item - * - * @param {any[]} item - * + * + * @param {any[]} item + * * @memberof PickerOptions */ onPickerCancel?(item: any[]): void @@ -196,11 +196,11 @@ interface PickerOptions { /** * Event fired when user scrolls over or selects a value in the picker - * + * * Returns the selected item - * - * @param {any[]} item - * + * + * @param {any[]} item + * * @memberof PickerOptions */ onPickerSelect?(item: any[]): void @@ -210,61 +210,61 @@ interface PickerOptions { export default class Picker { /** * Creates a new Picker objects - * + * * @static - * @param {PickerOptions} options - * + * @param {PickerOptions} options + * * @memberof Picker */ static init(options: PickerOptions): void /** * Shows the picker - * + * * @static - * + * * @memberof Picker */ static show(): void /** * Hides the picker - * + * * @static - * + * * @memberof Picker */ static hide(): void /** * Toggles the visibility of the picker - * + * * @static - * + * * @memberof Picker */ static toggle(): void /** * Sets an item in the picker as the selected value - * + * * Accepts the item in an array * Example: ['selected'] - * + * * @static - * @param {any[]} item - * + * @param {any[]} item + * * @memberof Picker */ static select(item: any[]): void - + /** * Checks if the picker is showing currently - * + * * @static - * @returns {boolean} - * + * @returns {boolean} + * * @memberof Picker */ - static isPickerShow(): boolean -} \ No newline at end of file + static isPickerShow(fn?: (err: any, message: any) => void): boolean +} diff --git a/index.js b/index.js index 12a4037..bb5d136 100644 --- a/index.js +++ b/index.js @@ -91,7 +91,7 @@ export default { else if(ios){ returnValue = !err; } - fn(returnValue); + fn && fn(returnValue); }); } -}; \ No newline at end of file +}; -- 2.26.2