Skip to content

Commit 366acc6

Browse files
committed
fix(Calendar): renderDay增加返回当前日历时间
1 parent 8fa4790 commit 366acc6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/core/src/Calendar/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export default CalendarView
170170
| `showBar` | 是否显示导航栏 | Boolean | `true` |
171171
| `bar` | 导航栏 | React.ReactNode | - |
172172
| `onChange` | 选择时间事件 | (value: string) => void | - |
173-
| `renderDay` | 自定义渲染日期额外内容 | (date:any) => React.ReactNode | JSX.Element | - |
173+
| `renderDay` | 自定义渲染日期额外内容 | (date: string, currentDate: string) => React.ReactNode | JSX.Element | - |
174174
| `value` || Date | - |
175175

176176

packages/core/src/Calendar/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export interface CalendarProps extends ViewProps {
3131
// 是否显示头部导航栏
3232
showBar?: boolean;
3333
// 自定义渲染日期额外内容
34-
renderDay?: (date: any) => React.ReactNode | JSX.Element;
34+
renderDay?: (date: string, currentDate: string) => React.ReactNode | JSX.Element;
3535
// 值
3636
value?: Date;
3737
}
@@ -164,7 +164,7 @@ const Calendar = (props: CalendarProps) => {
164164
onPress={() => goSelectDay(day)}
165165
>
166166
<View>
167-
{renderDay?.(day.date || '')}
167+
{renderDay?.(day.date || '', currentYear + '-' + (currentMonth + 1))}
168168
<Text
169169
style={[
170170
styles.dayText,

0 commit comments

Comments
 (0)