Skip to content

Commit

Permalink
feat: add today styling options to datepicker
Browse files Browse the repository at this point in the history
  • Loading branch information
farhoudshapouran committed Oct 30, 2023
1 parent 3a8c05e commit c12ec07
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
3 changes: 3 additions & 0 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ export default function App() {
fontWeight: 'bold',
color: theme?.activeTextColor,
}}
todayContainerStyle={{

Check warning on line 64 in example/src/App.tsx

View workflow job for this annotation

GitHub Actions / lint

Inline style: { borderWidth: 1 }
borderWidth: 1,
}}
mode="datetime"
/>
<View style={styles.footerContainer}>
Expand Down
4 changes: 4 additions & 0 deletions src/DateTimePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ const DateTimePicker = ({
headerButtonColor,
headerButtonSize,
dayContainerStyle,
todayContainerStyle,
todayTextStyle,
monthContainerStyle,
yearContainerStyle,
weekDaysContainerStyle,
Expand Down Expand Up @@ -66,6 +68,8 @@ const DateTimePicker = ({
headerButtonColor,
headerButtonSize,
dayContainerStyle,
todayContainerStyle,
todayTextStyle,
monthContainerStyle,
yearContainerStyle,
weekDaysContainerStyle,
Expand Down
2 changes: 2 additions & 0 deletions src/components/DaySelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const DaySelector = () => {
? {
borderWidth: 2,
borderColor: theme?.selectedItemColor || '#0047FF',
...theme?.todayContainerStyle,
}
: null;

Expand All @@ -63,6 +64,7 @@ const DaySelector = () => {
? {
...theme?.calendarTextStyle,
color: theme?.selectedItemColor || '#0047FF',
...theme?.todayTextStyle,
}
: theme?.calendarTextStyle;

Expand Down
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export type CalendarTheme = {
headerButtonColor?: string;
headerButtonSize?: number;
dayContainerStyle?: ViewStyle;
todayContainerStyle?: ViewStyle;
todayTextStyle?: TextStyle;
monthContainerStyle?: ViewStyle;
yearContainerStyle?: ViewStyle;
weekDaysContainerStyle?: ViewStyle;
Expand Down

0 comments on commit c12ec07

Please sign in to comment.