Skip to content

Dark mode year selector does not use darkmode onSurface or text color for older theme #277

@jennifer-dickinson

Description

@jennifer-dickinson

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-paper-dates@0.15.1 for the project I'm working on.

I use v2 of the react-native paper theme, and when using dark mode, the year text shows as dark text. Replacing the color value from undefined to either theme.colors.text or theme.colors.onSurface fixes the issue

Dark mode without fix Dark mode with fix
simulator_screenshot_E91662DE-15E1-486D-8878-8F90E26299D9 simulator_screenshot_97DDC140-479A-4F9F-91DE-898BBD851F9F

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-paper-dates/src/Date/YearPicker.tsx b/node_modules/react-native-paper-dates/src/Date/YearPicker.tsx
index 3178557..a4a23d6 100644
--- a/node_modules/react-native-paper-dates/src/Date/YearPicker.tsx
+++ b/node_modules/react-native-paper-dates/src/Date/YearPicker.tsx
@@ -105,7 +105,7 @@ function YearPure({
                 : {
                     color: theme.isV3
                       ? theme.colors.onSurfaceVariant
-                      : undefined,
+                      : theme.colors.onSurface,
                   },
               { ...textFont },
             ]}

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions