cordova-plugin-datepicker
cordova-plugin-datepicker copied to clipboard
Improve documentation on the datepicker, androidTheme option?
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.
They are constants defined inside plugins.datePicker.ANDROID_THEMES
Just reference that in your javascript code and you'll get the correct integer.
Docs are wrong, the correct is use integer, but the example said strings...
var options = {
date: new Date(),
mode: 'date',
androidTheme: 5,
};
@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 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);