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] Fails when combining @chakra-ui/react and @material-ui/core

See original GitHub issue

TypeError: undefined is not a function

It fails here: https://github.com/mui-org/material-ui/blob/next/packages/material-ui/src/Autocomplete/Autocomplete.js#L340

  • The issue is present in the latest release aka alpha
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

<Autocomplete /> component can’t be opened.

Expected Behavior 🤔

<Autocomplete /> should work with chakra and material ui 😃

Steps to Reproduce 🕹

https://codesandbox.io/s/frosty-browser-694e6?file=/src/App.js

Steps:

  1. Try to open Autocomplete component

Context 🔦

I am using @material-ui/core and @chakra-ui/react in the same application (which might not be the best but that is a different topic). Looks like with the release of version 5 and some changes to the theme/styling the Autocomplete component broke.

Your Environment 🌎

`npx @material-ui/envinfo`
System:
    OS: macOS 10.15.7
  Binaries:
    Node: 15.12.0 - ~/.nvm/versions/node/v15.12.0/bin/node
    Yarn: 1.12.3 - /usr/local/bin/yarn
    npm: 7.6.3 - ~/.nvm/versions/node/v15.12.0/bin/npm
  Browsers:
    Chrome: 89.0.4389.128
    Edge: Not Found
    Firefox: 86.0
    Safari: 14.0.2

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:3
  • Comments:22 (12 by maintainers)

github_iconTop GitHub Comments

4reactions
rimiticommented, Jul 7, 2022

This issue is still present for latest mui and Chakra-ui version. If someone has found a solution, I’m interested.

3reactions
caocuong2404commented, May 6, 2022

This is like cake. Move inside the chakra user interface. The problem will be solved. 🐧

import "./styles.css";
import AutoComplete from "@material-ui/core/Autocomplete";
import TextField from "@material-ui/core/TextField";
import { ThemeProvider } from "@material-ui/core/styles";
import { createMuiTheme } from "@material-ui/core/styles";
import { ChakraProvider, extendTheme } from "@chakra-ui/react";

const muiTheme = createMuiTheme();
const theme = extendTheme();

export default function App() {
  return (
    <ChakraProvider theme={theme} resetCSS>
      <ThemeProvider theme={muiTheme}>
        <div className="App">
          <h1>Hello CodeSandbox</h1>
          <h2>Start editing to see some magic happen!</h2>
          <AutoComplete
            id="combo-box-demo"
            options={[{ title: "a" }, { title: "b" }, { title: "c" }]}
            getOptionLabel={(option) => option.title}
            renderInput={(params) => (
              <TextField {...params} label="Combo box" variant="outlined" />
            )}
          />
        </div>
      </ThemeProvider>
    </ChakraProvider>
  );
}

Sandbox link: https://codesandbox.io/s/eloquent-hopper-e2upeh?file=/src/App.js:0-1026

Read more comments on GitHub >

github_iconTop Results From Across the Web

Not able to create theme using Material UI's ThemeProvider ...
Attempted import error: 'createTheme' is not exported from '@material-ui/core/styles'. Code: import React, { Suspense, lazy } from "react"; ...
Read more >
Advanced Theming - Chakra UI
When adding new components, component variations, sizes, colors and other theme foundations, you can extend the internal theme typings to provide autocomplete ...
Read more >
Extend Material-UI theme in TypeScript - In Plain English
Combination of React and TypeScript is super powerful and beautiful. So it was meant to be that two of them met.
Read more >
Chakra UI: Sleek UI Components for React - KnowledgeHut
Components are simple to edit, expand, and theme. Components are small and easy to combine to construct larger structures.
Read more >
chakra-ui/react vs @mantine/core vs @material ... - npm trends
@chakra-ui/react vs @mantine/core vs @material-ui/core vs @mui/material ... As such, you need to ensure you are using the correct combination of versions.
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