mmazzarolo / react-native-modal-datetime-picker

A React-Native datetime-picker for Android and iOS
MIT License
2.94k stars 392 forks source link

Android datetime picker change colors? #29

Closed rendomnet closed 7 years ago

rendomnet commented 7 years ago

Can we change colors of Android datetime picker?

mmazzarolo commented 7 years ago

Hi there, to style it on Android you should tweak a bit the native code :)

bennygenel commented 7 years ago

Hi @mmazzarolo; I have sort of a problem about this. I changed colors on my theme on native code but it doesn't change your dialogs. If I use react-native DatePickerAndroid and TimePickerAndroid separately it works perfectly but doesn't change when I use yours.

Here is my style.xml

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorAccent">@color/mainRed</item>
    </style>
    <style name="Dialog.Theme" parent="Theme.AppCompat.Light.Dialog">
        <item name="colorAccent">@color/mainRed</item>
    </style>

</resources>

Edit: I found out that if I set react-native DatePickerAndroid mode it doesn't work either. If I don't pass a mode prop it works fine.

What do you think can cause this?

Thanks

mmazzarolo commented 7 years ago

Hey @bennygenel,

I found out that if I set react-native DatePickerAndroid mode it doesn't work either. If I don't pass a mode prop it works fine.

If you're talking about react-native's own DatePickerAndroid, it is a react-native issue indeed. Do you mind opening an issue on the react-native official repo?
Feel free to link this issue if needed, I'll leave it open :)
Thank you!

bennygenel commented 7 years ago

Hey @mmazzarolo;

Thanks for reopening the issue. I was wondering if it is possible to not provide a mode prop to the DatePickerAndroid if the datePickerModeAndroid prop is omited?

At least this way default DatePickerDialog can be styled correctly.

Thanks again

mmazzarolo commented 7 years ago

Could you submit a PR (making sure that it doesn't break anything)?
I'll gladly merge it, but I'd also like to see the issue reported to the react-native official repo (I can do it by myself when I have some spare time if you can't do it!).

Thanks! 👍

lixiaobin0303 commented 7 years ago

Android to get the date is not correct bad day

mmazzarolo commented 7 years ago

Closing for inactivity, feel free to post here if you want to discuss this subject further and I'll re-open it! 👨‍💻

bsonntag commented 7 years ago

Passing datePickerModeAndroid={'default'} fixes the issue. @mmazzarolo maybe this should be the default value instead of 'calendar'. What was the reason for using 'calendar' as the default value for this prop?

mmazzarolo commented 7 years ago

@bsonntag thank you for investigating on the issue. Honestly, that prop comes from a previous PR, so I can't really answer your question.
Would you mind submitting a PR for fixing it? :)

bsonntag commented 7 years ago

@mmazzarolo done 😉

annedevia commented 6 years ago

what should i write on onConfirm function when i have 2 inputfields for date picker? please help me

animeclover commented 3 years ago

I try the below blog for adding datePickerAndroid and it's working fine also provide when a user has multiple input field for date solution.

https://infinitbility.com/how-to-add-datepickerandroid-in-react-native-with-color-changes