davecoffin / nativescript-modal-datetimepicker

Apache License 2.0
59 stars 36 forks source link

Nativescript Angular Dialog 'ok' and 'cancel' button color is not set #67

Open veeravetrivel opened 4 years ago

veeravetrivel commented 4 years ago

Which platform(s) does your issue occur on?

Please, provide the following version numbers that your issue occurs with:

Date and Time picker working are working fine as per the guideline #8 . But 'ok' and 'cancel' button color is not set. How to set color and change text. date

@davecoffin @pedromorgan @Logikgate @KevinBeckers @sebj54

natebgurutech commented 3 years ago

You'll have to style it the Android theme way.

I'll give you an example of how I got it working.

It would be nice if something like this was in the readme because this took me a while to get working, googling this stuff was a pain.

## App_Resources\Android\src\main\AndroidManifest.xml ##

  <application
    . . .
    android:theme="@style/AppTheme">
## App_Resources\Android\src\main\res\values\styles.xml ##

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
    <style name="AppThemeBase" parent="Theme.MaterialComponents.Light.NoActionBar">
        <item name="toolbarStyle">@style/NativeScriptToolbarStyle</item>
        <item name="colorPrimary">@color/ns_primary</item>
        <item name="colorPrimaryDark">@color/ns_primaryDark</item>
        <item name="colorAccent">@color/ns_accent</item>
    </style>

    <style name="AppTheme" parent="AppThemeBase">
    </style>

    . . .
</resource>
## App_Resources\Android\src\main\res\values-v21\styles.xml ##

<?xml version="1.0" encoding="utf-8"?>
<resources>
  <style name="AppTheme" parent="AppThemeBase">
    <item name="android:datePickerDialogTheme">@style/DatePickerDialogTheme</item>
    <item name="android:datePickerStyle">@style/CalendarDatePicker</item>
  </style>

  <style name="DatePickerDialogTheme" parent="android:Theme.Material.Light.Dialog">
    <item name="android:colorAccent">#FF0000</item>
    <item name="android:buttonBarPositiveButtonStyle">@style/DialogButtonStyle</item>
    <item name="android:buttonBarNegativeButtonStyle">@style/DialogButtonStyle</item>
    <item name="android:buttonBarNeutralButtonStyle">@style/DialogButtonStyle</item>
  </style>

  <style name="DialogButtonStyle" parent="android:Widget.Material.Light.Button">
   <item name="android:textColor">#FFFFFF</item>
   <item name="android:backgroundTint">#FF0000</item>
  </style>

  <style name="CalendarDatePicker" parent="android:Widget.Material.Light.DatePicker">
    <item name="android:datePickerMode">calendar</item>
  </style>

  . . .
</resource>