-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[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. |
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 <32863416+michelengelen@users.noreply.github.com> Signed-off-by: Flavien DELANGLE <flaviendelangle@gmail.com>
Co-authored-by: Michel Engelen <32863416+michelengelen@users.noreply.github.com> Signed-off-by: Flavien DELANGLE <flaviendelangle@gmail.com>
Co-authored-by: Michel Engelen <32863416+michelengelen@users.noreply.github.com> Signed-off-by: Flavien DELANGLE <flaviendelangle@gmail.com>
Co-authored-by: Michel Engelen <32863416+michelengelen@users.noreply.github.com> Signed-off-by: Flavien DELANGLE <flaviendelangle@gmail.com>
…ar.tsx Co-authored-by: Michel Engelen <32863416+michelengelen@users.noreply.github.com> Signed-off-by: Flavien DELANGLE <flaviendelangle@gmail.com>
…ar.tsx Co-authored-by: Michel Engelen <32863416+michelengelen@users.noreply.github.com> Signed-off-by: Flavien DELANGLE <flaviendelangle@gmail.com>
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 <flaviendelangle@gmail.com> Co-authored-by: Michel Engelen <32863416+michelengelen@users.noreply.github.com>
Part of #15495
What?
usePickerContext()
for the view props in all theXXXTabs
componentsusePickerContext()
for the view props in all theXXXToolbar
componentsusePickerContext()
for the view props inusePickerLayout()
Why?
TView
from a lot of interfaces (about half of all the interfaces withTView
were only needing it because of the tabs and toolbar slots...)slotProps
What's next?
usePickerValue()