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.

[Skeleton]: Can't read property 'gray' of undefined.

See original GitHub issue

Descriptions

  1. Importing Skeleton component cause problem that throw error “Can't read property 'gray' of undefined.
  2. Using AspectRatioBox, children width and height style properties value treated as full.

Codesanbox

Notes I use the latest version of @storybook/react.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
with-heartcommented, Aug 6, 2020

@clngkusnd Looks like it was fixed in the most recent version: https://codesandbox.io/s/chakra-ui-with-storybook-mn7t0?file=/src/stories/Issues.stories.js

Install 1.0.0-rc.0 please!

1reaction
geemanjscommented, Jul 18, 2020

Hey,

Looks like you’ve got a couple of problems. I forked your sandbox and I think fixed them all: https://codesandbox.io/s/chakra-ui-with-storybook-r31id

  1. The components are not wrapped in the chakra-ui ThemeProvider which means it’s unable to look up “theme values” from context. On my sandbox I added a decorator via the .storybook/preview.js file as per the Storybook docs
import { ThemeProvider, CSSReset, theme } from '@chakra-ui/core'

function App({ children }) {
  return (
    <ThemeProvider theme={theme}>
      <CSSReset />
      {children}
    </ThemeProvider>
  );
}
  1. AspectRatioBox requires a ratio and maxWidth prop to limit the size https://chakra-ui.com/aspectratiobox#embed-image

  2. The Icon is not exported as a “story” via a function

// Use this 
export const Icon = () => <IconBug name="copy" />;

// Instead of this
export const Icon = <IconBug name="copy"/> 
  1. Likewise the Skeleton isn’t exported as a “stroy” and is missing the height prop
// Use this
export const SkeletonExample = () => (<Skeleton height="40px" />)

// Instead of this
export { Skeleton } from '@chakra-ui/core`
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix "TypeError: Cannot read properties of undefined ...
Whenever I start the project it gives me the error, "TypeError: Cannot read properties of undefined (reading 'useSystemColorMode')".
Read more >
Animating a Skeleton Loader using Reanimated 2 | egghead.io
Now our loader is static, so it doesn't move at all. Most skeleton loaders have some kind of animation to make the user...
Read more >
Handy form validation in React Native with react-hook-form ...
First read through the end and check if your form management ... TypeError: Cannot read property 'split' of undefined happens when you ...
Read more >
Part 4: Query for Data with GraphQL - Gatsby
Start by setting up the skeleton for your new blog page component. Create a new file: src/pages/blog.js . Define and export a new...
Read more >
Menu - Chakra UI
Without a ref , the MenuList will render in an undefined position. ... When the menu is displayed, aria-expanded is set to true...
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