question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Grid] Deprecation package says justifyContent=flex-start is invalid

See original GitHub issue
  • The issue is present in the latest (deprecation) release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

When setting justifyContent to flex-start, an error displays in the console stating the following:

Warning: Failed prop type: Invalid prop justifyContent of value flex-start supplied to ForwardRef(Grid), expected one of [“center”,“flex-end”,“space-between”,“space-around”,“space-evenly”].

I see no indication that it should be disallowed, not to mention this value is within the migrated code.

Expected Behavior 🤔

Well…no error, to put it simply.

Steps to Reproduce 🕹

https://codesandbox.io/s/material-ui-deprecations-grid-issue-f9epl?file=/src/Demo.js

Your Environment 🌎

`npx @material-ui/envinfo` System: OS: macOS 11.2 Binaries: Node: 15.6.0 - ~/.nvm/versions/node/v15.6.0/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 7.4.0 - ~/.nvm/versions/node/v15.6.0/bin/npm Browsers: Chrome: 88.0.4324.96 <= Using Edge: Not Found Firefox: 85.0 Safari: 14.0.3 npmPackages: @material-ui/core: 4.11.3 => 4.11.3-deprecations.1 @material-ui/styles: 4.11.3-deprecations.1 @material-ui/system: 4.11.3-deprecations.1 @material-ui/types: 5.1.0 @material-ui/utils: 4.11.2 @types/react: 17.0.0 react: 17.0.1 => 17.0.1 react-dom: 17.0.1 => 17.0.1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

10reactions
kaylathomascommented, Sep 28, 2021

Hi there - I’m not sure if this is the same issue, but I think it is: I’m also getting an error when I attempt to use justifyContent on an MUI Grid container at all… I don’t have this issue when I use JSX alone with MUI, but my current position requires I use Typescript. I’m getting the following error:

No overload matches this call.
  Overload 1 of 2, '(props: { component: ElementType<any>; } & Partial<Record<Breakpoint, boolean | GridSize>> & { alignContent?: GridContentAlignment | undefined; ... 7 more ...; zeroMinWidth?: boolean | undefined; } & CommonProps<...> & Pick<...>): Element', gave the following error.
    Property 'component' is missing in type '{ children: Element[]; container: true; direction: "row"; justifyContent: string; alignItems: 
"center"; }' but required in type '{ component: ElementType<any>; }'.
  Overload 2 of 2, '(props: DefaultComponentProps<GridTypeMap<{}, "div">>): Element', gave the following error.
    Type '{ children: Element[]; container: true; direction: "row"; justifyContent: string; alignItems: "center"; }' is not assignable to type 'IntrinsicAttributes & Partial<Record<Breakpoint, boolean | GridSize>> & { alignContent?: GridContentAlignment | undefined; ... 7 more 
...; zeroMinWidth?: boolean | undefined; } & CommonProps<...> & Pick<...>'.
      Property 'justifyContent' does not exist on type 'IntrinsicAttributes & Partial<Record<Breakpoint, boolean | GridSize>> & { alignContent?: GridContentAlignment | undefined; ... 7 more ...; zeroMinWidth?: boolean | undefined; } & CommonProps<...> & Pick<...>'.

Things are fine when I use, say, style={{justifyContent: 'center'}} or something to that effect instead, but using the justifyContent prop itself isn’t working.

0reactions
oliviertassinaricommented, Feb 10, 2021

Bug fixed in #24788.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Grid] Deprecation package says justifyContent=flex-start is ...
When setting justifyContent to flex-start , an error displays in the console stating the following: Warning: Failed prop type: Invalid prop ...
Read more >
Failed prop type: The prop `justify` of `ForwardRef(Grid)` is ...
Note that The prop justify is deprecated, use justifyContent instead. So, replace justify by justifyContent. Before : <Grid container ...
Read more >
justify-self - CSS: Cascading Style Sheets - MDN Web Docs
The CSS justify-self property sets the way a box is justified inside its alignment ... Pack item from the end */ justify-self: flex-start; ......
Read more >
A Complete Guide to Flexbox | CSS-Tricks
Our comprehensive guide to CSS flexbox layout. This complete guide explains everything about flexbox, focusing on all the different possible ...
Read more >
Modern CSS in Angular: Layouts
Modern CSS layouts. The two most recommended modern CSS layout solutions are CSS Flexbox and CSS Grid. CSS Flexbox. Flexbox is a one-dimensional...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found