-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[pickers] Use usePickerContext() to get the view-related props in the layout, toolbar and tabs slots
#15606
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
[pickers] Use usePickerContext() to get the view-related props in the layout, toolbar and tabs slots
#15606
Conversation
|
Deploy preview: https://deploy-preview-15606--material-ui-x.netlify.app/ Updated pages: |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
6338992 to
60b62f9
Compare
<PickersLayout /> props and use the context insteadusePickerContext() to get the view-related props in the layout, toolbar and tabs slots
…the context instead
60b62f9 to
800c488
Compare
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
michelengelen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nothing blocking ... feel free to ignore, when it's not relevant ... LGTM
docs/data/migration/migration-pickers-v7/migration-pickers-v7.md
Outdated
Show resolved
Hide resolved
| function CustomLayout(props) { | ||
| - console.log(props.isRtl); | ||
|
|
||
| - const { isRtl } = props; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is pure mind-bending ... a diff from a diff! 🤯
docs/data/migration/migration-pickers-v7/migration-pickers-v7.md
Outdated
Show resolved
Hide resolved
docs/data/migration/migration-pickers-v7/migration-pickers-v7.md
Outdated
Show resolved
Hide resolved
docs/data/migration/migration-pickers-v7/migration-pickers-v7.md
Outdated
Show resolved
Hide resolved
packages/x-date-pickers-pro/src/DateTimeRangePicker/DateTimeRangePickerTabs.tsx
Outdated
Show resolved
Hide resolved
packages/x-date-pickers-pro/src/DateTimeRangePicker/DateTimeRangePickerTabs.tsx
Outdated
Show resolved
Hide resolved
packages/x-date-pickers/src/DateTimePicker/DateTimePickerToolbar.tsx
Outdated
Show resolved
Hide resolved
packages/x-date-pickers/src/DateTimePicker/DateTimePickerToolbar.tsx
Outdated
Show resolved
Hide resolved
| export const DateTimePickerToolbarOverrideContext = React.createContext<{ | ||
| forceDesktopVariant: boolean; | ||
| onViewChange: (view: DateOrTimeViewWithMeridiem) => void; | ||
| view: DateOrTimeViewWithMeridiem | null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a way we can remove the | null here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nop, the DateTimeRangePickerToolbar passes null when you are editing the other date
Co-authored-by: Michel Engelen <[email protected]> Signed-off-by: Flavien DELANGLE <[email protected]>
Co-authored-by: Michel Engelen <[email protected]> Signed-off-by: Flavien DELANGLE <[email protected]>
Co-authored-by: Michel Engelen <[email protected]> Signed-off-by: Flavien DELANGLE <[email protected]>
Co-authored-by: Michel Engelen <[email protected]> Signed-off-by: Flavien DELANGLE <[email protected]>
…ar.tsx Co-authored-by: Michel Engelen <[email protected]> Signed-off-by: Flavien DELANGLE <[email protected]>
…ar.tsx Co-authored-by: Michel Engelen <[email protected]> Signed-off-by: Flavien DELANGLE <[email protected]>
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
…he layout, toolbar and tabs slots (mui#15606) Signed-off-by: Flavien DELANGLE <[email protected]> Co-authored-by: Michel Engelen <[email protected]>
Part of #15495
What?
usePickerContext()for the view props in all theXXXTabscomponentsusePickerContext()for the view props in all theXXXToolbarcomponentsusePickerContext()for the view props inusePickerLayout()Why?
TViewfrom a lot of interfaces (about half of all the interfaces withTViewwere only needing it because of the tabs and toolbar slots...)slotPropsWhat's next?
usePickerValue()