From c12ec07690fa6d72a5cd438766acdc68eba07f6d Mon Sep 17 00:00:00 2001 From: farhoudshapouran Date: Mon, 30 Oct 2023 13:44:51 +0300 Subject: [PATCH] feat: add today styling options to datepicker --- README.md | 2 ++ example/src/App.tsx | 3 +++ src/DateTimePicker.tsx | 4 ++++ src/components/DaySelector.tsx | 2 ++ src/types.ts | 2 ++ 5 files changed, 13 insertions(+) diff --git a/README.md b/README.md index fabe694..69c59fb 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,8 @@ For more, take a look at the `/example` directory. | buttonPrevIcon | `ReactNode` | `undefined` | Defines calendar header "prev button" custom icon | | buttonNextIcon | `ReactNode` | `undefined` | Defines calendar header "next button" custom icon | | dayContainerStyle | `ViewStyle` | `null` | Defines days containers style | +| todayContainerStyle | `ViewStyle` | `null` | Defines today container style | +| todayTextStyle | `TextStyle` | `null` | Defines today text style | | monthContainerStyle | `ViewStyle` | `null` | Defines months containers style | | yearContainerStyle | `ViewStyle` | `null` | Defines years containers style | | weekDaysContainerStyle | `ViewStyle` | `null` | Defines weekdays container style | diff --git a/example/src/App.tsx b/example/src/App.tsx index d585613..cae8689 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -61,6 +61,9 @@ export default function App() { fontWeight: 'bold', color: theme?.activeTextColor, }} + todayContainerStyle={{ + borderWidth: 1, + }} mode="datetime" /> diff --git a/src/DateTimePicker.tsx b/src/DateTimePicker.tsx index 0c051f1..6a8707d 100644 --- a/src/DateTimePicker.tsx +++ b/src/DateTimePicker.tsx @@ -38,6 +38,8 @@ const DateTimePicker = ({ headerButtonColor, headerButtonSize, dayContainerStyle, + todayContainerStyle, + todayTextStyle, monthContainerStyle, yearContainerStyle, weekDaysContainerStyle, @@ -66,6 +68,8 @@ const DateTimePicker = ({ headerButtonColor, headerButtonSize, dayContainerStyle, + todayContainerStyle, + todayTextStyle, monthContainerStyle, yearContainerStyle, weekDaysContainerStyle, diff --git a/src/components/DaySelector.tsx b/src/components/DaySelector.tsx index 9307e15..db59738 100644 --- a/src/components/DaySelector.tsx +++ b/src/components/DaySelector.tsx @@ -43,6 +43,7 @@ const DaySelector = () => { ? { borderWidth: 2, borderColor: theme?.selectedItemColor || '#0047FF', + ...theme?.todayContainerStyle, } : null; @@ -63,6 +64,7 @@ const DaySelector = () => { ? { ...theme?.calendarTextStyle, color: theme?.selectedItemColor || '#0047FF', + ...theme?.todayTextStyle, } : theme?.calendarTextStyle; diff --git a/src/types.ts b/src/types.ts index 9d35b58..315c632 100644 --- a/src/types.ts +++ b/src/types.ts @@ -30,6 +30,8 @@ export type CalendarTheme = { headerButtonColor?: string; headerButtonSize?: number; dayContainerStyle?: ViewStyle; + todayContainerStyle?: ViewStyle; + todayTextStyle?: TextStyle; monthContainerStyle?: ViewStyle; yearContainerStyle?: ViewStyle; weekDaysContainerStyle?: ViewStyle;