cordova-plugin-datepicker icon indicating copy to clipboard operation
cordova-plugin-datepicker copied to clipboard

Improve documentation on the datepicker, androidTheme option?

Open SammyIsra opened this issue 8 years ago • 4 comments

Documentation in question: https://github.com/VitaliiBlagodir/cordova-plugin-datepicker#androidtheme---android

The instructions in the androidTheme option seem to be vague and very misleading. It says it requires an integer, yet the options are all strings. To find the correct number to use for one of the options, I had to look in the issues. Ended up finding this one https://github.com/VitaliiBlagodir/cordova-plugin-datepicker/issues/21, and went directly to the plugin files to check what the integer that I was looking for is.

It should be easier for developers to set the androidTheme. Ideally, they should not have to go to the plugin files to correctly set that option.

SammyIsra avatar Sep 11 '16 19:09 SammyIsra

They are constants defined inside plugins.datePicker.ANDROID_THEMES

Just reference that in your javascript code and you'll get the correct integer.

webdevius avatar Sep 15 '16 16:09 webdevius

Docs are wrong, the correct is use integer, but the example said strings...

var options = {
	date: new Date(),
	mode: 'date', 
	androidTheme: 5, 
};

John-Henrique avatar Feb 05 '17 23:02 John-Henrique

@John-Henrique It does take in an integer, and by all means you can use an integer if you so prefer. The Docs do not imply to use a string, but a constant instead defined by the plugin.

The way to access the constants is by doing this:

var options = {
    ...
    androidTheme: plugins.datePicker.ANDROID_THEMES.THEME_DEVICE_DEFAULT_LIGHT
}

Hope that clears it up!

SammyIsra avatar Feb 06 '17 20:02 SammyIsra

@SammyIsra when this plugin is installed every time when I click in input type "date", "time" or "datetime-local" is opened a datepicker/timepicker but every time the theme is dark. I understand is necessary call the code, but will be nice if plugin give a default theme for all project and no only when I call code. You agree?

var options = {
	date: new Date(),
	mode: 'date', 
	androidTheme: plugins.datePicker.ANDROID_THEMES.THEME_DEVICE_DEFAULT_LIGHT, 
};
datePicker.show(options, onSuccess, onError);

John-Henrique avatar Feb 06 '17 21:02 John-Henrique