Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(CalendarPickerView): title support boolean value to control whether to hide #6676

Merged
merged 7 commits into from
Jul 23, 2024

Conversation

Layouwen
Copy link
Contributor

CalendarPickerView 的 title 可以通过配置 false 来隐藏

Copy link
Contributor

PR preview has been successfully built and deployed to https://antd-mobile-preview-pr-6676.surge.sh

@@ -41,7 +41,7 @@ export type CalendarPickerViewRef = {
}

export type CalendarPickerViewProps = {
title?: React.ReactNode
title?: React.ReactNode | boolean
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true 算什么?这里改成 React.ReactNode | false

@crazyair
Copy link
Member

crazyair commented Jul 23, 2024

image

感觉有个问题,以前 title 为假值,可以显示默认的 title,保险起见,可以加 showHeader

@@ -117,6 +117,8 @@ export const CalendarPickerView = forwardRef<
dayjs(dateRange ? dateRange[0] : today).date(1)
)

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个 useMemo 可以不写, !== false 速度比 func call 快多了

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

另外直接叫 showHeader 就行了

@zombieJ
Copy link
Member

zombieJ commented Jul 23, 2024

感觉有个问题,以前 title 为假值,可以显示默认的 title,保险起见,可以加 showHeader

?? 不会穿透 false

@crazyair
Copy link
Member

感觉有个问题,以前 title 为假值,可以显示默认的 title,保险起见,可以加 showHeader

?? 不会穿透 false

行,那这个没啥问题

@zombieJ zombieJ merged commit c1f432b into ant-design:master Jul 23, 2024
5 checks passed
@Layouwen Layouwen deleted the feature/is-display-header branch July 23, 2024 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants