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.

[theme] Getting `styleFromPropValue` for spacing will return undefined when using custom breakpoint named small

See original GitHub issue

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

Setting theme breakpoints like this

  breakpoints: {
    values: {
      xs: false,
      sm: false,
      md: false,
      lg: false,
      xl: false,
      smallest: 0,
      small: 375,
      mobile: 600,
      tablet: 992,
      desktop: 1200,
    }
  }

will return marginundefined: 32px when using

<Stack spacing={4}>
...
</Stack>

It seems that just the name small will cause that issue.

If renaming small into whatever will return correctly marginTop: 32px

Expected behavior 🤔

Should return a valid margin for spacing based on direction.

Steps to reproduce 🕹

CodeSandbox: https://codesandbox.io/s/peaceful-https-6iewi9?file=/src/Demo.tsx

Steps:

  1. use custom Breakpoint small
  2. use Stack spacing

Context 🔦

Look at:

https://github.com/mui/material-ui/blob/ba2fce43a735f6085e68c2d76ab746a098488862/packages/mui-material/src/Stack/Stack.js#L79-L88

https://github.com/mui/material-ui/blob/19e068343cce39c5b331fe8a9a3d647bd308aa44/packages/mui-system/src/breakpoints.js#L142

Your environment 🌎

`npx @mui/envinfo`
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ZeeshanTambolicommented, May 23, 2022

@TomFreudenberg Yes, I was able to reproduce it now. Thanks for the code snippet. Here is the CodeSandbox reproducing the issue. It looks like a bug.

0reactions
TomFreudenbergcommented, May 26, 2022

Thanks for actions and infos.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Theme.breakpoints is undefined in MUI React - Stack Overflow
Whenever I try to use theme.brekpoints.up , I always encounter the same error theme.breakpoints is undefined on console. version that I am ...
Read more >
youtube-danmaku - Source code - Greasy Fork
defineProperty(spacing, 'unit', { get: function get() { return ... disableGlobal) { // We can use a shorthand class name, we never use the...
Read more >
Additional Custom Breakpoints - Technical Details and Gotchas
We highly recommend testing the Additional Custom Breakpoint feature on a staging site before activating it on a production environment. We also ...
Read more >
How to use breakpoints in Material UI - YouTube
Course Article:https://entryleveldeveloper.training/premium/article/andrewgbliss/how- to - use - breakpoints -in-material-uiSocial ...
Read more >
https://www.sena.edu.co/es-co/ciudadano/Paginas/pr...
fixedElements.get(parent)) {\n return;\n } // if this is an implicitly ... but this is much easier and the native packages\n// might use a...
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