How to change font family or size of DatePicker - React Native

Viewed 800

The default font used in android is the default one used by android system. Can i use a different phone using styling or some sort like we use custom fonts for Text using fontFamily.

The default font i use in my app is Montesserat which you can see in calendar font but the datepicker is using default phone font.

Please check the discussion i started in the GitHub for more. https://github.com/henninghall/react-native-date-picker/discussions/297#discussion-3234793

Please help if anyone knows how to do this.

1 Answers

To change font styling for react-native, it can be done by specifying a theme in android/app/src/main/res/styles.xml

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="android:textColor">#000000</item>
        <item name="android:datePickerDialogTheme">@style/DialogDatePicker.Theme</item>
    </style>

    <style name="DialogDatePicker.Theme" parent="Theme.AppCompat.Light.Dialog">
        <item name="colorAccent">#000000</item>
        <item name="android:textColor">#000000</item>
        <item name="android:textColorPrimary">#000000</item>
        <item name="android:fontFamily">@font/sans-serif</item>
    </style>

</resources>
Related