change react native datetime picker background color "android"

i want to share how i can change theme color of the picker.
in android/app/src/main/res/values/styles.xml i put:

  <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="android:datePickerDialogTheme">@style/DialogDatePicker.Theme</item>
    </style>

<style name="DialogDatePicker.Theme" parent="Theme.AppCompat.Light.Dialog">
        <item name="colorAccent">@color/ocean_green</item>
        <item name="android:textColor">@color/dove_gray</item>
        <item name="android:textColorPrimary">@color/dove_gray</item>
    </style>

* colorAccent is the color of header of picker and selector

* textColor is the color of numbers and text buttons

* textColorPrimary is the color of text of month.
I hope it works for you, regards.

Tip for the those using the time picker and would like to change the colors.
Change android:datePickerDialogTheme to android:timePickerDialogTheme

(======================need more help visit the blow linhk========================)
https://hashnode.com/post/step-by-step-guide-on-how-to-change-background-and-text-color-of-android-date-time-picker-in-react-native-ckacitc6j02lvb6s1u01uyzzl

4.11
9
AllInOne 95 points

                                    In android/app/src/main/res/values/styles.xml:
&lt;resources&gt;
    &lt;!-- Base application theme. --&gt;
    &lt;style name=&quot;AppTheme&quot; parent=&quot;Theme.AppCompat.Light.NoActionBar&quot;&gt;
        &lt;item name=&quot;android:textColor&quot;&gt;#000000&lt;/item&gt;
        &lt;!-- Add your date time picker here. --&gt;
        &lt;item name=&quot;android:datePickerDialogTheme&quot;&gt;@style/Dialog.Theme&lt;/item&gt;
    &lt;/style&gt;

    &lt;!-- Add Date time picker dialog theme here. --&gt;
    &lt;style name=&quot;Dialog.Theme&quot; parent=&quot;Theme.AppCompat.Light.Dialog&quot;&gt;
        &lt;item name=&quot;colorAccent&quot;&gt;#f3ca1b&lt;/item&gt;
        &lt;item name=&quot;android:textColorPrimary&quot;&gt;#000000&lt;/item&gt;
    &lt;/style&gt;
&lt;/resources&gt;

4.11 (9 Votes)
0
Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source