[Stack] Fix default flexDirection value with responsive prop#33549
Merged
hbjORbj merged 7 commits intomui:masterfrom Jul 20, 2022
Merged
[Stack] Fix default flexDirection value with responsive prop#33549hbjORbj merged 7 commits intomui:masterfrom
flexDirection value with responsive prop#33549hbjORbj merged 7 commits intomui:masterfrom
Conversation
flexDirection should be usedflexDirection value with responsive prop
| export const style = ({ ownerState, theme }) => { | ||
| let styles = { | ||
| display: 'flex', | ||
| flexDirection: typeof ownerState.direction === 'string' ? ownerState.direction : 'column', |
Member
There was a problem hiding this comment.
Would this work? It seems to be what's missing, I assume the typeof ownerState.direction === 'string' ? ownerState.direction logic duplicates with the one in handleBreakpoints?
Suggested change
| flexDirection: typeof ownerState.direction === 'string' ? ownerState.direction : 'column', | |
| flexDirection: 'column', |
Contributor
Author
There was a problem hiding this comment.
I can confirm that you are right. flexDirection: 'column' seems enough. Made the change and added a test.
daniel-rabe
pushed a commit
to daniel-rabe/material-ui
that referenced
this pull request
Nov 29, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem:
directionprop receives a responsive value such that it doesn't start with the smallest breakpoint, such asdirection={{ lg: 'row' }},flexDirectionisn't specified for breakpoints belowlgand hence it is set to the default value of flexbox, which isrow.Solution:
StackRoot'sflexDirectionproperty toownerState.directionif it is a string, or simply tocolumn.directionvalues are provided, thisflexDirectionproperty will be overridden.Codesandboxes:
Before
After