Skip to content

Commit c37478e

Browse files
committed
fix: 🐛 解决缺少选中默认主题颜色报错的问题!
1 parent 2ed7104 commit c37478e

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/CalendarContext.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ export interface CalendarContextType extends DatePickerBaseProps {
2222
onChangeYear: (value: number) => void;
2323
}
2424

25-
const CalendarContext = createContext({
26-
theme: { selectedItemColor: '#0047FF' },
27-
} as CalendarContextType);
25+
const CalendarContext = createContext({} as CalendarContextType);
2826

2927
export const useCalendarContext = () => useContext(CalendarContext);
3028

src/DateTimePicker.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ const DateTimePicker: React.FC<
431431
displayFullDays,
432432
firstDayOfWeek: firstDay,
433433
height,
434-
theme: rest,
434+
theme: { selectedItemColor: '#0047FF', ...rest },
435435
}),
436436
[
437437
columns,

src/utils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,10 @@ export const isEqual = (value: any, other: any) => {
350350
* @returns {string} The color string with alpha channel.
351351
* @throws {Error} If the color format is not supported.
352352
*/
353-
export const addColorAlpha = (color: string, alpha: number = 1): string => {
353+
export const addColorAlpha = (
354+
color: string = '#0047FF',
355+
alpha: number = 1
356+
): string => {
354357
const a = clamp01(alpha);
355358
const input = color.trim();
356359

0 commit comments

Comments
 (0)