Skip to content

Commit

Permalink
feat(CalendarPickerView): title support boolean value to control whet…
Browse files Browse the repository at this point in the history
…her to hide
  • Loading branch information
Layouwen committed Jul 23, 2024
1 parent c7b0b9f commit ef1ba84
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/calendar-picker-view/calendar-picker-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export type CalendarPickerViewRef = {
}

export type CalendarPickerViewProps = {
title?: React.ReactNode
title?: React.ReactNode | boolean
confirmText?: string
weekStartsOn?: 'Monday' | 'Sunday'
renderTop?: (date: Date) => React.ReactNode
Expand Down Expand Up @@ -117,6 +117,8 @@ export const CalendarPickerView = forwardRef<
dayjs(dateRange ? dateRange[0] : today).date(1)
)

const isDisplayHeader = useMemo(() => props.title !== false, [props.title])

// =============================== Scroll ===============================
const context = useContext(Context)
const scrollTo = useSyncScroll(current, context.visible, bodyRef)
Expand Down Expand Up @@ -356,7 +358,7 @@ export const CalendarPickerView = forwardRef<
return withNativeProps(
props,
<div className={classPrefix}>
{header}
{isDisplayHeader && header}
{mark}
{body}
</div>
Expand Down

0 comments on commit ef1ba84

Please sign in to comment.