react-native-paper-dates icon indicating copy to clipboard operation
react-native-paper-dates copied to clipboard

[Issue] TimeInput unreadable when input is selected and primary color is black

Open fabriziocucci opened this issue 2 years ago • 1 comments

An image speaks more than a thousand of words:

Screenshot 2022-08-27 at 17 13 02

As you can see, the hour TimeInput is selected and pm is selected in the AmPmSwitcher.

Any workaround available until a proper fix is baked?

fabriziocucci avatar Aug 27 '22 15:08 fabriziocucci

I'm looking for a workaround like this, in my case the issue is on the buttons, when in dark mode, my primary color is also a dark color, which is difficult to read, it would be great if there is a way to set these colors.

fdelacruzsoto avatar Sep 08 '22 01:09 fdelacruzsoto

I found a work around. Wrap your modals in an another provider and adjust the primary color

import { Provider as PaperProvider } from 'react-native-paper';

const datetimePickerTheme = {
  ...theme,
  colors: {
    ...theme.colors,
    primary: '#8eb7ff',
  },
};

 <PaperProvider theme={datetimePickerTheme}>
        <DatePickerModal
          locale="en"
          mode="single"
          visible={showDateModal}
          onDismiss={onDismissDateModal}
          date={value}
          onConfirm={noOp}
          onChange={(e: Parameters<SingleChange>[0]) =>
            updateValue(e.date as Date)
          }
          saveLabelDisabled={true}
          saveLabel=" "
          label={label}
          closeIcon="arrow-left"
        />
        <TimePickerModal
          visible={showTimeModal}
          onDismiss={onDismissTimeModal}
          onConfirm={onConfirmTime}
          hours={value?.getHours()}
          minutes={value?.getMinutes()}
        />
</PaperProvider>

stuart-clark-45 avatar Nov 11 '22 16:11 stuart-clark-45

PR is welcome!

RichardLindhout avatar Dec 27 '22 20:12 RichardLindhout

This is fixed now in m2 where primary is black. If you have this in m3 please fix your theme:

You need to have onPrimaryContainer white.

  m3Theme.colors.primaryContainer = '#000000'
  m3Theme.colors.onPrimaryContainer = '#000000' // WRONG!!

RichardLindhout avatar Dec 21 '23 19:12 RichardLindhout