Skip to content

DatePickerAndroid styling not working when provide mode prop #13538

@bennygenel

Description

@bennygenel

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

<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>
DatePickerAndroid.open(); // Styling works fine
DatePickerAndroid.open({mode: 'calendar'}); // Styling is not working
DatePickerAndroid.open({mode: 'spinner'}); // Styling is not working

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

  • React Native version: "0.43.3"
  • Platform: Android
  • Development Operating System: MacOS
  • Dev tools: Android Studio

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions