-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DatePickerAndroid styling not working when provide mode prop #13538
Comments
@bennygenel Have no Idea why its not working . But you can make your android theme in android studio . |
@PARAGJYOTI I already created my own theme. As you can see I set the theme on style.xml and it works fine too unless I use mode prop on DatePickerAndroid as I mentioned before. |
This issue appeared for me when updating from 0.43.0 to 0.44.0 |
Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally! If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:
If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution. |
Ok, I found out how to apply styles when mode prop is set. The problem was the style names, when the mode prop is set react native looks for specific styles in the resources. For spinner mode: <style name="SpinnerDatePickerDialog" parent="android:Theme.Material.Light.Dialog">
<item name="android:datePickerStyle">@style/MyDatePicker</item>
<item name="android:colorAccent">@color/colorPrimary</item>
<item name="android:colorControlNormal">@color/colorPrimary</item>
</style>
<style name="MyDatePicker" parent="android:Widget.Material.DatePicker">
<item name="android:datePickerMode">spinner</item>
</style> No the style with the And for calendar mode: <style name="CalendarDatePickerDialog" parent="android:Theme.Material.Light.Dialog">
<item name="android:headerBackground">@color/colorPrimary</item>
<item name="android:colorControlNormal">@color/colorPrimary</item>
<item name="android:colorControlHighlight">@color/colorPrimary</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorAccent">@color/colorPrimary</item>
<item name="textColor">@color/colorPrimary</item>
</style> These style attributes are not fully tested but I think they work. I hope this works for other people. |
thank you @khrizt your solution for the spinner works like a charm! Haven't tested the calendar version. |
Description
On Android when using native style.xml DatePickerAndroid returns to theme default colors when using mode prop. When you don't use it at all it works fine.
mmazzarolo/react-native-modal-datetime-picker#29
Reproduction Steps and Sample Code
style.xml
Solution
Don't know much about native code but I assume that when using mode prop something overrides the styling to default theme.
Additional Information
The text was updated successfully, but these errors were encountered: